@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,56 +23,56 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return string $purchase_form |
| 25 | 25 | */ |
| 26 | -function give_get_donation_form( $args = array() ) { |
|
| 26 | +function give_get_donation_form($args = array()) { |
|
| 27 | 27 | |
| 28 | 28 | global $post; |
| 29 | 29 | |
| 30 | - $post_id = is_object( $post ) ? $post->ID : 0; |
|
| 30 | + $post_id = is_object($post) ? $post->ID : 0; |
|
| 31 | 31 | |
| 32 | - if ( isset( $args['id'] ) ) { |
|
| 32 | + if (isset($args['id'])) { |
|
| 33 | 33 | $post_id = $args['id']; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
| 36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
| 37 | 37 | 'form_id' => $post_id |
| 38 | - ) ); |
|
| 38 | + )); |
|
| 39 | 39 | |
| 40 | - $args = wp_parse_args( $args, $defaults ); |
|
| 40 | + $args = wp_parse_args($args, $defaults); |
|
| 41 | 41 | |
| 42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
| 42 | + $form = new Give_Donate_Form($args['form_id']); |
|
| 43 | 43 | |
| 44 | 44 | //bail if no form ID |
| 45 | - if ( empty( $form->ID ) ) { |
|
| 45 | + if (empty($form->ID)) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
| 49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
| 50 | 50 | |
| 51 | - $form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array( |
|
| 51 | + $form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array( |
|
| 52 | 52 | 'payment-mode' => $payment_mode, |
| 53 | - ) ), |
|
| 53 | + )), |
|
| 54 | 54 | give_get_current_page_url() |
| 55 | - ) ); |
|
| 55 | + )); |
|
| 56 | 56 | |
| 57 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_product', $form->ID ) ) { |
|
| 57 | + if ('publish' !== $form->post_status && ! current_user_can('edit_product', $form->ID)) { |
|
| 58 | 58 | return false; // Product not published or user doesn't have permission to view drafts |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 61 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 62 | 62 | ? $args['display_style'] |
| 63 | - : get_post_meta( $form->ID, '_give_payment_display', true ); |
|
| 63 | + : get_post_meta($form->ID, '_give_payment_display', true); |
|
| 64 | 64 | |
| 65 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
| 65 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
| 66 | 66 | ? ' float-labels-enabled' |
| 67 | 67 | : ''; |
| 68 | 68 | |
| 69 | 69 | |
| 70 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
| 70 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
| 71 | 71 | 'give-form-wrap', |
| 72 | - 'give-display-' . $display_option |
|
| 73 | - ), $form->ID, $args ); |
|
| 72 | + 'give-display-'.$display_option |
|
| 73 | + ), $form->ID, $args); |
|
| 74 | 74 | |
| 75 | - $form_classes = implode( ' ', $form_classes_array ); |
|
| 75 | + $form_classes = implode(' ', $form_classes_array); |
|
| 76 | 76 | |
| 77 | 77 | ob_start(); |
| 78 | 78 | |
@@ -84,34 +84,34 @@ discard block |
||
| 84 | 84 | * @param int $form ->ID The current form ID |
| 85 | 85 | * @param array $args An array of form args |
| 86 | 86 | */ |
| 87 | - do_action( 'give_pre_form_output', $form->ID, $args ); ?> |
|
| 87 | + do_action('give_pre_form_output', $form->ID, $args); ?> |
|
| 88 | 88 | |
| 89 | 89 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_classes; ?>"> |
| 90 | 90 | |
| 91 | 91 | <?php |
| 92 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
| 92 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
| 93 | 93 | |
| 94 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $post_id ) . '</h2>' ); |
|
| 94 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($post_id).'</h2>'); |
|
| 95 | 95 | |
| 96 | 96 | } ?> |
| 97 | 97 | |
| 98 | - <?php do_action( 'give_pre_form', $form->ID, $args ); ?> |
|
| 98 | + <?php do_action('give_pre_form', $form->ID, $args); ?> |
|
| 99 | 99 | |
| 100 | - <form id="give-form-<?php echo $post_id; ?>" class="give-form give-form-<?php echo absint( $form->ID ); ?><?php echo $float_labels_option; ?>" action="<?php echo $form_action; ?>" method="post"> |
|
| 100 | + <form id="give-form-<?php echo $post_id; ?>" class="give-form give-form-<?php echo absint($form->ID); ?><?php echo $float_labels_option; ?>" action="<?php echo $form_action; ?>" method="post"> |
|
| 101 | 101 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
| 102 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
| 103 | - <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 104 | - <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 105 | - <input type="hidden" name="give-form-minimum" value="<?php echo give_get_form_minimum_price( $form->ID ); ?>"/> |
|
| 102 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
| 103 | + <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 104 | + <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 105 | + <input type="hidden" name="give-form-minimum" value="<?php echo give_get_form_minimum_price($form->ID); ?>"/> |
|
| 106 | 106 | <?php |
| 107 | 107 | //Price ID hidden field for variable (mult-level) donation forms |
| 108 | - if ( give_has_variable_prices( $post_id ) ) { |
|
| 108 | + if (give_has_variable_prices($post_id)) { |
|
| 109 | 109 | //get default selected price ID |
| 110 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $post_id ), $post_id ); |
|
| 110 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($post_id), $post_id); |
|
| 111 | 111 | $price_id = 0; |
| 112 | 112 | //loop through prices |
| 113 | - foreach ( $prices as $price ) { |
|
| 114 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 113 | + foreach ($prices as $price) { |
|
| 114 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 115 | 115 | $price_id = $price['_give_id']['level_id']; |
| 116 | 116 | }; |
| 117 | 117 | } |
@@ -119,19 +119,19 @@ discard block |
||
| 119 | 119 | <input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/> |
| 120 | 120 | <?php } |
| 121 | 121 | |
| 122 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
| 122 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
| 123 | 123 | |
| 124 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
| 124 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
| 125 | 125 | |
| 126 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
| 126 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
| 127 | 127 | |
| 128 | 128 | ?> |
| 129 | 129 | |
| 130 | 130 | </form> |
| 131 | 131 | |
| 132 | - <?php do_action( 'give_post_form', $form->ID, $args ); ?> |
|
| 132 | + <?php do_action('give_post_form', $form->ID, $args); ?> |
|
| 133 | 133 | |
| 134 | - <!--end #give-form-<?php echo absint( $form->ID ); ?>--></div> |
|
| 134 | + <!--end #give-form-<?php echo absint($form->ID); ?>--></div> |
|
| 135 | 135 | <?php |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | * @param int $form ->ID The current form ID |
| 143 | 143 | * @param array $args An array of form args |
| 144 | 144 | */ |
| 145 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
| 145 | + do_action('give_post_form_output', $form->ID, $args); |
|
| 146 | 146 | |
| 147 | 147 | $final_output = ob_get_clean(); |
| 148 | 148 | |
| 149 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
| 149 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -166,57 +166,57 @@ discard block |
||
| 166 | 166 | * @global $give_options Array of all the Give options |
| 167 | 167 | * @return string |
| 168 | 168 | */ |
| 169 | -function give_show_purchase_form( $form_id ) { |
|
| 169 | +function give_show_purchase_form($form_id) { |
|
| 170 | 170 | |
| 171 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 171 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 172 | 172 | |
| 173 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
| 173 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
| 174 | 174 | $form_id = $_POST['give_form_id']; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - do_action( 'give_purchase_form_top', $form_id ); |
|
| 177 | + do_action('give_purchase_form_top', $form_id); |
|
| 178 | 178 | |
| 179 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
| 179 | + if (give_can_checkout() && isset($form_id)) { |
|
| 180 | 180 | |
| 181 | - do_action( 'give_purchase_form_before_register_login', $form_id ); |
|
| 181 | + do_action('give_purchase_form_before_register_login', $form_id); |
|
| 182 | 182 | |
| 183 | - $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
| 183 | + $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
|
| 184 | 184 | |
| 185 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
| 185 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
| 186 | 186 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 187 | - <?php do_action( 'give_purchase_form_register_fields', $form_id ); ?> |
|
| 187 | + <?php do_action('give_purchase_form_register_fields', $form_id); ?> |
|
| 188 | 188 | </div> |
| 189 | - <?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
| 189 | + <?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
| 190 | 190 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 191 | - <?php do_action( 'give_purchase_form_login_fields', $form_id ); ?> |
|
| 191 | + <?php do_action('give_purchase_form_login_fields', $form_id); ?> |
|
| 192 | 192 | </div> |
| 193 | 193 | <?php endif; ?> |
| 194 | 194 | |
| 195 | - <?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
| 196 | - do_action( 'give_purchase_form_after_user_info', $form_id ); |
|
| 195 | + <?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
| 196 | + do_action('give_purchase_form_after_user_info', $form_id); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - do_action( 'give_purchase_form_before_cc_form', $form_id ); |
|
| 199 | + do_action('give_purchase_form_before_cc_form', $form_id); |
|
| 200 | 200 | |
| 201 | 201 | // Load the credit card form and allow gateways to load their own if they wish |
| 202 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
| 203 | - do_action( 'give_' . $payment_mode . '_cc_form', $form_id ); |
|
| 202 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
| 203 | + do_action('give_'.$payment_mode.'_cc_form', $form_id); |
|
| 204 | 204 | } else { |
| 205 | - do_action( 'give_cc_form', $form_id ); |
|
| 205 | + do_action('give_cc_form', $form_id); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - do_action( 'give_purchase_form_after_cc_form', $form_id ); |
|
| 208 | + do_action('give_purchase_form_after_cc_form', $form_id); |
|
| 209 | 209 | |
| 210 | 210 | } else { |
| 211 | 211 | // Can't checkout |
| 212 | - do_action( 'give_purchase_form_no_access', $form_id ); |
|
| 212 | + do_action('give_purchase_form_no_access', $form_id); |
|
| 213 | 213 | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - do_action( 'give_purchase_form_bottom', $form_id ); |
|
| 216 | + do_action('give_purchase_form_bottom', $form_id); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | -add_action( 'give_purchase_form', 'give_show_purchase_form' ); |
|
| 219 | +add_action('give_purchase_form', 'give_show_purchase_form'); |
|
| 220 | 220 | |
| 221 | 221 | /** |
| 222 | 222 | * Donation Amount Field |
@@ -230,37 +230,37 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @return void |
| 232 | 232 | */ |
| 233 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
| 233 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
| 234 | 234 | |
| 235 | 235 | global $give_options; |
| 236 | 236 | |
| 237 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
| 238 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 239 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 240 | - $symbol = give_currency_symbol( $give_options['currency'] ); |
|
| 241 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
| 242 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
| 243 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 237 | + $variable_pricing = give_has_variable_prices($form_id); |
|
| 238 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 239 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 240 | + $symbol = give_currency_symbol($give_options['currency']); |
|
| 241 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
| 242 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
| 243 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 244 | 244 | |
| 245 | - do_action( 'give_before_donation_levels', $form_id ); |
|
| 245 | + do_action('give_before_donation_levels', $form_id); |
|
| 246 | 246 | |
| 247 | 247 | //Set Price, No Custom Amount Allowed means hidden price field |
| 248 | - if ( $allow_custom_amount == 'no' ) { |
|
| 248 | + if ($allow_custom_amount == 'no') { |
|
| 249 | 249 | ?> |
| 250 | 250 | |
| 251 | - <label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
| 251 | + <label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
| 252 | 252 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
| 253 | 253 | value="<?php echo $default_amount; ?>" required> |
| 254 | 254 | <p class="set-price give-donation-amount form-row-wide"> |
| 255 | - <?php if ( $currency_position == 'before' ) { |
|
| 255 | + <?php if ($currency_position == 'before') { |
|
| 256 | 256 | echo $currency_output; |
| 257 | 257 | } ?> |
| 258 | 258 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
| 259 | - <?php if ( $currency_position == 'after' ) { |
|
| 259 | + <?php if ($currency_position == 'after') { |
|
| 260 | 260 | echo $currency_output; |
| 261 | 261 | } ?> |
| 262 | 262 | <span class="give-loading-text give-updating-price-loader"> |
| 263 | - <span class="give-loading-animation"></span> <?php _e( 'Updating Amount...', 'give' ); ?> |
|
| 263 | + <span class="give-loading-animation"></span> <?php _e('Updating Amount...', 'give'); ?> |
|
| 264 | 264 | </span> |
| 265 | 265 | </p> |
| 266 | 266 | <?php |
@@ -269,35 +269,35 @@ discard block |
||
| 269 | 269 | ?> |
| 270 | 270 | <div class="give-total-wrap"> |
| 271 | 271 | <div class="give-donation-amount form-row-wide"> |
| 272 | - <?php if ( $currency_position == 'before' ) { |
|
| 272 | + <?php if ($currency_position == 'before') { |
|
| 273 | 273 | echo $currency_output; |
| 274 | 274 | } ?> |
| 275 | - <label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
| 275 | + <label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
| 276 | 276 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
| 277 | 277 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
| 278 | - <?php if ( $currency_position == 'after' ) { |
|
| 278 | + <?php if ($currency_position == 'after') { |
|
| 279 | 279 | echo $currency_output; |
| 280 | 280 | } ?> |
| 281 | 281 | <span class="give-loading-text give-updating-price-loader"> |
| 282 | - <span class="give-loading-animation"></span> <?php _e( 'Updating Amount...', 'give' ); ?> |
|
| 282 | + <span class="give-loading-animation"></span> <?php _e('Updating Amount...', 'give'); ?> |
|
| 283 | 283 | </span> |
| 284 | 284 | </div> |
| 285 | 285 | </div> |
| 286 | 286 | <?php } |
| 287 | 287 | |
| 288 | 288 | //Custom Amount Text |
| 289 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' ) { ?> |
|
| 290 | - <p class="give-custom-amount-text"><?php echo ! empty( $custom_amount_text ) ? $custom_amount_text : ''; ?></p> |
|
| 289 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes') { ?> |
|
| 290 | + <p class="give-custom-amount-text"><?php echo ! empty($custom_amount_text) ? $custom_amount_text : ''; ?></p> |
|
| 291 | 291 | <?php } |
| 292 | 292 | |
| 293 | 293 | //Output Variable Pricing Levels |
| 294 | - if ( $variable_pricing ) { |
|
| 295 | - give_output_levels( $form_id ); |
|
| 294 | + if ($variable_pricing) { |
|
| 295 | + give_output_levels($form_id); |
|
| 296 | 296 | } |
| 297 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
| 297 | + do_action('give_after_donation_levels', $form_id, $args); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
| 300 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
| 301 | 301 | |
| 302 | 302 | |
| 303 | 303 | /** |
@@ -309,32 +309,32 @@ discard block |
||
| 309 | 309 | * |
| 310 | 310 | * @return string |
| 311 | 311 | */ |
| 312 | -function give_output_levels( $form_id ) { |
|
| 312 | +function give_output_levels($form_id) { |
|
| 313 | 313 | |
| 314 | 314 | //Get variable pricing |
| 315 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 316 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
| 317 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 318 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 319 | - if ( empty( $custom_amount_text ) ) { |
|
| 320 | - $custom_amount_text = __( 'Give a Custom Amount', 'give' ); |
|
| 315 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 316 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
| 317 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 318 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 319 | + if (empty($custom_amount_text)) { |
|
| 320 | + $custom_amount_text = __('Give a Custom Amount', 'give'); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | $output = ''; |
| 324 | 324 | $counter = 0; |
| 325 | 325 | |
| 326 | - switch ( $display_style ) { |
|
| 326 | + switch ($display_style) { |
|
| 327 | 327 | case 'buttons': |
| 328 | 328 | |
| 329 | 329 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 330 | 330 | |
| 331 | - foreach ( $prices as $price ) { |
|
| 332 | - $counter ++; |
|
| 333 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 334 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
| 331 | + foreach ($prices as $price) { |
|
| 332 | + $counter++; |
|
| 333 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 334 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
| 335 | 335 | |
| 336 | 336 | $output .= '<li>'; |
| 337 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 337 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 338 | 338 | $output .= $level_text; |
| 339 | 339 | $output .= '</button>'; |
| 340 | 340 | $output .= '</li>'; |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | //Custom Amount |
| 345 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 345 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 346 | 346 | $output .= '<li>'; |
| 347 | 347 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
| 348 | 348 | $output .= $custom_amount_text; |
@@ -358,23 +358,23 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 360 | 360 | |
| 361 | - foreach ( $prices as $price ) { |
|
| 362 | - $counter ++; |
|
| 363 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 364 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 361 | + foreach ($prices as $price) { |
|
| 362 | + $counter++; |
|
| 363 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 364 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 365 | 365 | |
| 366 | 366 | $output .= '<li>'; |
| 367 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 368 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
| 367 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 368 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
| 369 | 369 | $output .= '</li>'; |
| 370 | 370 | |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | //Custom Amount |
| 374 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 374 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 375 | 375 | $output .= '<li>'; |
| 376 | 376 | $output .= '<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">'; |
| 377 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
| 377 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
| 378 | 378 | $output .= '</li>'; |
| 379 | 379 | } |
| 380 | 380 | |
@@ -384,23 +384,23 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | case 'dropdown': |
| 386 | 386 | |
| 387 | - $output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose your Donation Amount', 'give' ) . ':</label>'; |
|
| 388 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">'; |
|
| 387 | + $output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose your Donation Amount', 'give').':</label>'; |
|
| 388 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">'; |
|
| 389 | 389 | |
| 390 | 390 | //first loop through prices |
| 391 | - foreach ( $prices as $price ) { |
|
| 392 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 393 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id, $form_id, $price ); |
|
| 391 | + foreach ($prices as $price) { |
|
| 392 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 393 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id, $form_id, $price); |
|
| 394 | 394 | |
| 395 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 395 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 396 | 396 | $output .= $level_text; |
| 397 | 397 | $output .= '</option>'; |
| 398 | 398 | |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | //Custom Amount |
| 402 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 403 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
| 402 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 403 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | $output .= '</select>'; |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | break; |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
| 411 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | /** |
@@ -420,26 +420,26 @@ discard block |
||
| 420 | 420 | * @param array $args |
| 421 | 421 | * |
| 422 | 422 | */ |
| 423 | -function give_display_checkout_button( $form_id, $args ) { |
|
| 423 | +function give_display_checkout_button($form_id, $args) { |
|
| 424 | 424 | |
| 425 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 425 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 426 | 426 | ? $args['display_style'] |
| 427 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
| 427 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
| 428 | 428 | |
| 429 | 429 | //no btn for onpage |
| 430 | - if ( $display_option === 'onpage' ) { |
|
| 430 | + if ($display_option === 'onpage') { |
|
| 431 | 431 | return; |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
| 435 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
| 434 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
| 435 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
| 436 | 436 | |
| 437 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
| 437 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
| 438 | 438 | |
| 439 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
| 439 | + echo apply_filters('give_display_checkout_button', $output); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
| 442 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
| 443 | 443 | |
| 444 | 444 | /** |
| 445 | 445 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -450,71 +450,71 @@ discard block |
||
| 450 | 450 | * |
| 451 | 451 | * @return void |
| 452 | 452 | */ |
| 453 | -function give_user_info_fields( $form_id ) { |
|
| 453 | +function give_user_info_fields($form_id) { |
|
| 454 | 454 | |
| 455 | - if ( is_user_logged_in() ) : |
|
| 456 | - $user_data = get_userdata( get_current_user_id() ); |
|
| 455 | + if (is_user_logged_in()) : |
|
| 456 | + $user_data = get_userdata(get_current_user_id()); |
|
| 457 | 457 | endif; |
| 458 | 458 | |
| 459 | - do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
| 459 | + do_action('give_purchase_form_before_personal_info', $form_id); |
|
| 460 | 460 | ?> |
| 461 | 461 | <fieldset id="give_checkout_user_info"> |
| 462 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend> |
|
| 462 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend> |
|
| 463 | 463 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
| 464 | 464 | <label class="give-label" for="give-first"> |
| 465 | - <?php _e( 'First Name', 'give' ); ?> |
|
| 466 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
| 465 | + <?php _e('First Name', 'give'); ?> |
|
| 466 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
| 467 | 467 | <span class="give-required-indicator">*</span> |
| 468 | 468 | <?php } ?> |
| 469 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
| 469 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
| 470 | 470 | </label> |
| 471 | - <input class="give-input required" type="text" name="give_first" placeholder="<?php _e( 'First name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) { |
|
| 471 | + <input class="give-input required" type="text" name="give_first" placeholder="<?php _e('First name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) { |
|
| 472 | 472 | echo ' required '; |
| 473 | 473 | } ?>/> |
| 474 | 474 | </p> |
| 475 | 475 | |
| 476 | 476 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
| 477 | 477 | <label class="give-label" for="give-last"> |
| 478 | - <?php _e( 'Last Name', 'give' ); ?> |
|
| 479 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
| 478 | + <?php _e('Last Name', 'give'); ?> |
|
| 479 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
| 480 | 480 | <span class="give-required-indicator">*</span> |
| 481 | 481 | <?php } ?> |
| 482 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
| 482 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
| 483 | 483 | </label> |
| 484 | 484 | |
| 485 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
| 485 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
| 486 | 486 | echo ' required'; |
| 487 | - } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e( 'Last name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
| 487 | + } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e('Last name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) { |
|
| 488 | 488 | echo ' required '; |
| 489 | 489 | } ?> /> |
| 490 | 490 | </p> |
| 491 | 491 | |
| 492 | - <?php do_action( 'give_purchase_form_before_email', $form_id ); ?> |
|
| 492 | + <?php do_action('give_purchase_form_before_email', $form_id); ?> |
|
| 493 | 493 | <p id="give-email-wrap" class="form-row form-row-wide"> |
| 494 | 494 | <label class="give-label" for="give-email"> |
| 495 | - <?php _e( 'Email Address', 'give' ); ?> |
|
| 496 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
| 495 | + <?php _e('Email Address', 'give'); ?> |
|
| 496 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
| 497 | 497 | <span class="give-required-indicator">*</span> |
| 498 | 498 | <?php } ?> |
| 499 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span> |
|
| 499 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span> |
|
| 500 | 500 | </label> |
| 501 | 501 | |
| 502 | - <input class="give-input required" type="email" name="give_email" placeholder="<?php _e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) { |
|
| 502 | + <input class="give-input required" type="email" name="give_email" placeholder="<?php _e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) { |
|
| 503 | 503 | echo ' required '; |
| 504 | 504 | } ?>/> |
| 505 | 505 | |
| 506 | 506 | </p> |
| 507 | - <?php do_action( 'give_purchase_form_after_email', $form_id ); ?> |
|
| 507 | + <?php do_action('give_purchase_form_after_email', $form_id); ?> |
|
| 508 | 508 | |
| 509 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
| 509 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
| 510 | 510 | </fieldset> |
| 511 | 511 | <?php |
| 512 | - do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
| 512 | + do_action('give_purchase_form_after_personal_info', $form_id); |
|
| 513 | 513 | |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | -add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
|
| 517 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
| 516 | +add_action('give_purchase_form_after_user_info', 'give_user_info_fields'); |
|
| 517 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
| 518 | 518 | |
| 519 | 519 | /** |
| 520 | 520 | * Renders the credit card info form. |
@@ -525,73 +525,73 @@ discard block |
||
| 525 | 525 | * |
| 526 | 526 | * @return void |
| 527 | 527 | */ |
| 528 | -function give_get_cc_form( $form_id ) { |
|
| 528 | +function give_get_cc_form($form_id) { |
|
| 529 | 529 | |
| 530 | 530 | ob_start(); |
| 531 | 531 | |
| 532 | - do_action( 'give_before_cc_fields', $form_id ); ?> |
|
| 532 | + do_action('give_before_cc_fields', $form_id); ?> |
|
| 533 | 533 | |
| 534 | 534 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
| 535 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend> |
|
| 536 | - <?php if ( is_ssl() ) : ?> |
|
| 535 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend> |
|
| 536 | + <?php if (is_ssl()) : ?> |
|
| 537 | 537 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
| 538 | 538 | <span class="give-icon padlock"></span> |
| 539 | - <span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
| 539 | + <span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
| 540 | 540 | </div> |
| 541 | 541 | <?php endif; ?> |
| 542 | 542 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
| 543 | 543 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
| 544 | - <?php _e( 'Card Number', 'give' ); ?> |
|
| 544 | + <?php _e('Card Number', 'give'); ?> |
|
| 545 | 545 | <span class="give-required-indicator">*</span> |
| 546 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
| 546 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
| 547 | 547 | <span class="card-type"></span> |
| 548 | 548 | </label> |
| 549 | 549 | |
| 550 | - <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" required/> |
|
| 550 | + <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" required/> |
|
| 551 | 551 | </p> |
| 552 | 552 | |
| 553 | 553 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
| 554 | 554 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
| 555 | - <?php _e( 'CVC', 'give' ); ?> |
|
| 555 | + <?php _e('CVC', 'give'); ?> |
|
| 556 | 556 | <span class="give-required-indicator">*</span> |
| 557 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
| 557 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
| 558 | 558 | </label> |
| 559 | 559 | |
| 560 | - <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" required/> |
|
| 560 | + <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" required/> |
|
| 561 | 561 | </p> |
| 562 | 562 | |
| 563 | 563 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
| 564 | 564 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
| 565 | - <?php _e( 'Name on the Card', 'give' ); ?> |
|
| 565 | + <?php _e('Name on the Card', 'give'); ?> |
|
| 566 | 566 | <span class="give-required-indicator">*</span> |
| 567 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
| 567 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
| 568 | 568 | </label> |
| 569 | 569 | |
| 570 | - <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e( 'Card name', 'give' ); ?>" required/> |
|
| 570 | + <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e('Card name', 'give'); ?>" required/> |
|
| 571 | 571 | </p> |
| 572 | - <?php do_action( 'give_before_cc_expiration' ); ?> |
|
| 572 | + <?php do_action('give_before_cc_expiration'); ?> |
|
| 573 | 573 | <p class="card-expiration form-row form-row-one-third"> |
| 574 | 574 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
| 575 | - <?php _e( 'Expiration', 'give' ); ?> |
|
| 575 | + <?php _e('Expiration', 'give'); ?> |
|
| 576 | 576 | <span class="give-required-indicator">*</span> |
| 577 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
| 577 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
| 578 | 578 | </label> |
| 579 | 579 | |
| 580 | 580 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
| 581 | 581 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
| 582 | 582 | |
| 583 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e( 'MM / YY', 'give' ); ?>" required/> |
|
| 583 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e('MM / YY', 'give'); ?>" required/> |
|
| 584 | 584 | </p> |
| 585 | - <?php do_action( 'give_after_cc_expiration', $form_id ); ?> |
|
| 585 | + <?php do_action('give_after_cc_expiration', $form_id); ?> |
|
| 586 | 586 | |
| 587 | 587 | </fieldset> |
| 588 | 588 | <?php |
| 589 | - do_action( 'give_after_cc_fields', $form_id ); |
|
| 589 | + do_action('give_after_cc_fields', $form_id); |
|
| 590 | 590 | |
| 591 | 591 | echo ob_get_clean(); |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
| 594 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
| 595 | 595 | |
| 596 | 596 | /** |
| 597 | 597 | * Outputs the default credit card address fields |
@@ -602,110 +602,110 @@ discard block |
||
| 602 | 602 | * |
| 603 | 603 | * @return void |
| 604 | 604 | */ |
| 605 | -function give_default_cc_address_fields( $form_id ) { |
|
| 605 | +function give_default_cc_address_fields($form_id) { |
|
| 606 | 606 | |
| 607 | 607 | $logged_in = is_user_logged_in(); |
| 608 | 608 | |
| 609 | - if ( $logged_in ) { |
|
| 610 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
| 609 | + if ($logged_in) { |
|
| 610 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
| 611 | 611 | } |
| 612 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
| 613 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
| 614 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
| 615 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
| 612 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
| 613 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
| 614 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
| 615 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
| 616 | 616 | ob_start(); ?> |
| 617 | 617 | <fieldset id="give_cc_address" class="cc-address"> |
| 618 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend> |
|
| 619 | - <?php do_action( 'give_cc_billing_top' ); ?> |
|
| 618 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend> |
|
| 619 | + <?php do_action('give_cc_billing_top'); ?> |
|
| 620 | 620 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
| 621 | 621 | <label for="card_address" class="give-label"> |
| 622 | - <?php _e( 'Address', 'give' ); ?> |
|
| 622 | + <?php _e('Address', 'give'); ?> |
|
| 623 | 623 | <?php |
| 624 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
| 624 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
| 625 | 625 | <span class="give-required-indicator">*</span> |
| 626 | 626 | <?php } ?> |
| 627 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
| 627 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
| 628 | 628 | </label> |
| 629 | 629 | |
| 630 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
| 630 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
| 631 | 631 | echo ' required'; |
| 632 | - } ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
| 632 | + } ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
| 633 | 633 | echo ' required '; |
| 634 | 634 | } ?>/> |
| 635 | 635 | </p> |
| 636 | 636 | |
| 637 | 637 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
| 638 | 638 | <label for="card_address_2" class="give-label"> |
| 639 | - <?php _e( 'Address Line 2', 'give' ); ?> |
|
| 640 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
| 639 | + <?php _e('Address Line 2', 'give'); ?> |
|
| 640 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
| 641 | 641 | <span class="give-required-indicator">*</span> |
| 642 | 642 | <?php } ?> |
| 643 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
| 643 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
| 644 | 644 | </label> |
| 645 | 645 | |
| 646 | - <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
| 646 | + <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
| 647 | 647 | echo ' required'; |
| 648 | - } ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
| 648 | + } ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
| 649 | 649 | echo ' required '; |
| 650 | 650 | } ?>/> |
| 651 | 651 | </p> |
| 652 | 652 | |
| 653 | 653 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
| 654 | 654 | <label for="card_city" class="give-label"> |
| 655 | - <?php _e( 'City', 'give' ); ?> |
|
| 656 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
| 655 | + <?php _e('City', 'give'); ?> |
|
| 656 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
| 657 | 657 | <span class="give-required-indicator">*</span> |
| 658 | 658 | <?php } ?> |
| 659 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
| 659 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span> |
|
| 660 | 660 | </label> |
| 661 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
| 661 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
| 662 | 662 | echo ' required'; |
| 663 | - } ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
| 663 | + } ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
| 664 | 664 | echo ' required '; |
| 665 | 665 | } ?>/> |
| 666 | 666 | </p> |
| 667 | 667 | |
| 668 | 668 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
| 669 | 669 | <label for="card_zip" class="give-label"> |
| 670 | - <?php _e( 'Zip / Postal Code', 'give' ); ?> |
|
| 671 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
| 670 | + <?php _e('Zip / Postal Code', 'give'); ?> |
|
| 671 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
| 672 | 672 | <span class="give-required-indicator">*</span> |
| 673 | 673 | <?php } ?> |
| 674 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
| 674 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
| 675 | 675 | </label> |
| 676 | 676 | |
| 677 | - <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
| 677 | + <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) { |
|
| 678 | 678 | echo ' required'; |
| 679 | - } ?>" placeholder="<?php _e( 'Zip / Postal code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
| 679 | + } ?>" placeholder="<?php _e('Zip / Postal code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
| 680 | 680 | echo ' required '; |
| 681 | 681 | } ?>/> |
| 682 | 682 | </p> |
| 683 | 683 | |
| 684 | 684 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
| 685 | 685 | <label for="billing_country" class="give-label"> |
| 686 | - <?php _e( 'Country', 'give' ); ?> |
|
| 687 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
| 686 | + <?php _e('Country', 'give'); ?> |
|
| 687 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
| 688 | 688 | <span class="give-required-indicator">*</span> |
| 689 | 689 | <?php } ?> |
| 690 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
| 690 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span> |
|
| 691 | 691 | </label> |
| 692 | 692 | |
| 693 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
| 693 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
| 694 | 694 | echo ' required'; |
| 695 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
| 695 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
| 696 | 696 | echo ' required '; |
| 697 | 697 | } ?>> |
| 698 | 698 | <?php |
| 699 | 699 | |
| 700 | 700 | $selected_country = give_get_country(); |
| 701 | 701 | |
| 702 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
| 702 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
| 703 | 703 | $selected_country = $user_address['country']; |
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | $countries = give_get_country_list(); |
| 707 | - foreach ( $countries as $country_code => $country ) { |
|
| 708 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 707 | + foreach ($countries as $country_code => $country) { |
|
| 708 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 709 | 709 | } |
| 710 | 710 | ?> |
| 711 | 711 | </select> |
@@ -713,44 +713,44 @@ discard block |
||
| 713 | 713 | |
| 714 | 714 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
| 715 | 715 | <label for="card_state" class="give-label"> |
| 716 | - <?php _e( 'State / Province', 'give' ); ?> |
|
| 717 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
| 716 | + <?php _e('State / Province', 'give'); ?> |
|
| 717 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
| 718 | 718 | <span class="give-required-indicator">*</span> |
| 719 | 719 | <?php } ?> |
| 720 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
| 720 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span> |
|
| 721 | 721 | </label> |
| 722 | 722 | |
| 723 | 723 | <?php |
| 724 | 724 | $selected_state = give_get_state(); |
| 725 | - $states = give_get_states( $selected_country ); |
|
| 725 | + $states = give_get_states($selected_country); |
|
| 726 | 726 | |
| 727 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
| 727 | + if ($logged_in && ! empty($user_address['state'])) { |
|
| 728 | 728 | $selected_state = $user_address['state']; |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | - if ( ! empty( $states ) ) : ?> |
|
| 732 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
| 731 | + if ( ! empty($states)) : ?> |
|
| 732 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
| 733 | 733 | echo ' required'; |
| 734 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
| 734 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
| 735 | 735 | echo ' required '; |
| 736 | 736 | } ?>> |
| 737 | 737 | <?php |
| 738 | - foreach ( $states as $state_code => $state ) { |
|
| 739 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 738 | + foreach ($states as $state_code => $state) { |
|
| 739 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 740 | 740 | } |
| 741 | 741 | ?> |
| 742 | 742 | </select> |
| 743 | 743 | <?php else : ?> |
| 744 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/> |
|
| 744 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/> |
|
| 745 | 745 | <?php endif; ?> |
| 746 | 746 | </p> |
| 747 | - <?php do_action( 'give_cc_billing_bottom' ); ?> |
|
| 747 | + <?php do_action('give_cc_billing_bottom'); ?> |
|
| 748 | 748 | </fieldset> |
| 749 | 749 | <?php |
| 750 | 750 | echo ob_get_clean(); |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
| 753 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
| 754 | 754 | |
| 755 | 755 | |
| 756 | 756 | /** |
@@ -762,94 +762,94 @@ discard block |
||
| 762 | 762 | * |
| 763 | 763 | * @return string |
| 764 | 764 | */ |
| 765 | -function give_get_register_fields( $form_id ) { |
|
| 765 | +function give_get_register_fields($form_id) { |
|
| 766 | 766 | |
| 767 | 767 | global $give_options; |
| 768 | 768 | global $user_ID; |
| 769 | 769 | |
| 770 | - if ( is_user_logged_in() ) { |
|
| 771 | - $user_data = get_userdata( $user_ID ); |
|
| 770 | + if (is_user_logged_in()) { |
|
| 771 | + $user_data = get_userdata($user_ID); |
|
| 772 | 772 | } |
| 773 | 773 | |
| 774 | - $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
| 774 | + $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
|
| 775 | 775 | |
| 776 | 776 | ob_start(); ?> |
| 777 | 777 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
| 778 | 778 | |
| 779 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 779 | + <?php if ($show_register_form == 'both') { ?> |
|
| 780 | 780 | <div class="give-login-account-wrap"> |
| 781 | - <p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?> |
|
| 782 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-register-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a> |
|
| 781 | + <p class="give-login-message"><?php _e('Already have an account?', 'give'); ?> |
|
| 782 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-register-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a> |
|
| 783 | 783 | </p> |
| 784 | 784 | <p class="give-loading-text"> |
| 785 | - <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p> |
|
| 785 | + <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p> |
|
| 786 | 786 | </div> |
| 787 | 787 | <?php } ?> |
| 788 | 788 | |
| 789 | - <?php do_action( 'give_register_fields_before' ); ?> |
|
| 789 | + <?php do_action('give_register_fields_before'); ?> |
|
| 790 | 790 | |
| 791 | 791 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
| 792 | - <legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) ); |
|
| 793 | - if ( ! give_no_guest_checkout( $form_id ) ) { |
|
| 794 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
| 792 | + <legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give')); |
|
| 793 | + if ( ! give_no_guest_checkout($form_id)) { |
|
| 794 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
| 795 | 795 | } ?></legend> |
| 796 | - <?php do_action( 'give_register_account_fields_before' ); ?> |
|
| 796 | + <?php do_action('give_register_account_fields_before'); ?> |
|
| 797 | 797 | <p id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
| 798 | 798 | <label for="give-user-login-<?php echo $form_id; ?>"> |
| 799 | - <?php _e( 'Username', 'give' ); ?> |
|
| 800 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
| 799 | + <?php _e('Username', 'give'); ?> |
|
| 800 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
| 801 | 801 | <span class="give-required-indicator">*</span> |
| 802 | 802 | <?php } ?> |
| 803 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
| 803 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
| 804 | 804 | </label> |
| 805 | 805 | |
| 806 | - <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
| 806 | + <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_no_guest_checkout($form_id)) { |
|
| 807 | 807 | echo 'required '; |
| 808 | - } ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/> |
|
| 808 | + } ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/> |
|
| 809 | 809 | </p> |
| 810 | 810 | |
| 811 | 811 | <p id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
| 812 | 812 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
| 813 | - <?php _e( 'Password', 'give' ); ?> |
|
| 814 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
| 813 | + <?php _e('Password', 'give'); ?> |
|
| 814 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
| 815 | 815 | <span class="give-required-indicator">*</span> |
| 816 | 816 | <?php } ?> |
| 817 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
| 817 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span> |
|
| 818 | 818 | </label> |
| 819 | 819 | |
| 820 | - <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
| 820 | + <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_no_guest_checkout($form_id)) { |
|
| 821 | 821 | echo 'required '; |
| 822 | - } ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/> |
|
| 822 | + } ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/> |
|
| 823 | 823 | </p> |
| 824 | 824 | |
| 825 | 825 | <p id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
| 826 | 826 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
| 827 | - <?php _e( 'Confirm Password', 'give' ); ?> |
|
| 828 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
| 827 | + <?php _e('Confirm Password', 'give'); ?> |
|
| 828 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
| 829 | 829 | <span class="give-required-indicator">*</span> |
| 830 | 830 | <?php } ?> |
| 831 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
| 831 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
| 832 | 832 | </label> |
| 833 | 833 | |
| 834 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
| 834 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_no_guest_checkout($form_id)) { |
|
| 835 | 835 | echo 'required '; |
| 836 | - } ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/> |
|
| 836 | + } ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/> |
|
| 837 | 837 | </p> |
| 838 | - <?php do_action( 'give_register_account_fields_after', $form_id ); ?> |
|
| 838 | + <?php do_action('give_register_account_fields_after', $form_id); ?> |
|
| 839 | 839 | </fieldset> |
| 840 | 840 | |
| 841 | - <?php do_action( 'give_register_fields_after', $form_id ); ?> |
|
| 841 | + <?php do_action('give_register_fields_after', $form_id); ?> |
|
| 842 | 842 | |
| 843 | 843 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
| 844 | 844 | |
| 845 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
| 845 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
| 846 | 846 | |
| 847 | 847 | </fieldset> |
| 848 | 848 | <?php |
| 849 | 849 | echo ob_get_clean(); |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
| 852 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
| 853 | 853 | |
| 854 | 854 | /** |
| 855 | 855 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -862,76 +862,76 @@ discard block |
||
| 862 | 862 | * |
| 863 | 863 | * @return string |
| 864 | 864 | */ |
| 865 | -function give_get_login_fields( $form_id ) { |
|
| 865 | +function give_get_login_fields($form_id) { |
|
| 866 | 866 | |
| 867 | 867 | global $give_options; |
| 868 | 868 | |
| 869 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
| 870 | - $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
| 869 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
| 870 | + $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
|
| 871 | 871 | |
| 872 | 872 | ob_start(); |
| 873 | 873 | ?> |
| 874 | 874 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
| 875 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) ); |
|
| 876 | - if ( ! give_no_guest_checkout( $form_id ) ) { |
|
| 877 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
| 875 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give')); |
|
| 876 | + if ( ! give_no_guest_checkout($form_id)) { |
|
| 877 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
| 878 | 878 | } ?> |
| 879 | 879 | </legend> |
| 880 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 880 | + <?php if ($show_register_form == 'both') { ?> |
|
| 881 | 881 | <p class="give-new-account-link"> |
| 882 | - <?php _e( 'Need to create an account?', 'give' ); ?> |
|
| 883 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-login" |
|
| 882 | + <?php _e('Need to create an account?', 'give'); ?> |
|
| 883 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-login" |
|
| 884 | 884 | data-action="give_checkout_register"> |
| 885 | - <?php _e( 'Register', 'give' ); |
|
| 886 | - if ( ! give_no_guest_checkout( $form_id ) ) { |
|
| 887 | - echo ' ' . __( 'or checkout as a guest.', 'give' ); |
|
| 885 | + <?php _e('Register', 'give'); |
|
| 886 | + if ( ! give_no_guest_checkout($form_id)) { |
|
| 887 | + echo ' '.__('or checkout as a guest.', 'give'); |
|
| 888 | 888 | } ?> |
| 889 | 889 | </a> |
| 890 | 890 | </p> |
| 891 | 891 | <p class="give-loading-text"> |
| 892 | - <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p> |
|
| 892 | + <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p> |
|
| 893 | 893 | <?php } ?> |
| 894 | - <?php do_action( 'give_checkout_login_fields_before', $form_id ); ?> |
|
| 894 | + <?php do_action('give_checkout_login_fields_before', $form_id); ?> |
|
| 895 | 895 | <p id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
| 896 | 896 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
| 897 | - <?php _e( 'Username', 'give' ); ?> |
|
| 898 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
| 897 | + <?php _e('Username', 'give'); ?> |
|
| 898 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
| 899 | 899 | <span class="give-required-indicator">*</span> |
| 900 | 900 | <?php } ?> |
| 901 | 901 | </label> |
| 902 | 902 | |
| 903 | - <input class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
| 903 | + <input class="<?php if (give_no_guest_checkout($form_id)) { |
|
| 904 | 904 | echo 'required '; |
| 905 | - } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/> |
|
| 905 | + } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/> |
|
| 906 | 906 | </p> |
| 907 | 907 | |
| 908 | 908 | <p id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
| 909 | 909 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
| 910 | - <?php _e( 'Password', 'give' ); ?> |
|
| 911 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
| 910 | + <?php _e('Password', 'give'); ?> |
|
| 911 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
| 912 | 912 | <span class="give-required-indicator">*</span> |
| 913 | 913 | <?php } ?> |
| 914 | 914 | </label> |
| 915 | - <input class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
| 915 | + <input class="<?php if (give_no_guest_checkout($form_id)) { |
|
| 916 | 916 | echo 'required '; |
| 917 | - } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/> |
|
| 917 | + } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/> |
|
| 918 | 918 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
| 919 | 919 | </p> |
| 920 | 920 | |
| 921 | 921 | <p id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
| 922 | - <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/> |
|
| 923 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
| 924 | - <input type="button" data-action="give_cancel_login" class="give-cancel-login give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/> |
|
| 922 | + <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/> |
|
| 923 | + <?php if ($show_register_form !== 'login') { ?> |
|
| 924 | + <input type="button" data-action="give_cancel_login" class="give-cancel-login give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/> |
|
| 925 | 925 | <?php } ?> |
| 926 | 926 | <span class="give-loading-animation"></span> |
| 927 | 927 | </p> |
| 928 | - <?php do_action( 'give_checkout_login_fields_after' ); ?> |
|
| 928 | + <?php do_action('give_checkout_login_fields_after'); ?> |
|
| 929 | 929 | </fieldset><!--end #give-login-fields--> |
| 930 | 930 | <?php |
| 931 | 931 | echo ob_get_clean(); |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
| 934 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
| 935 | 935 | |
| 936 | 936 | /** |
| 937 | 937 | * Payment Mode Select |
@@ -947,49 +947,49 @@ discard block |
||
| 947 | 947 | * |
| 948 | 948 | * @return void |
| 949 | 949 | */ |
| 950 | -function give_payment_mode_select( $form_id ) { |
|
| 950 | +function give_payment_mode_select($form_id) { |
|
| 951 | 951 | |
| 952 | 952 | $gateways = give_get_enabled_payment_gateways(); |
| 953 | 953 | |
| 954 | - do_action( 'give_payment_mode_top', $form_id ); ?> |
|
| 954 | + do_action('give_payment_mode_top', $form_id); ?> |
|
| 955 | 955 | |
| 956 | 956 | <fieldset id="give-payment-mode-select"> |
| 957 | - <?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?> |
|
| 957 | + <?php do_action('give_payment_mode_before_gateways_wrap'); ?> |
|
| 958 | 958 | <div id="give-payment-mode-wrap"> |
| 959 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?> |
|
| 960 | - <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span> |
|
| 959 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?> |
|
| 960 | + <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span> |
|
| 961 | 961 | </legend> |
| 962 | 962 | <?php |
| 963 | 963 | |
| 964 | - do_action( 'give_payment_mode_before_gateways' ) ?> |
|
| 964 | + do_action('give_payment_mode_before_gateways') ?> |
|
| 965 | 965 | |
| 966 | 966 | <ul id="give-gateway-radio-list"> |
| 967 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
| 968 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
| 967 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
| 968 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
| 969 | 969 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
| 970 | - echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">'; |
|
| 971 | - echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] ); |
|
| 970 | + echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">'; |
|
| 971 | + echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']); |
|
| 972 | 972 | echo '</label></li>'; |
| 973 | 973 | endforeach; ?> |
| 974 | 974 | </ul> |
| 975 | - <?php do_action( 'give_payment_mode_after_gateways' ); ?> |
|
| 975 | + <?php do_action('give_payment_mode_after_gateways'); ?> |
|
| 976 | 976 | </div> |
| 977 | - <?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?> |
|
| 977 | + <?php do_action('give_payment_mode_after_gateways_wrap'); ?> |
|
| 978 | 978 | </fieldset> |
| 979 | 979 | |
| 980 | - <?php do_action( 'give_payment_mode_bottom', $form_id ); ?> |
|
| 980 | + <?php do_action('give_payment_mode_bottom', $form_id); ?> |
|
| 981 | 981 | |
| 982 | 982 | <div id="give_purchase_form_wrap"> |
| 983 | 983 | |
| 984 | - <?php do_action( 'give_purchase_form', $form_id ); ?> |
|
| 984 | + <?php do_action('give_purchase_form', $form_id); ?> |
|
| 985 | 985 | |
| 986 | 986 | </div><!-- the checkout fields are loaded into this--> |
| 987 | 987 | |
| 988 | - <?php do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
| 988 | + <?php do_action('give_purchase_form_wrap_bottom', $form_id); |
|
| 989 | 989 | |
| 990 | 990 | } |
| 991 | 991 | |
| 992 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
| 992 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
| 993 | 993 | |
| 994 | 994 | |
| 995 | 995 | /** |
@@ -1004,35 +1004,35 @@ discard block |
||
| 1004 | 1004 | * |
| 1005 | 1005 | * @return void |
| 1006 | 1006 | */ |
| 1007 | -function give_terms_agreement( $form_id ) { |
|
| 1007 | +function give_terms_agreement($form_id) { |
|
| 1008 | 1008 | |
| 1009 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1010 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
| 1011 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
| 1009 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1010 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
| 1011 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
| 1012 | 1012 | |
| 1013 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
| 1013 | + if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
| 1014 | 1014 | <fieldset id="give_terms_agreement"> |
| 1015 | 1015 | <div id="give_terms" style="display:none;"> |
| 1016 | 1016 | <?php |
| 1017 | - do_action( 'give_before_terms' ); |
|
| 1018 | - echo wpautop( stripslashes( $terms ) ); |
|
| 1019 | - do_action( 'give_after_terms' ); |
|
| 1017 | + do_action('give_before_terms'); |
|
| 1018 | + echo wpautop(stripslashes($terms)); |
|
| 1019 | + do_action('give_after_terms'); |
|
| 1020 | 1020 | ?> |
| 1021 | 1021 | </div> |
| 1022 | 1022 | <div id="give_show_terms"> |
| 1023 | - <a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a> |
|
| 1024 | - <a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a> |
|
| 1023 | + <a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a> |
|
| 1024 | + <a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a> |
|
| 1025 | 1025 | </div> |
| 1026 | 1026 | |
| 1027 | 1027 | <label |
| 1028 | - for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label> |
|
| 1028 | + for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label> |
|
| 1029 | 1029 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
| 1030 | 1030 | </fieldset> |
| 1031 | 1031 | <?php |
| 1032 | 1032 | } |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | -add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
| 1035 | +add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
|
| 1036 | 1036 | |
| 1037 | 1037 | /** |
| 1038 | 1038 | * Checkout Final Total |
@@ -1044,27 +1044,27 @@ discard block |
||
| 1044 | 1044 | * @since 1.0 |
| 1045 | 1045 | * @return void |
| 1046 | 1046 | */ |
| 1047 | -function give_checkout_final_total( $form_id ) { |
|
| 1047 | +function give_checkout_final_total($form_id) { |
|
| 1048 | 1048 | |
| 1049 | - if ( isset( $_POST['give_total'] ) ) { |
|
| 1050 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
| 1049 | + if (isset($_POST['give_total'])) { |
|
| 1050 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
| 1051 | 1051 | } else { |
| 1052 | 1052 | //default total |
| 1053 | - $total = give_get_default_form_amount( $form_id ); |
|
| 1053 | + $total = give_get_default_form_amount($form_id); |
|
| 1054 | 1054 | } |
| 1055 | 1055 | //Only proceed if give_total available |
| 1056 | - if ( empty( $total ) ) { |
|
| 1056 | + if (empty($total)) { |
|
| 1057 | 1057 | return; |
| 1058 | 1058 | } |
| 1059 | 1059 | ?> |
| 1060 | 1060 | <p id="give-final-total-wrap" class="form-wrap "> |
| 1061 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span> |
|
| 1062 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
| 1061 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span> |
|
| 1062 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
| 1063 | 1063 | </p> |
| 1064 | 1064 | <?php |
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | -add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
| 1067 | +add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
|
| 1068 | 1068 | |
| 1069 | 1069 | |
| 1070 | 1070 | /** |
@@ -1076,22 +1076,22 @@ discard block |
||
| 1076 | 1076 | * |
| 1077 | 1077 | * @return void |
| 1078 | 1078 | */ |
| 1079 | -function give_checkout_submit( $form_id ) { |
|
| 1079 | +function give_checkout_submit($form_id) { |
|
| 1080 | 1080 | ?> |
| 1081 | 1081 | <fieldset id="give_purchase_submit"> |
| 1082 | - <?php do_action( 'give_purchase_form_before_submit', $form_id ); ?> |
|
| 1082 | + <?php do_action('give_purchase_form_before_submit', $form_id); ?> |
|
| 1083 | 1083 | |
| 1084 | - <?php give_checkout_hidden_fields( $form_id ); ?> |
|
| 1084 | + <?php give_checkout_hidden_fields($form_id); ?> |
|
| 1085 | 1085 | |
| 1086 | - <?php echo give_checkout_button_purchase( $form_id ); ?> |
|
| 1086 | + <?php echo give_checkout_button_purchase($form_id); ?> |
|
| 1087 | 1087 | |
| 1088 | - <?php do_action( 'give_purchase_form_after_submit', $form_id ); ?> |
|
| 1088 | + <?php do_action('give_purchase_form_after_submit', $form_id); ?> |
|
| 1089 | 1089 | |
| 1090 | 1090 | </fieldset> |
| 1091 | 1091 | <?php |
| 1092 | 1092 | } |
| 1093 | 1093 | |
| 1094 | -add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
| 1094 | +add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
|
| 1095 | 1095 | |
| 1096 | 1096 | |
| 1097 | 1097 | /** |
@@ -1104,10 +1104,10 @@ discard block |
||
| 1104 | 1104 | * |
| 1105 | 1105 | * @return string |
| 1106 | 1106 | */ |
| 1107 | -function give_checkout_button_purchase( $form_id ) { |
|
| 1107 | +function give_checkout_button_purchase($form_id) { |
|
| 1108 | 1108 | |
| 1109 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
| 1110 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
| 1109 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
| 1110 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
| 1111 | 1111 | |
| 1112 | 1112 | ob_start(); |
| 1113 | 1113 | |
@@ -1118,7 +1118,7 @@ discard block |
||
| 1118 | 1118 | <span class="give-loading-animation"></span> |
| 1119 | 1119 | </div> |
| 1120 | 1120 | <?php |
| 1121 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
| 1121 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
| 1122 | 1122 | } |
| 1123 | 1123 | |
| 1124 | 1124 | /** |
@@ -1132,11 +1132,11 @@ discard block |
||
| 1132 | 1132 | * |
| 1133 | 1133 | * @return void |
| 1134 | 1134 | */ |
| 1135 | -function give_agree_to_terms_js( $form_id ) { |
|
| 1135 | +function give_agree_to_terms_js($form_id) { |
|
| 1136 | 1136 | |
| 1137 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1137 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1138 | 1138 | |
| 1139 | - if ( $form_option === 'yes' ) { |
|
| 1139 | + if ($form_option === 'yes') { |
|
| 1140 | 1140 | ?> |
| 1141 | 1141 | <script type="text/javascript"> |
| 1142 | 1142 | jQuery(document).ready(function ($) { |
@@ -1152,7 +1152,7 @@ discard block |
||
| 1152 | 1152 | } |
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
| 1155 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
| 1156 | 1156 | |
| 1157 | 1157 | |
| 1158 | 1158 | /** |
@@ -1165,19 +1165,19 @@ discard block |
||
| 1165 | 1165 | * |
| 1166 | 1166 | * @return void |
| 1167 | 1167 | */ |
| 1168 | -function give_form_content( $form_id, $args ) { |
|
| 1168 | +function give_form_content($form_id, $args) { |
|
| 1169 | 1169 | |
| 1170 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
| 1170 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
| 1171 | 1171 | ? $args['show_content'] |
| 1172 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1172 | + : get_post_meta($form_id, '_give_content_option', true); |
|
| 1173 | 1173 | |
| 1174 | - if ( $show_content !== 'none' ) { |
|
| 1174 | + if ($show_content !== 'none') { |
|
| 1175 | 1175 | //add action according to value |
| 1176 | - add_action( $show_content, 'give_form_display_content' ); |
|
| 1176 | + add_action($show_content, 'give_form_display_content'); |
|
| 1177 | 1177 | } |
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
| 1180 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
| 1181 | 1181 | |
| 1182 | 1182 | /** |
| 1183 | 1183 | * Show Give Goals |
@@ -1190,25 +1190,25 @@ discard block |
||
| 1190 | 1190 | * @return mixed |
| 1191 | 1191 | */ |
| 1192 | 1192 | |
| 1193 | -function give_show_goal_progress( $form_id, $args ) { |
|
| 1193 | +function give_show_goal_progress($form_id, $args) { |
|
| 1194 | 1194 | |
| 1195 | - $goal_option = get_post_meta( $form_id, '_give_goal_option', true ); |
|
| 1196 | - $form = new Give_Donate_Form( $form_id ); |
|
| 1195 | + $goal_option = get_post_meta($form_id, '_give_goal_option', true); |
|
| 1196 | + $form = new Give_Donate_Form($form_id); |
|
| 1197 | 1197 | $goal = $form->goal; |
| 1198 | - $goal_format = get_post_meta( $form_id, '_give_goal_format', true ); |
|
| 1198 | + $goal_format = get_post_meta($form_id, '_give_goal_format', true); |
|
| 1199 | 1199 | $income = $form->get_earnings(); |
| 1200 | - $color = get_post_meta( $form_id, '_give_goal_color', true ); |
|
| 1201 | - $show_text = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
| 1202 | - $show_bar = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
| 1200 | + $color = get_post_meta($form_id, '_give_goal_color', true); |
|
| 1201 | + $show_text = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true; |
|
| 1202 | + $show_bar = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true; |
|
| 1203 | 1203 | |
| 1204 | 1204 | //Sanity check - respect shortcode args |
| 1205 | - if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) { |
|
| 1205 | + if (isset($args['show_goal']) && $args['show_goal'] === false) { |
|
| 1206 | 1206 | return false; |
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | 1209 | //Sanity check - ensure form has goal set to output |
| 1210 | - if ( empty( $form->ID ) |
|
| 1211 | - || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' ) |
|
| 1210 | + if (empty($form->ID) |
|
| 1211 | + || (is_singular('give_forms') && $goal_option !== 'yes') |
|
| 1212 | 1212 | || $goal_option !== 'yes' |
| 1213 | 1213 | || $goal == 0 |
| 1214 | 1214 | ) { |
@@ -1216,26 +1216,26 @@ discard block |
||
| 1216 | 1216 | return false; |
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
| 1219 | + $progress = round(($income / $goal) * 100, 2); |
|
| 1220 | 1220 | |
| 1221 | - if ( $income > $goal ) { |
|
| 1221 | + if ($income > $goal) { |
|
| 1222 | 1222 | $progress = 100; |
| 1223 | 1223 | } |
| 1224 | 1224 | |
| 1225 | 1225 | $output = '<div class="give-goal-progress">'; |
| 1226 | 1226 | |
| 1227 | 1227 | //Goal Progress Text |
| 1228 | - if ( ! empty( $show_text ) ) { |
|
| 1228 | + if ( ! empty($show_text)) { |
|
| 1229 | 1229 | |
| 1230 | 1230 | $output .= '<div class="raised">'; |
| 1231 | 1231 | |
| 1232 | - if ( $goal_format !== 'percentage' ) { |
|
| 1232 | + if ($goal_format !== 'percentage') { |
|
| 1233 | 1233 | |
| 1234 | - $output .= sprintf( _x( '%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give' ), '<span class="income">' . apply_filters( 'give_goal_amount_raised_output', give_currency_filter( give_format_amount( $income ) ) ) . '</span>', '<span class="goal-text">' . apply_filters( 'give_goal_amount_target_output', give_currency_filter( give_format_amount( $goal ) ) ) ) . '</span>'; |
|
| 1234 | + $output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">'.apply_filters('give_goal_amount_raised_output', give_currency_filter(give_format_amount($income))).'</span>', '<span class="goal-text">'.apply_filters('give_goal_amount_target_output', give_currency_filter(give_format_amount($goal)))).'</span>'; |
|
| 1235 | 1235 | |
| 1236 | - } elseif ( $goal_format == 'percentage' ) { |
|
| 1236 | + } elseif ($goal_format == 'percentage') { |
|
| 1237 | 1237 | |
| 1238 | - $output .= sprintf( _x( '%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give' ), '<span class="give-percentage">' . apply_filters( 'give_goal_amount_funded_percentage_output', round( $progress ) ) . '</span>' ) . '</span>'; |
|
| 1238 | + $output .= sprintf(_x('%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give'), '<span class="give-percentage">'.apply_filters('give_goal_amount_funded_percentage_output', round($progress)).'</span>').'</span>'; |
|
| 1239 | 1239 | |
| 1240 | 1240 | } |
| 1241 | 1241 | |
@@ -1244,11 +1244,11 @@ discard block |
||
| 1244 | 1244 | } |
| 1245 | 1245 | |
| 1246 | 1246 | //Goal Progress Bar |
| 1247 | - if ( ! empty( $show_bar ) ) { |
|
| 1247 | + if ( ! empty($show_bar)) { |
|
| 1248 | 1248 | $output .= '<div class="give-progress-bar">'; |
| 1249 | - $output .= '<span style="width: ' . esc_attr( $progress ) . '%;'; |
|
| 1250 | - if ( ! empty( $color ) ) { |
|
| 1251 | - $output .= 'background-color:' . $color; |
|
| 1249 | + $output .= '<span style="width: '.esc_attr($progress).'%;'; |
|
| 1250 | + if ( ! empty($color)) { |
|
| 1251 | + $output .= 'background-color:'.$color; |
|
| 1252 | 1252 | } |
| 1253 | 1253 | $output .= '"></span>'; |
| 1254 | 1254 | $output .= '</div><!-- /.give-progress-bar -->'; |
@@ -1256,13 +1256,13 @@ discard block |
||
| 1256 | 1256 | |
| 1257 | 1257 | $output .= '</div><!-- /.goal-progress -->'; |
| 1258 | 1258 | |
| 1259 | - echo apply_filters( 'give_goal_output', $output ); |
|
| 1259 | + echo apply_filters('give_goal_output', $output); |
|
| 1260 | 1260 | |
| 1261 | 1261 | return false; |
| 1262 | 1262 | |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
| 1265 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
| 1266 | 1266 | |
| 1267 | 1267 | /** |
| 1268 | 1268 | * Renders Post Form Content |
@@ -1274,17 +1274,17 @@ discard block |
||
| 1274 | 1274 | * @return void |
| 1275 | 1275 | * @since 1.0 |
| 1276 | 1276 | */ |
| 1277 | -function give_form_display_content( $form_id ) { |
|
| 1277 | +function give_form_display_content($form_id) { |
|
| 1278 | 1278 | |
| 1279 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
| 1279 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
| 1280 | 1280 | |
| 1281 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
| 1282 | - $content = apply_filters( 'the_content', $content ); |
|
| 1281 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
| 1282 | + $content = apply_filters('the_content', $content); |
|
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
| 1285 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
| 1286 | 1286 | |
| 1287 | - echo apply_filters( 'give_form_content_output', $output ); |
|
| 1287 | + echo apply_filters('give_form_content_output', $output); |
|
| 1288 | 1288 | } |
| 1289 | 1289 | |
| 1290 | 1290 | |
@@ -1297,16 +1297,16 @@ discard block |
||
| 1297 | 1297 | * |
| 1298 | 1298 | * @return void |
| 1299 | 1299 | */ |
| 1300 | -function give_checkout_hidden_fields( $form_id ) { |
|
| 1300 | +function give_checkout_hidden_fields($form_id) { |
|
| 1301 | 1301 | |
| 1302 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
| 1303 | - if ( is_user_logged_in() ) { ?> |
|
| 1302 | + do_action('give_hidden_fields_before', $form_id); |
|
| 1303 | + if (is_user_logged_in()) { ?> |
|
| 1304 | 1304 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
| 1305 | 1305 | <?php } ?> |
| 1306 | 1306 | <input type="hidden" name="give_action" value="purchase"/> |
| 1307 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
| 1307 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
| 1308 | 1308 | <?php |
| 1309 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
| 1309 | + do_action('give_hidden_fields_after', $form_id); |
|
| 1310 | 1310 | |
| 1311 | 1311 | } |
| 1312 | 1312 | |
@@ -1321,20 +1321,20 @@ discard block |
||
| 1321 | 1321 | * |
| 1322 | 1322 | * @return string $content Filtered content |
| 1323 | 1323 | */ |
| 1324 | -function give_filter_success_page_content( $content ) { |
|
| 1324 | +function give_filter_success_page_content($content) { |
|
| 1325 | 1325 | |
| 1326 | 1326 | global $give_options; |
| 1327 | 1327 | |
| 1328 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
| 1329 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
| 1330 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
| 1328 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
| 1329 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
| 1330 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
| 1331 | 1331 | } |
| 1332 | 1332 | } |
| 1333 | 1333 | |
| 1334 | 1334 | return $content; |
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
| 1337 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
| 1338 | 1338 | |
| 1339 | 1339 | |
| 1340 | 1340 | /** |
@@ -1346,11 +1346,11 @@ discard block |
||
| 1346 | 1346 | |
| 1347 | 1347 | function give_test_mode_frontend_warning() { |
| 1348 | 1348 | |
| 1349 | - $test_mode = give_get_option( 'test_mode' ); |
|
| 1349 | + $test_mode = give_get_option('test_mode'); |
|
| 1350 | 1350 | |
| 1351 | - if ( $test_mode == 'on' ) { |
|
| 1352 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . __( 'Notice', 'give' ) . '</strong>: ' . esc_attr__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>'; |
|
| 1351 | + if ($test_mode == 'on') { |
|
| 1352 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.__('Notice', 'give').'</strong>: '.esc_attr__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>'; |
|
| 1353 | 1353 | } |
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
| 1356 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 13 | +if ( ! defined('ABSPATH')) {
|
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
| 17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes');
|
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Define the metabox and field configurations. |
@@ -23,23 +23,23 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return array |
| 25 | 25 | */ |
| 26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) {
|
|
| 26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) {
|
|
| 27 | 27 | |
| 28 | 28 | $post_id = give_get_admin_post_id(); |
| 29 | - $price = give_get_form_price( $post_id ); |
|
| 30 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
| 31 | - $goal = give_get_form_goal( $post_id ); |
|
| 32 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
| 33 | - $prices = give_get_variable_prices( $post_id ); |
|
| 29 | + $price = give_get_form_price($post_id); |
|
| 30 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
| 31 | + $goal = give_get_form_goal($post_id); |
|
| 32 | + $variable_pricing = give_has_variable_prices($post_id); |
|
| 33 | + $prices = give_get_variable_prices($post_id); |
|
| 34 | 34 | |
| 35 | 35 | //No empty prices - min. 1.00 for new forms |
| 36 | - if ( empty( $price ) && is_null( $post_id ) ) {
|
|
| 37 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
| 36 | + if (empty($price) && is_null($post_id)) {
|
|
| 37 | + $price = esc_attr(give_format_amount('1.00'));
|
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | //Min. $1.00 for new forms |
| 41 | - if ( empty( $custom_amount_minimum ) ) {
|
|
| 42 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
| 41 | + if (empty($custom_amount_minimum)) {
|
|
| 42 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00'));
|
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Start with an underscore to hide fields from custom fields list |
@@ -48,302 +48,302 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * Repeatable Field Groups |
| 50 | 50 | */ |
| 51 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
| 51 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array(
|
|
| 52 | 52 | 'id' => 'form_field_options', |
| 53 | - 'title' => __( 'Donation Options', 'give' ), |
|
| 54 | - 'object_types' => array( 'give_forms' ), |
|
| 53 | + 'title' => __('Donation Options', 'give'),
|
|
| 54 | + 'object_types' => array('give_forms'),
|
|
| 55 | 55 | 'context' => 'normal', |
| 56 | 56 | 'priority' => 'high', //Show above Content WYSIWYG |
| 57 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
| 57 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array(
|
|
| 58 | 58 | //Donation Option |
| 59 | 59 | array( |
| 60 | - 'name' => __( 'Donation Option', 'give' ), |
|
| 61 | - 'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give' ), |
|
| 62 | - 'id' => $prefix . 'price_option', |
|
| 60 | + 'name' => __('Donation Option', 'give'),
|
|
| 61 | + 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give'),
|
|
| 62 | + 'id' => $prefix.'price_option', |
|
| 63 | 63 | 'type' => 'radio_inline', |
| 64 | 64 | 'default' => 'set', |
| 65 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
| 66 | - 'set' => __( 'Set Donation', 'give' ), |
|
| 67 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
| 68 | - ) ), |
|
| 65 | + 'options' => apply_filters('give_forms_price_options', array(
|
|
| 66 | + 'set' => __('Set Donation', 'give'),
|
|
| 67 | + 'multi' => __('Multi-level Donation', 'give'),
|
|
| 68 | + )), |
|
| 69 | 69 | ), |
| 70 | 70 | array( |
| 71 | - 'name' => __( 'Set Donation', 'give' ), |
|
| 72 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
| 73 | - 'id' => $prefix . 'set_price', |
|
| 71 | + 'name' => __('Set Donation', 'give'),
|
|
| 72 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
|
|
| 73 | + 'id' => $prefix.'set_price', |
|
| 74 | 74 | 'type' => 'text_small', |
| 75 | 75 | 'row_classes' => 'give-subfield', |
| 76 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 77 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 76 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 77 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 78 | 78 | 'attributes' => array( |
| 79 | - 'placeholder' => give_format_amount( '1.00' ), |
|
| 80 | - 'value' => give_format_amount( $price ), |
|
| 79 | + 'placeholder' => give_format_amount('1.00'),
|
|
| 80 | + 'value' => give_format_amount($price), |
|
| 81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
| 82 | 82 | ), |
| 83 | 83 | ), |
| 84 | 84 | //Donation levels: Header |
| 85 | 85 | array( |
| 86 | - 'id' => $prefix . 'levels_header', |
|
| 86 | + 'id' => $prefix.'levels_header', |
|
| 87 | 87 | 'type' => 'levels_repeater_header', |
| 88 | 88 | ), |
| 89 | 89 | //Donation Levels: Repeatable CMB2 Group |
| 90 | 90 | array( |
| 91 | - 'id' => $prefix . 'donation_levels', |
|
| 91 | + 'id' => $prefix.'donation_levels', |
|
| 92 | 92 | 'type' => 'group', |
| 93 | 93 | 'row_classes' => 'give-subfield', |
| 94 | 94 | 'options' => array( |
| 95 | - 'add_button' => __( 'Add Level', 'give' ), |
|
| 96 | - 'remove_button' => __( '<span class="dashicons dashicons-no"></span>', 'give' ), |
|
| 95 | + 'add_button' => __('Add Level', 'give'),
|
|
| 96 | + 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'),
|
|
| 97 | 97 | 'sortable' => true, // beta |
| 98 | 98 | ), |
| 99 | 99 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
| 100 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
| 100 | + 'fields' => apply_filters('give_donation_levels_table_row', array(
|
|
| 101 | 101 | array( |
| 102 | - 'name' => __( 'ID', 'give' ), |
|
| 103 | - 'id' => $prefix . 'id', |
|
| 102 | + 'name' => __('ID', 'give'),
|
|
| 103 | + 'id' => $prefix.'id', |
|
| 104 | 104 | 'type' => 'levels_id', |
| 105 | 105 | ), |
| 106 | 106 | array( |
| 107 | - 'name' => __( 'Amount', 'give' ), |
|
| 108 | - 'id' => $prefix . 'amount', |
|
| 107 | + 'name' => __('Amount', 'give'),
|
|
| 108 | + 'id' => $prefix.'amount', |
|
| 109 | 109 | 'type' => 'text_small', |
| 110 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 111 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 110 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 111 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 112 | 112 | 'attributes' => array( |
| 113 | - 'placeholder' => give_format_amount( '1.00' ), |
|
| 113 | + 'placeholder' => give_format_amount('1.00'),
|
|
| 114 | 114 | 'class' => 'cmb-type-text-small give-money-field', |
| 115 | 115 | ), |
| 116 | 116 | 'before' => 'give_format_admin_multilevel_amount', |
| 117 | 117 | ), |
| 118 | 118 | array( |
| 119 | - 'name' => __( 'Text', 'give' ), |
|
| 120 | - 'id' => $prefix . 'text', |
|
| 119 | + 'name' => __('Text', 'give'),
|
|
| 120 | + 'id' => $prefix.'text', |
|
| 121 | 121 | 'type' => 'text', |
| 122 | 122 | 'attributes' => array( |
| 123 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
| 123 | + 'placeholder' => __('Donation Level', 'give'),
|
|
| 124 | 124 | 'rows' => 3, |
| 125 | 125 | ), |
| 126 | 126 | ), |
| 127 | 127 | array( |
| 128 | - 'name' => __( 'Default', 'give' ), |
|
| 129 | - 'id' => $prefix . 'default', |
|
| 128 | + 'name' => __('Default', 'give'),
|
|
| 129 | + 'id' => $prefix.'default', |
|
| 130 | 130 | 'type' => 'give_default_radio_inline' |
| 131 | 131 | ), |
| 132 | - ) ), |
|
| 132 | + )), |
|
| 133 | 133 | ), |
| 134 | 134 | //Display Style |
| 135 | 135 | array( |
| 136 | - 'name' => __( 'Display Style', 'give' ), |
|
| 137 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
| 138 | - 'id' => $prefix . 'display_style', |
|
| 136 | + 'name' => __('Display Style', 'give'),
|
|
| 137 | + 'description' => __('Set how the donations levels will display on the form.', 'give'),
|
|
| 138 | + 'id' => $prefix.'display_style', |
|
| 139 | 139 | 'type' => 'radio_inline', |
| 140 | 140 | 'default' => 'buttons', |
| 141 | 141 | 'options' => array( |
| 142 | - 'buttons' => __( 'Buttons', 'give' ), |
|
| 143 | - 'radios' => __( 'Radios', 'give' ), |
|
| 144 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
| 142 | + 'buttons' => __('Buttons', 'give'),
|
|
| 143 | + 'radios' => __('Radios', 'give'),
|
|
| 144 | + 'dropdown' => __('Dropdown', 'give'),
|
|
| 145 | 145 | ), |
| 146 | 146 | ), |
| 147 | 147 | //Custom Amount |
| 148 | 148 | array( |
| 149 | - 'name' => __( 'Custom Amount', 'give' ), |
|
| 150 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
| 151 | - 'id' => $prefix . 'custom_amount', |
|
| 149 | + 'name' => __('Custom Amount', 'give'),
|
|
| 150 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'),
|
|
| 151 | + 'id' => $prefix.'custom_amount', |
|
| 152 | 152 | 'type' => 'radio_inline', |
| 153 | 153 | 'default' => 'no', |
| 154 | 154 | 'options' => array( |
| 155 | - 'yes' => __( 'Yes', 'give' ), |
|
| 156 | - 'no' => __( 'No', 'give' ), |
|
| 155 | + 'yes' => __('Yes', 'give'),
|
|
| 156 | + 'no' => __('No', 'give'),
|
|
| 157 | 157 | ), |
| 158 | 158 | ), |
| 159 | 159 | array( |
| 160 | - 'name' => __( 'Custom Amount Minimum', 'give' ), |
|
| 161 | - 'description' => __( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
| 162 | - 'id' => $prefix . 'custom_amount_minimum', |
|
| 160 | + 'name' => __('Custom Amount Minimum', 'give'),
|
|
| 161 | + 'description' => __('If you would like to set a minimum custom donation amount please enter it here.', 'give'),
|
|
| 162 | + 'id' => $prefix.'custom_amount_minimum', |
|
| 163 | 163 | 'type' => 'text_small', |
| 164 | 164 | 'row_classes' => 'give-subfield', |
| 165 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 166 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 165 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 166 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 167 | 167 | 'attributes' => array( |
| 168 | - 'placeholder' => give_format_amount( '1.00' ), |
|
| 169 | - 'value' => give_format_amount( $custom_amount_minimum ), |
|
| 168 | + 'placeholder' => give_format_amount('1.00'),
|
|
| 169 | + 'value' => give_format_amount($custom_amount_minimum), |
|
| 170 | 170 | 'class' => 'cmb-type-text-small give-money-field', |
| 171 | 171 | ), |
| 172 | 172 | ), |
| 173 | 173 | array( |
| 174 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
| 175 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
| 176 | - 'id' => $prefix . 'custom_amount_text', |
|
| 174 | + 'name' => __('Custom Amount Text', 'give'),
|
|
| 175 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
|
|
| 176 | + 'id' => $prefix.'custom_amount_text', |
|
| 177 | 177 | 'type' => 'text', |
| 178 | 178 | 'row_classes' => 'give-subfield', |
| 179 | 179 | 'attributes' => array( |
| 180 | 180 | 'rows' => 3, |
| 181 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
| 181 | + 'placeholder' => __('Give a Custom Amount', 'give'),
|
|
| 182 | 182 | ), |
| 183 | 183 | ), |
| 184 | 184 | //Goals |
| 185 | 185 | array( |
| 186 | - 'name' => __( 'Set Goal?', 'give' ), |
|
| 187 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
| 188 | - 'id' => $prefix . 'goal_option', |
|
| 186 | + 'name' => __('Set Goal?', 'give'),
|
|
| 187 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'),
|
|
| 188 | + 'id' => $prefix.'goal_option', |
|
| 189 | 189 | 'type' => 'radio_inline', |
| 190 | 190 | 'default' => 'no', |
| 191 | 191 | 'options' => array( |
| 192 | - 'yes' => __( 'Yes', 'give' ), |
|
| 193 | - 'no' => __( 'No', 'give' ), |
|
| 192 | + 'yes' => __('Yes', 'give'),
|
|
| 193 | + 'no' => __('No', 'give'),
|
|
| 194 | 194 | ), |
| 195 | 195 | ), |
| 196 | 196 | array( |
| 197 | - 'name' => __( 'Set Goal', 'give' ), |
|
| 198 | - 'description' => __( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
| 199 | - 'id' => $prefix . 'set_goal', |
|
| 197 | + 'name' => __('Set Goal', 'give'),
|
|
| 198 | + 'description' => __('This is the monetary goal amount you want to reach for this donation form.', 'give'),
|
|
| 199 | + 'id' => $prefix.'set_goal', |
|
| 200 | 200 | 'type' => 'text_small', |
| 201 | 201 | 'row_classes' => 'give-subfield', |
| 202 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 203 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 202 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 203 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 204 | 204 | 'attributes' => array( |
| 205 | - 'placeholder' => give_format_amount( '0.00' ), |
|
| 206 | - 'value' => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '', |
|
| 205 | + 'placeholder' => give_format_amount('0.00'),
|
|
| 206 | + 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', |
|
| 207 | 207 | 'class' => 'cmb-type-text-small give-money-field', |
| 208 | 208 | ), |
| 209 | 209 | ), |
| 210 | 210 | |
| 211 | 211 | array( |
| 212 | - 'name' => __( 'Goal Format', 'give' ), |
|
| 213 | - 'description' => __( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
| 214 | - 'id' => $prefix . 'goal_format', |
|
| 212 | + 'name' => __('Goal Format', 'give'),
|
|
| 213 | + 'description' => __('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
|
|
| 214 | + 'id' => $prefix.'goal_format', |
|
| 215 | 215 | 'type' => 'radio_inline', |
| 216 | 216 | 'default' => 'amount', |
| 217 | 217 | 'row_classes' => 'give-subfield', |
| 218 | 218 | 'options' => array( |
| 219 | - 'amount' => __( 'Amount ', 'give' ), |
|
| 220 | - 'percentage' => __( 'Percentage', 'give' ), |
|
| 219 | + 'amount' => __('Amount ', 'give'),
|
|
| 220 | + 'percentage' => __('Percentage', 'give'),
|
|
| 221 | 221 | ), |
| 222 | 222 | ), |
| 223 | 223 | array( |
| 224 | - 'name' => __( 'Goal Progress Bar Color', 'give' ), |
|
| 225 | - 'id' => $prefix . 'goal_color', |
|
| 224 | + 'name' => __('Goal Progress Bar Color', 'give'),
|
|
| 225 | + 'id' => $prefix.'goal_color', |
|
| 226 | 226 | 'type' => 'colorpicker', |
| 227 | 227 | 'row_classes' => 'give-subfield', |
| 228 | 228 | 'default' => '#2bc253', |
| 229 | 229 | ), |
| 230 | 230 | ) |
| 231 | 231 | ) |
| 232 | - ) ); |
|
| 232 | + )); |
|
| 233 | 233 | |
| 234 | 234 | |
| 235 | 235 | /** |
| 236 | 236 | * Content Field |
| 237 | 237 | */ |
| 238 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
| 238 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array(
|
|
| 239 | 239 | 'id' => 'form_content_options', |
| 240 | - 'title' => __( 'Form Content', 'give' ), |
|
| 241 | - 'object_types' => array( 'give_forms' ), |
|
| 240 | + 'title' => __('Form Content', 'give'),
|
|
| 241 | + 'object_types' => array('give_forms'),
|
|
| 242 | 242 | 'context' => 'normal', |
| 243 | 243 | 'priority' => 'high', //Show above Content WYSIWYG |
| 244 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
| 244 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array(
|
|
| 245 | 245 | //Donation Option |
| 246 | 246 | array( |
| 247 | - 'name' => __( 'Display Content', 'give' ), |
|
| 248 | - 'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
| 249 | - 'id' => $prefix . 'content_option', |
|
| 247 | + 'name' => __('Display Content', 'give'),
|
|
| 248 | + 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'),
|
|
| 249 | + 'id' => $prefix.'content_option', |
|
| 250 | 250 | 'type' => 'select', |
| 251 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 252 | - 'none' => __( 'No content', 'give' ), |
|
| 253 | - 'give_pre_form' => __( 'Yes, display content ABOVE the form fields', 'give' ), |
|
| 254 | - 'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ), |
|
| 251 | + 'options' => apply_filters('give_forms_content_options_select', array(
|
|
| 252 | + 'none' => __('No content', 'give'),
|
|
| 253 | + 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'),
|
|
| 254 | + 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'),
|
|
| 255 | 255 | ) |
| 256 | 256 | ), |
| 257 | 257 | 'default' => 'none', |
| 258 | 258 | ), |
| 259 | 259 | array( |
| 260 | - 'name' => __( 'Content', 'give' ), |
|
| 261 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
| 262 | - 'id' => $prefix . 'form_content', |
|
| 260 | + 'name' => __('Content', 'give'),
|
|
| 261 | + 'description' => __('This content will display on the single give form page.', 'give'),
|
|
| 262 | + 'id' => $prefix.'form_content', |
|
| 263 | 263 | 'row_classes' => 'give-subfield', |
| 264 | 264 | 'type' => 'wysiwyg' |
| 265 | 265 | ), |
| 266 | 266 | ) |
| 267 | 267 | ) |
| 268 | - ) ); |
|
| 268 | + )); |
|
| 269 | 269 | |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | 272 | * Display Options |
| 273 | 273 | */ |
| 274 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
| 274 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array(
|
|
| 275 | 275 | 'id' => 'form_display_options', |
| 276 | - 'title' => __( 'Form Display Options', 'give' ), |
|
| 277 | - 'object_types' => array( 'give_forms' ), |
|
| 276 | + 'title' => __('Form Display Options', 'give'),
|
|
| 277 | + 'object_types' => array('give_forms'),
|
|
| 278 | 278 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
| 279 | 279 | 'priority' => 'high', //Show above Content WYSIWYG |
| 280 | 280 | 'show_names' => true, // Show field names on the left |
| 281 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
| 281 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array(
|
|
| 282 | 282 | array( |
| 283 | - 'name' => __( 'Payment Fields', 'give' ), |
|
| 284 | - 'desc' => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
| 285 | - 'id' => $prefix . 'payment_display', |
|
| 283 | + 'name' => __('Payment Fields', 'give'),
|
|
| 284 | + 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'),
|
|
| 285 | + 'id' => $prefix.'payment_display', |
|
| 286 | 286 | 'type' => 'select', |
| 287 | 287 | 'options' => array( |
| 288 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
| 289 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
| 290 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
| 288 | + 'onpage' => __('Show on Page', 'give'),
|
|
| 289 | + 'reveal' => __('Reveal Upon Click', 'give'),
|
|
| 290 | + 'modal' => __('Modal Window Upon Click', 'give'),
|
|
| 291 | 291 | ), |
| 292 | 292 | 'default' => 'onpage', |
| 293 | 293 | ), |
| 294 | 294 | array( |
| 295 | - 'id' => $prefix . 'reveal_label', |
|
| 296 | - 'name' => __( 'Reveal / Modal Open Text', 'give' ), |
|
| 297 | - 'desc' => __( 'The button label for completing the donation.', 'give' ), |
|
| 295 | + 'id' => $prefix.'reveal_label', |
|
| 296 | + 'name' => __('Reveal / Modal Open Text', 'give'),
|
|
| 297 | + 'desc' => __('The button label for completing the donation.', 'give'),
|
|
| 298 | 298 | 'type' => 'text_small', |
| 299 | 299 | 'row_classes' => 'give-subfield', |
| 300 | 300 | 'attributes' => array( |
| 301 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 301 | + 'placeholder' => __('Donate Now', 'give'),
|
|
| 302 | 302 | ), |
| 303 | 303 | ), |
| 304 | 304 | array( |
| 305 | - 'id' => $prefix . 'checkout_label', |
|
| 306 | - 'name' => __( 'Complete Donation Text', 'give' ), |
|
| 307 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
| 305 | + 'id' => $prefix.'checkout_label', |
|
| 306 | + 'name' => __('Complete Donation Text', 'give'),
|
|
| 307 | + 'desc' => __('The button label for completing a donation.', 'give'),
|
|
| 308 | 308 | 'type' => 'text_small', |
| 309 | 309 | 'attributes' => array( |
| 310 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
| 310 | + 'placeholder' => __('Donate Now', 'give'),
|
|
| 311 | 311 | ), |
| 312 | 312 | ), |
| 313 | 313 | array( |
| 314 | - 'name' => __( 'Default Gateway', 'give' ), |
|
| 315 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
| 316 | - 'id' => $prefix . 'default_gateway', |
|
| 314 | + 'name' => __('Default Gateway', 'give'),
|
|
| 315 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
|
|
| 316 | + 'id' => $prefix.'default_gateway', |
|
| 317 | 317 | 'type' => 'default_gateway' |
| 318 | 318 | ), |
| 319 | 319 | array( |
| 320 | - 'name' => __( 'Disable Guest Donations', 'give' ), |
|
| 321 | - 'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
| 322 | - 'id' => $prefix . 'logged_in_only', |
|
| 320 | + 'name' => __('Disable Guest Donations', 'give'),
|
|
| 321 | + 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'),
|
|
| 322 | + 'id' => $prefix.'logged_in_only', |
|
| 323 | 323 | 'type' => 'checkbox' |
| 324 | 324 | ), |
| 325 | 325 | array( |
| 326 | - 'name' => __( 'Register / Login Form', 'give' ), |
|
| 327 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
| 328 | - 'id' => $prefix . 'show_register_form', |
|
| 326 | + 'name' => __('Register / Login Form', 'give'),
|
|
| 327 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
|
|
| 328 | + 'id' => $prefix.'show_register_form', |
|
| 329 | 329 | 'type' => 'select', |
| 330 | 330 | 'options' => array( |
| 331 | - 'both' => __( 'Registration and Login Forms', 'give' ), |
|
| 332 | - 'registration' => __( 'Registration Form Only', 'give' ), |
|
| 333 | - 'login' => __( 'Login Form Only', 'give' ), |
|
| 334 | - 'none' => __( 'None', 'give' ), |
|
| 331 | + 'both' => __('Registration and Login Forms', 'give'),
|
|
| 332 | + 'registration' => __('Registration Form Only', 'give'),
|
|
| 333 | + 'login' => __('Login Form Only', 'give'),
|
|
| 334 | + 'none' => __('None', 'give'),
|
|
| 335 | 335 | ), |
| 336 | 336 | 'default' => 'none', |
| 337 | 337 | ), |
| 338 | 338 | array( |
| 339 | - 'name' => __( 'Floating Labels', 'give' ), |
|
| 340 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
| 341 | - 'id' => $prefix . 'form_floating_labels', |
|
| 339 | + 'name' => __('Floating Labels', 'give'),
|
|
| 340 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")),
|
|
| 341 | + 'id' => $prefix.'form_floating_labels', |
|
| 342 | 342 | 'type' => 'select', |
| 343 | 343 | 'options' => array( |
| 344 | - '' => __( 'Use the global setting', 'give' ), |
|
| 345 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 346 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 344 | + '' => __('Use the global setting', 'give'),
|
|
| 345 | + 'enabled' => __('Enabled', 'give'),
|
|
| 346 | + 'disabled' => __('Disabled', 'give'),
|
|
| 347 | 347 | ), |
| 348 | 348 | 'default' => 'none', |
| 349 | 349 | ) |
@@ -355,47 +355,47 @@ discard block |
||
| 355 | 355 | /** |
| 356 | 356 | * Terms & Conditions |
| 357 | 357 | */ |
| 358 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
| 358 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array(
|
|
| 359 | 359 | 'id' => 'form_terms_options', |
| 360 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
| 361 | - 'object_types' => array( 'give_forms' ), |
|
| 360 | + 'title' => __('Terms and Conditions', 'give'),
|
|
| 361 | + 'object_types' => array('give_forms'),
|
|
| 362 | 362 | 'context' => 'normal', |
| 363 | 363 | 'priority' => 'high', //Show above Content WYSIWYG |
| 364 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
| 364 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array(
|
|
| 365 | 365 | //Donation Option |
| 366 | 366 | array( |
| 367 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
| 368 | - 'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
| 369 | - 'id' => $prefix . 'terms_option', |
|
| 367 | + 'name' => __('Terms and Conditions', 'give'),
|
|
| 368 | + 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'),
|
|
| 369 | + 'id' => $prefix.'terms_option', |
|
| 370 | 370 | 'type' => 'select', |
| 371 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 372 | - 'none' => __( 'No', 'give' ), |
|
| 373 | - 'yes' => __( 'Yes', 'give' ), |
|
| 371 | + 'options' => apply_filters('give_forms_content_options_select', array(
|
|
| 372 | + 'none' => __('No', 'give'),
|
|
| 373 | + 'yes' => __('Yes', 'give'),
|
|
| 374 | 374 | ) |
| 375 | 375 | ), |
| 376 | 376 | 'default' => 'none', |
| 377 | 377 | ), |
| 378 | 378 | array( |
| 379 | - 'id' => $prefix . 'agree_label', |
|
| 380 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
| 381 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
| 379 | + 'id' => $prefix.'agree_label', |
|
| 380 | + 'name' => __('Agree to Terms Label', 'give'),
|
|
| 381 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
|
|
| 382 | 382 | 'type' => 'text', |
| 383 | 383 | 'row_classes' => 'give-subfield', |
| 384 | 384 | 'size' => 'regular', |
| 385 | 385 | 'attributes' => array( |
| 386 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
| 386 | + 'placeholder' => __('Agree to Terms?', 'give'),
|
|
| 387 | 387 | ), |
| 388 | 388 | ), |
| 389 | 389 | array( |
| 390 | - 'id' => $prefix . 'agree_text', |
|
| 390 | + 'id' => $prefix.'agree_text', |
|
| 391 | 391 | 'row_classes' => 'give-subfield', |
| 392 | - 'name' => __( 'Agreement Text', 'give' ), |
|
| 393 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
| 392 | + 'name' => __('Agreement Text', 'give'),
|
|
| 393 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
|
|
| 394 | 394 | 'type' => 'wysiwyg' |
| 395 | 395 | ), |
| 396 | 396 | ) |
| 397 | 397 | ) |
| 398 | - ) ); |
|
| 398 | + )); |
|
| 399 | 399 | |
| 400 | 400 | return $meta_boxes; |
| 401 | 401 | |
@@ -404,18 +404,18 @@ discard block |
||
| 404 | 404 | /** |
| 405 | 405 | * Repeatable Levels Custom Field |
| 406 | 406 | */ |
| 407 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
| 407 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10);
|
|
| 408 | 408 | function give_cmb_render_levels_repeater_header() {
|
| 409 | 409 | ?> |
| 410 | 410 | |
| 411 | 411 | <div class="table-container"> |
| 412 | 412 | <div class="table-row"> |
| 413 | - <div class="table-cell col-id"><?php _e( 'ID', 'give' ); ?></div> |
|
| 414 | - <div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div> |
|
| 415 | - <div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div> |
|
| 416 | - <div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div> |
|
| 417 | - <?php do_action( 'give_donation_levels_table_head' ); ?> |
|
| 418 | - <div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div> |
|
| 413 | + <div class="table-cell col-id"><?php _e('ID', 'give'); ?></div>
|
|
| 414 | + <div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div>
|
|
| 415 | + <div class="table-cell col-text"><?php _e('Text', 'give'); ?></div>
|
|
| 416 | + <div class="table-cell col-default"><?php _e('Default', 'give'); ?></div>
|
|
| 417 | + <?php do_action('give_donation_levels_table_head'); ?>
|
|
| 418 | + <div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div>
|
|
| 419 | 419 | |
| 420 | 420 | </div> |
| 421 | 421 | </div> |
@@ -430,22 +430,22 @@ discard block |
||
| 430 | 430 | * @description: Custom CMB2 incremental Levels ID Field |
| 431 | 431 | * @since 1.0 |
| 432 | 432 | */ |
| 433 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
| 434 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
|
|
| 433 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5);
|
|
| 434 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
|
|
| 435 | 435 | |
| 436 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
| 436 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
| 437 | 437 | |
| 438 | 438 | $field_options_array = array( |
| 439 | 439 | 'class' => 'give-hidden give-level-id-input', |
| 440 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
| 441 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
| 440 | + 'name' => $field_type_object->_name('[level_id]'),
|
|
| 441 | + 'id' => $field_type_object->_id('_level_id'),
|
|
| 442 | 442 | 'value' => $escaped_value, |
| 443 | 443 | 'type' => 'number', |
| 444 | 444 | 'desc' => '', |
| 445 | 445 | ); |
| 446 | 446 | |
| 447 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
| 448 | - echo $field_type_object->input( $field_options_array ); |
|
| 447 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
| 448 | + echo $field_type_object->input($field_options_array); |
|
| 449 | 449 | |
| 450 | 450 | } |
| 451 | 451 | |
@@ -453,10 +453,10 @@ discard block |
||
| 453 | 453 | /** |
| 454 | 454 | * CMB2 Repeatable Default ID Field |
| 455 | 455 | */ |
| 456 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
| 457 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
|
|
| 458 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
| 459 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
| 456 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5);
|
|
| 457 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
|
|
| 458 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>';
|
|
| 459 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
| 460 | 460 | |
| 461 | 461 | } |
| 462 | 462 | |
@@ -468,20 +468,20 @@ discard block |
||
| 468 | 468 | */ |
| 469 | 469 | function give_add_shortcode_to_publish_metabox() {
|
| 470 | 470 | |
| 471 | - if ( 'give_forms' !== get_post_type() ) {
|
|
| 471 | + if ('give_forms' !== get_post_type()) {
|
|
| 472 | 472 | return false; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | global $post; |
| 476 | 476 | |
| 477 | 477 | //Only enqueue scripts for CPT on post type screen |
| 478 | - if ( 'give_forms' === $post->post_type ) {
|
|
| 478 | + if ('give_forms' === $post->post_type) {
|
|
| 479 | 479 | //Shortcode column with select all input |
| 480 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
| 481 | - echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
| 480 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
|
|
| 481 | + echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
|
|
| 482 | 482 | |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
| 487 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
|
|