@@ -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_action( 'cmb2_init', 'give_single_forms_cmb2_metaboxes', 6 ); |
|
| 17 | +add_action('cmb2_init', 'give_single_forms_cmb2_metaboxes', 6);
|
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Define the metabox and field configurations. |
@@ -22,20 +22,20 @@ discard block |
||
| 22 | 22 | function give_single_forms_cmb2_metaboxes() {
|
| 23 | 23 | |
| 24 | 24 | $post_id = give_get_admin_post_id(); |
| 25 | - $price = give_get_form_price( $post_id ); |
|
| 26 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
| 27 | - $goal = give_get_form_goal( $post_id ); |
|
| 28 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
| 29 | - $prices = give_get_variable_prices( $post_id ); |
|
| 25 | + $price = give_get_form_price($post_id); |
|
| 26 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
| 27 | + $goal = give_get_form_goal($post_id); |
|
| 28 | + $variable_pricing = give_has_variable_prices($post_id); |
|
| 29 | + $prices = give_get_variable_prices($post_id); |
|
| 30 | 30 | |
| 31 | 31 | //No empty prices - min. 1.00 for new forms |
| 32 | - if ( empty( $price ) && is_null( $post_id ) ) {
|
|
| 33 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
| 32 | + if (empty($price) && is_null($post_id)) {
|
|
| 33 | + $price = esc_attr(give_format_amount('1.00'));
|
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | //Min. $1.00 for new forms |
| 37 | - if ( empty( $custom_amount_minimum ) ) {
|
|
| 38 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
| 37 | + if (empty($custom_amount_minimum)) {
|
|
| 38 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00'));
|
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // Start with an underscore to hide fields from custom fields list |
@@ -47,327 +47,327 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * Repeatable Field Groups |
| 49 | 49 | */ |
| 50 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
| 50 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array(
|
|
| 51 | 51 | 'id' => 'form_field_options', |
| 52 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
| 53 | - 'object_types' => array( 'give_forms' ), |
|
| 52 | + 'title' => esc_html__('Donation Options', 'give'),
|
|
| 53 | + 'object_types' => array('give_forms'),
|
|
| 54 | 54 | 'context' => 'normal', |
| 55 | 55 | 'priority' => 'high', //Show above Content WYSIWYG |
| 56 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
| 56 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array(
|
|
| 57 | 57 | //Donation Option |
| 58 | 58 | array( |
| 59 | - 'name' => esc_html__( 'Donation Option', 'give' ), |
|
| 60 | - 'description' => esc_html__( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
| 61 | - 'id' => $prefix . 'price_option', |
|
| 59 | + 'name' => esc_html__('Donation Option', 'give'),
|
|
| 60 | + 'description' => esc_html__('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
|
|
| 61 | + 'id' => $prefix.'price_option', |
|
| 62 | 62 | 'type' => 'radio_inline', |
| 63 | 63 | 'default' => 'set', |
| 64 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
| 65 | - 'set' => esc_html__( 'Set Donation', 'give' ), |
|
| 66 | - 'multi' => esc_html__( 'Multi-level Donation', 'give' ), |
|
| 67 | - ) ), |
|
| 64 | + 'options' => apply_filters('give_forms_price_options', array(
|
|
| 65 | + 'set' => esc_html__('Set Donation', 'give'),
|
|
| 66 | + 'multi' => esc_html__('Multi-level Donation', 'give'),
|
|
| 67 | + )), |
|
| 68 | 68 | ), |
| 69 | 69 | array( |
| 70 | - 'name' => esc_html__( 'Set Donation', 'give' ), |
|
| 71 | - 'description' => esc_html__( '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' ), |
|
| 72 | - 'id' => $prefix . 'set_price', |
|
| 70 | + 'name' => esc_html__('Set Donation', 'give'),
|
|
| 71 | + 'description' => esc_html__('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'),
|
|
| 72 | + 'id' => $prefix.'set_price', |
|
| 73 | 73 | 'type' => 'text_small', |
| 74 | 74 | 'row_classes' => 'give-subfield', |
| 75 | 75 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
| 76 | 76 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
| 77 | 77 | 'attributes' => array( |
| 78 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 79 | - 'value' => give_format_decimal( $price ), |
|
| 78 | + 'placeholder' => give_format_decimal('1.00'),
|
|
| 79 | + 'value' => give_format_decimal($price), |
|
| 80 | 80 | 'class' => 'cmb-type-text-small give-money-field', |
| 81 | 81 | ), |
| 82 | 82 | ), |
| 83 | 83 | //Donation levels: Header |
| 84 | 84 | array( |
| 85 | - 'id' => $prefix . 'levels_header', |
|
| 85 | + 'id' => $prefix.'levels_header', |
|
| 86 | 86 | 'type' => 'levels_repeater_header', |
| 87 | 87 | ), |
| 88 | 88 | //Donation Levels: Repeatable CMB2 Group |
| 89 | 89 | array( |
| 90 | - 'id' => $prefix . 'donation_levels', |
|
| 90 | + 'id' => $prefix.'donation_levels', |
|
| 91 | 91 | 'type' => 'group', |
| 92 | 92 | 'row_classes' => 'give-subfield', |
| 93 | 93 | 'options' => array( |
| 94 | - 'add_button' => esc_html__( 'Add Level', 'give' ), |
|
| 94 | + 'add_button' => esc_html__('Add Level', 'give'),
|
|
| 95 | 95 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
| 96 | 96 | 'sortable' => true, // beta |
| 97 | 97 | ), |
| 98 | 98 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
| 99 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
| 99 | + 'fields' => apply_filters('give_donation_levels_table_row', array(
|
|
| 100 | 100 | array( |
| 101 | - 'name' => esc_html__( 'ID', 'give' ), |
|
| 102 | - 'id' => $prefix . 'id', |
|
| 101 | + 'name' => esc_html__('ID', 'give'),
|
|
| 102 | + 'id' => $prefix.'id', |
|
| 103 | 103 | 'type' => 'levels_id', |
| 104 | 104 | ), |
| 105 | 105 | array( |
| 106 | - 'name' => esc_html__( 'Amount', 'give' ), |
|
| 107 | - 'id' => $prefix . 'amount', |
|
| 106 | + 'name' => esc_html__('Amount', 'give'),
|
|
| 107 | + 'id' => $prefix.'amount', |
|
| 108 | 108 | 'type' => 'text_small', |
| 109 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
| 110 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
| 109 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
|
|
| 110 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
|
|
| 111 | 111 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
| 112 | 112 | 'attributes' => array( |
| 113 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 113 | + 'placeholder' => give_format_decimal('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' => esc_html__( 'Text', 'give' ), |
|
| 120 | - 'id' => $prefix . 'text', |
|
| 119 | + 'name' => esc_html__('Text', 'give'),
|
|
| 120 | + 'id' => $prefix.'text', |
|
| 121 | 121 | 'type' => 'text', |
| 122 | 122 | 'attributes' => array( |
| 123 | - 'placeholder' => esc_html__( 'Donation Level', 'give' ), |
|
| 123 | + 'placeholder' => esc_html__('Donation Level', 'give'),
|
|
| 124 | 124 | 'class' => 'give-multilevel-text-field', |
| 125 | 125 | ), |
| 126 | 126 | ), |
| 127 | 127 | array( |
| 128 | - 'name' => esc_html__( 'Default', 'give' ), |
|
| 129 | - 'id' => $prefix . 'default', |
|
| 128 | + 'name' => esc_html__('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' => esc_html__( 'Display Style', 'give' ), |
|
| 137 | - 'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ), |
|
| 138 | - 'id' => $prefix . 'display_style', |
|
| 136 | + 'name' => esc_html__('Display Style', 'give'),
|
|
| 137 | + 'description' => esc_html__('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' => esc_html__( 'Buttons', 'give' ), |
|
| 143 | - 'radios' => esc_html__( 'Radios', 'give' ), |
|
| 144 | - 'dropdown' => esc_html__( 'Dropdown', 'give' ), |
|
| 142 | + 'buttons' => esc_html__('Buttons', 'give'),
|
|
| 143 | + 'radios' => esc_html__('Radios', 'give'),
|
|
| 144 | + 'dropdown' => esc_html__('Dropdown', 'give'),
|
|
| 145 | 145 | ), |
| 146 | 146 | ), |
| 147 | 147 | //Custom Amount |
| 148 | 148 | array( |
| 149 | - 'name' => esc_html__( 'Custom Amount', 'give' ), |
|
| 150 | - 'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
| 151 | - 'id' => $prefix . 'custom_amount', |
|
| 149 | + 'name' => esc_html__('Custom Amount', 'give'),
|
|
| 150 | + 'description' => esc_html__('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' => esc_html__( 'Yes', 'give' ), |
|
| 156 | - 'no' => esc_html__( 'No', 'give' ), |
|
| 155 | + 'yes' => esc_html__('Yes', 'give'),
|
|
| 156 | + 'no' => esc_html__('No', 'give'),
|
|
| 157 | 157 | ), |
| 158 | 158 | ), |
| 159 | 159 | array( |
| 160 | - 'name' => esc_html__( 'Custom Amount Minimum', 'give' ), |
|
| 161 | - 'description' => esc_html__( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
| 162 | - 'id' => $prefix . 'custom_amount_minimum', |
|
| 160 | + 'name' => esc_html__('Custom Amount Minimum', 'give'),
|
|
| 161 | + 'description' => esc_html__('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 | 165 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
| 166 | 166 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
| 167 | 167 | 'attributes' => array( |
| 168 | 168 | 'placeholder' => give_format_decimal('1.00'),
|
| 169 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
| 169 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
| 170 | 170 | 'class' => 'cmb-type-text-small give-money-field', |
| 171 | 171 | ) |
| 172 | 172 | ), |
| 173 | 173 | array( |
| 174 | - 'name' => esc_html__( 'Custom Amount Text', 'give' ), |
|
| 175 | - 'description' => esc_html__( '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' => esc_html__('Custom Amount Text', 'give'),
|
|
| 175 | + 'description' => esc_html__('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' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
| 181 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'),
|
|
| 182 | 182 | ), |
| 183 | 183 | ), |
| 184 | 184 | //Goals |
| 185 | 185 | array( |
| 186 | - 'name' => esc_html__( 'Goal', 'give' ), |
|
| 187 | - 'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ), |
|
| 188 | - 'id' => $prefix . 'goal_option', |
|
| 186 | + 'name' => esc_html__('Goal', 'give'),
|
|
| 187 | + 'description' => esc_html__('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' => esc_html__( 'Yes', 'give' ), |
|
| 193 | - 'no' => esc_html__( 'No', 'give' ), |
|
| 192 | + 'yes' => esc_html__('Yes', 'give'),
|
|
| 193 | + 'no' => esc_html__('No', 'give'),
|
|
| 194 | 194 | ), |
| 195 | 195 | ), |
| 196 | 196 | array( |
| 197 | - 'name' => esc_html__( 'Goal Amount', 'give' ), |
|
| 198 | - 'description' => esc_html__( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
| 199 | - 'id' => $prefix . 'set_goal', |
|
| 197 | + 'name' => esc_html__('Goal Amount', 'give'),
|
|
| 198 | + 'description' => esc_html__('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 | 202 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
| 203 | 203 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
| 204 | 204 | 'attributes' => array( |
| 205 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
| 206 | - 'value' => give_format_decimal( $goal ), |
|
| 205 | + 'placeholder' => give_format_decimal('0.00'),
|
|
| 206 | + 'value' => give_format_decimal($goal), |
|
| 207 | 207 | 'class' => 'cmb-type-text-small give-money-field', |
| 208 | 208 | ), |
| 209 | 209 | ), |
| 210 | 210 | |
| 211 | 211 | array( |
| 212 | - 'name' => esc_html__( 'Goal Format', 'give' ), |
|
| 213 | - 'description' => esc_html__( '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' => esc_html__('Goal Format', 'give'),
|
|
| 213 | + 'description' => esc_html__('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' => esc_html__( 'Amount', 'give' ), |
|
| 220 | - 'percentage' => esc_html__( 'Percentage', 'give' ), |
|
| 219 | + 'amount' => esc_html__('Amount', 'give'),
|
|
| 220 | + 'percentage' => esc_html__('Percentage', 'give'),
|
|
| 221 | 221 | ), |
| 222 | 222 | ), |
| 223 | 223 | array( |
| 224 | - 'name' => esc_html__( 'Goal Progress Bar Color', 'give' ), |
|
| 225 | - 'id' => $prefix . 'goal_color', |
|
| 224 | + 'name' => esc_html__('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 | array( |
| 232 | - 'name' => esc_html__( 'Close Form when Goal Achieved', 'give' ), |
|
| 233 | - 'desc' => esc_html__( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
| 234 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
| 232 | + 'name' => esc_html__('Close Form when Goal Achieved', 'give'),
|
|
| 233 | + 'desc' => esc_html__('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
|
|
| 234 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
| 235 | 235 | 'type' => 'radio_inline', |
| 236 | 236 | 'row_classes' => 'give-subfield', |
| 237 | 237 | 'options' => array( |
| 238 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
| 239 | - 'no' => esc_html__( 'No', 'give' ), |
|
| 238 | + 'yes' => esc_html__('Yes', 'give'),
|
|
| 239 | + 'no' => esc_html__('No', 'give'),
|
|
| 240 | 240 | ), |
| 241 | 241 | 'default' => 'no', |
| 242 | 242 | ), |
| 243 | 243 | array( |
| 244 | - 'name' => esc_html__( 'Goal Achieved Message', 'give' ), |
|
| 245 | - 'desc' => esc_html__( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ), |
|
| 246 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
| 244 | + 'name' => esc_html__('Goal Achieved Message', 'give'),
|
|
| 245 | + 'desc' => esc_html__('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'),
|
|
| 246 | + 'id' => $prefix.'form_goal_achieved_message', |
|
| 247 | 247 | 'type' => 'textarea', |
| 248 | 248 | 'row_classes' => 'give-subfield', |
| 249 | 249 | 'attributes' => array( |
| 250 | - 'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
| 250 | + 'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'),
|
|
| 251 | 251 | ), |
| 252 | 252 | ) |
| 253 | 253 | ) |
| 254 | 254 | ) |
| 255 | - ) ); |
|
| 255 | + )); |
|
| 256 | 256 | |
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * Content Field |
| 260 | 260 | */ |
| 261 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
| 261 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array(
|
|
| 262 | 262 | 'id' => 'form_content_options', |
| 263 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
| 264 | - 'object_types' => array( 'give_forms' ), |
|
| 263 | + 'title' => esc_html__('Form Content', 'give'),
|
|
| 264 | + 'object_types' => array('give_forms'),
|
|
| 265 | 265 | 'context' => 'normal', |
| 266 | 266 | 'priority' => 'high', //Show above Content WYSIWYG |
| 267 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
| 267 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array(
|
|
| 268 | 268 | //Donation Option |
| 269 | 269 | array( |
| 270 | - 'name' => esc_html__( 'Display Content', 'give' ), |
|
| 271 | - 'description' => esc_html__( 'Do you want to display content? If you choose to display content, a WYSIWYG editor will appear which you will be able to enter content.', 'give' ), |
|
| 272 | - 'id' => $prefix . 'content_option', |
|
| 270 | + 'name' => esc_html__('Display Content', 'give'),
|
|
| 271 | + 'description' => esc_html__('Do you want to display content? If you choose to display content, a WYSIWYG editor will appear which you will be able to enter content.', 'give'),
|
|
| 272 | + 'id' => $prefix.'content_option', |
|
| 273 | 273 | 'type' => 'select', |
| 274 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 275 | - 'none' => esc_html__( 'No Content', 'give' ), |
|
| 276 | - 'give_pre_form' => esc_html__( 'Display content ABOVE the fields', 'give' ), |
|
| 277 | - 'give_post_form' => esc_html__( 'Display content BELOW the fields', 'give' ), |
|
| 274 | + 'options' => apply_filters('give_forms_content_options_select', array(
|
|
| 275 | + 'none' => esc_html__('No Content', 'give'),
|
|
| 276 | + 'give_pre_form' => esc_html__('Display content ABOVE the fields', 'give'),
|
|
| 277 | + 'give_post_form' => esc_html__('Display content BELOW the fields', 'give'),
|
|
| 278 | 278 | ) |
| 279 | 279 | ), |
| 280 | 280 | 'default' => 'none', |
| 281 | 281 | ), |
| 282 | 282 | array( |
| 283 | - 'name' => esc_html__( 'Content', 'give' ), |
|
| 284 | - 'description' => esc_html__( 'This content will display on the single give form page.', 'give' ), |
|
| 285 | - 'id' => $prefix . 'form_content', |
|
| 283 | + 'name' => esc_html__('Content', 'give'),
|
|
| 284 | + 'description' => esc_html__('This content will display on the single give form page.', 'give'),
|
|
| 285 | + 'id' => $prefix.'form_content', |
|
| 286 | 286 | 'row_classes' => 'give-subfield', |
| 287 | 287 | 'type' => 'wysiwyg' |
| 288 | 288 | ), |
| 289 | 289 | ) |
| 290 | 290 | ) |
| 291 | - ) ); |
|
| 291 | + )); |
|
| 292 | 292 | |
| 293 | 293 | |
| 294 | 294 | /** |
| 295 | 295 | * Display Options |
| 296 | 296 | */ |
| 297 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
| 297 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array(
|
|
| 298 | 298 | 'id' => 'form_display_options', |
| 299 | - 'title' => esc_html__( 'Form Display Options', 'give' ), |
|
| 300 | - 'object_types' => array( 'give_forms' ), |
|
| 299 | + 'title' => esc_html__('Form Display Options', 'give'),
|
|
| 300 | + 'object_types' => array('give_forms'),
|
|
| 301 | 301 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
| 302 | 302 | 'priority' => 'high', //Show above Content WYSIWYG |
| 303 | 303 | 'show_names' => true, // Show field names on the left |
| 304 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
| 304 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array(
|
|
| 305 | 305 | array( |
| 306 | - 'name' => esc_html__( 'Payment Fields', 'give' ), |
|
| 307 | - 'desc' => esc_html__( 'How would you like to display donation 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 click 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' ), |
|
| 308 | - 'id' => $prefix . 'payment_display', |
|
| 306 | + 'name' => esc_html__('Payment Fields', 'give'),
|
|
| 307 | + 'desc' => esc_html__('How would you like to display donation 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 click 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'),
|
|
| 308 | + 'id' => $prefix.'payment_display', |
|
| 309 | 309 | 'type' => 'select', |
| 310 | 310 | 'options' => array( |
| 311 | - 'onpage' => esc_html__( 'Show on Page', 'give' ), |
|
| 312 | - 'reveal' => esc_html__( 'Reveal Upon Click', 'give' ), |
|
| 313 | - 'modal' => esc_html__( 'Modal Window Upon Click', 'give' ), |
|
| 311 | + 'onpage' => esc_html__('Show on Page', 'give'),
|
|
| 312 | + 'reveal' => esc_html__('Reveal Upon Click', 'give'),
|
|
| 313 | + 'modal' => esc_html__('Modal Window Upon Click', 'give'),
|
|
| 314 | 314 | ), |
| 315 | 315 | 'default' => 'onpage', |
| 316 | 316 | ), |
| 317 | 317 | array( |
| 318 | - 'id' => $prefix . 'reveal_label', |
|
| 319 | - 'name' => esc_html__( 'Reveal / Modal Open Text', 'give' ), |
|
| 320 | - 'desc' => esc_html__( 'The button label for completing the donation.', 'give' ), |
|
| 318 | + 'id' => $prefix.'reveal_label', |
|
| 319 | + 'name' => esc_html__('Reveal / Modal Open Text', 'give'),
|
|
| 320 | + 'desc' => esc_html__('The button label for completing the donation.', 'give'),
|
|
| 321 | 321 | 'type' => 'text_small', |
| 322 | 322 | 'row_classes' => 'give-subfield', |
| 323 | 323 | 'attributes' => array( |
| 324 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
| 324 | + 'placeholder' => esc_attr__('Donate Now', 'give'),
|
|
| 325 | 325 | ), |
| 326 | 326 | ), |
| 327 | 327 | array( |
| 328 | - 'id' => $prefix . 'checkout_label', |
|
| 329 | - 'name' => esc_html__( 'Complete Donation Text', 'give' ), |
|
| 330 | - 'desc' => esc_html__( 'The button label for completing a donation.', 'give' ), |
|
| 328 | + 'id' => $prefix.'checkout_label', |
|
| 329 | + 'name' => esc_html__('Complete Donation Text', 'give'),
|
|
| 330 | + 'desc' => esc_html__('The button label for completing a donation.', 'give'),
|
|
| 331 | 331 | 'type' => 'text_small', |
| 332 | 332 | 'attributes' => array( |
| 333 | - 'placeholder' => esc_html__( 'Donate Now', 'give' ), |
|
| 333 | + 'placeholder' => esc_html__('Donate Now', 'give'),
|
|
| 334 | 334 | ), |
| 335 | 335 | ), |
| 336 | 336 | array( |
| 337 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
| 338 | - 'desc' => esc_html__( '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' ), |
|
| 339 | - 'id' => $prefix . 'default_gateway', |
|
| 337 | + 'name' => esc_html__('Default Gateway', 'give'),
|
|
| 338 | + 'desc' => esc_html__('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'),
|
|
| 339 | + 'id' => $prefix.'default_gateway', |
|
| 340 | 340 | 'type' => 'default_gateway' |
| 341 | 341 | ), |
| 342 | 342 | array( |
| 343 | - 'name' => esc_html__( 'Disable Guest Donations', 'give' ), |
|
| 344 | - 'desc' => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
| 345 | - 'id' => $prefix . 'logged_in_only', |
|
| 343 | + 'name' => esc_html__('Disable Guest Donations', 'give'),
|
|
| 344 | + 'desc' => esc_html__('Do you want to require users be logged-in to make donations?', 'give'),
|
|
| 345 | + 'id' => $prefix.'logged_in_only', |
|
| 346 | 346 | 'type' => 'checkbox' |
| 347 | 347 | ), |
| 348 | 348 | array( |
| 349 | - 'name' => esc_html__( 'Register / Login Form', 'give' ), |
|
| 350 | - 'desc' => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
| 351 | - 'id' => $prefix . 'show_register_form', |
|
| 349 | + 'name' => esc_html__('Register / Login Form', 'give'),
|
|
| 350 | + 'desc' => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
|
|
| 351 | + 'id' => $prefix.'show_register_form', |
|
| 352 | 352 | 'type' => 'select', |
| 353 | 353 | 'options' => array( |
| 354 | - 'both' => esc_html__( 'Registration and Login Forms', 'give' ), |
|
| 355 | - 'registration' => esc_html__( 'Registration Form Only', 'give' ), |
|
| 356 | - 'login' => esc_html__( 'Login Form Only', 'give' ), |
|
| 357 | - 'none' => esc_html__( 'None', 'give' ), |
|
| 354 | + 'both' => esc_html__('Registration and Login Forms', 'give'),
|
|
| 355 | + 'registration' => esc_html__('Registration Form Only', 'give'),
|
|
| 356 | + 'login' => esc_html__('Login Form Only', 'give'),
|
|
| 357 | + 'none' => esc_html__('None', 'give'),
|
|
| 358 | 358 | ), |
| 359 | 359 | 'default' => 'none', |
| 360 | 360 | ), |
| 361 | 361 | array( |
| 362 | - 'name' => esc_html__( 'Floating Labels', 'give' ), |
|
| 362 | + 'name' => esc_html__('Floating Labels', 'give'),
|
|
| 363 | 363 | /* translators: %s: forms https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */ |
| 364 | - '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( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ), |
|
| 365 | - 'id' => $prefix . 'form_floating_labels', |
|
| 364 | + '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('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
|
|
| 365 | + 'id' => $prefix.'form_floating_labels', |
|
| 366 | 366 | 'type' => 'select', |
| 367 | 367 | 'options' => array( |
| 368 | - '' => esc_html__( 'Use the global setting', 'give' ), |
|
| 369 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 370 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 368 | + '' => esc_html__('Use the global setting', 'give'),
|
|
| 369 | + 'enabled' => esc_html__('Enabled', 'give'),
|
|
| 370 | + 'disabled' => esc_html__('Disabled', 'give'),
|
|
| 371 | 371 | ), |
| 372 | 372 | 'default' => 'none', |
| 373 | 373 | ) |
@@ -379,50 +379,50 @@ discard block |
||
| 379 | 379 | /** |
| 380 | 380 | * Terms & Conditions |
| 381 | 381 | */ |
| 382 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
| 382 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array(
|
|
| 383 | 383 | 'id' => 'form_terms_options', |
| 384 | - 'title' => esc_html__( 'Terms and Conditions', 'give' ), |
|
| 385 | - 'object_types' => array( 'give_forms' ), |
|
| 384 | + 'title' => esc_html__('Terms and Conditions', 'give'),
|
|
| 385 | + 'object_types' => array('give_forms'),
|
|
| 386 | 386 | 'context' => 'normal', |
| 387 | 387 | 'priority' => 'high', //Show above Content WYSIWYG |
| 388 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
| 388 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array(
|
|
| 389 | 389 | //Donation Option |
| 390 | 390 | array( |
| 391 | - 'name' => esc_html__( 'Terms and Conditions', 'give' ), |
|
| 392 | - 'description' => esc_html__( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
| 393 | - 'id' => $prefix . 'terms_option', |
|
| 391 | + 'name' => esc_html__('Terms and Conditions', 'give'),
|
|
| 392 | + 'description' => esc_html__('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'),
|
|
| 393 | + 'id' => $prefix.'terms_option', |
|
| 394 | 394 | 'type' => 'select', |
| 395 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 396 | - 'none' => esc_html__( 'No', 'give' ), |
|
| 397 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
| 395 | + 'options' => apply_filters('give_forms_content_options_select', array(
|
|
| 396 | + 'none' => esc_html__('No', 'give'),
|
|
| 397 | + 'yes' => esc_html__('Yes', 'give'),
|
|
| 398 | 398 | ) |
| 399 | 399 | ), |
| 400 | 400 | 'default' => 'none', |
| 401 | 401 | ), |
| 402 | 402 | array( |
| 403 | - 'id' => $prefix . 'agree_label', |
|
| 404 | - 'name' => esc_html__( 'Agree to Terms Label', 'give' ), |
|
| 405 | - 'desc' => esc_html__( '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' ), |
|
| 403 | + 'id' => $prefix.'agree_label', |
|
| 404 | + 'name' => esc_html__('Agree to Terms Label', 'give'),
|
|
| 405 | + 'desc' => esc_html__('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'),
|
|
| 406 | 406 | 'type' => 'text', |
| 407 | 407 | 'row_classes' => 'give-subfield', |
| 408 | 408 | 'size' => 'regular', |
| 409 | 409 | 'attributes' => array( |
| 410 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
| 410 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'),
|
|
| 411 | 411 | ), |
| 412 | 412 | ), |
| 413 | 413 | array( |
| 414 | - 'id' => $prefix . 'agree_text', |
|
| 414 | + 'id' => $prefix.'agree_text', |
|
| 415 | 415 | 'row_classes' => 'give-subfield', |
| 416 | - 'name' => esc_html__( 'Agreement Text', 'give' ), |
|
| 417 | - 'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
| 416 | + 'name' => esc_html__('Agreement Text', 'give'),
|
|
| 417 | + 'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
|
|
| 418 | 418 | 'type' => 'wysiwyg' |
| 419 | 419 | ), |
| 420 | 420 | ) |
| 421 | 421 | ) |
| 422 | - ) ); |
|
| 422 | + )); |
|
| 423 | 423 | |
| 424 | - foreach ( $meta_boxes as $box ) {
|
|
| 425 | - $cmb = new_cmb2_box( $box ); |
|
| 424 | + foreach ($meta_boxes as $box) {
|
|
| 425 | + $cmb = new_cmb2_box($box); |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | } |
@@ -435,9 +435,9 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | <div class="table-container"> |
| 437 | 437 | <div class="table-row"> |
| 438 | - <div class="table-cell col-amount"><?php esc_html_e( 'Amount', 'give' ); ?></div> |
|
| 439 | - <div class="table-cell col-text"><?php esc_html_e( 'Text', 'give' ); ?></div> |
|
| 440 | - <div class="table-cell col-default"><?php esc_html_e( 'Default', 'give' ); ?></div> |
|
| 438 | + <div class="table-cell col-amount"><?php esc_html_e('Amount', 'give'); ?></div>
|
|
| 439 | + <div class="table-cell col-text"><?php esc_html_e('Text', 'give'); ?></div>
|
|
| 440 | + <div class="table-cell col-default"><?php esc_html_e('Default', 'give'); ?></div>
|
|
| 441 | 441 | <?php |
| 442 | 442 | /** |
| 443 | 443 | * Fires in repeatable donation levels table head. |
@@ -449,9 +449,9 @@ discard block |
||
| 449 | 449 | * |
| 450 | 450 | * @since 1.0 |
| 451 | 451 | */ |
| 452 | - do_action( 'give_donation_levels_table_head' ); |
|
| 452 | + do_action('give_donation_levels_table_head');
|
|
| 453 | 453 | ?> |
| 454 | - <div class="table-cell col-sort"><?php esc_html_e( 'Sort', 'give' ); ?></div> |
|
| 454 | + <div class="table-cell col-sort"><?php esc_html_e('Sort', 'give'); ?></div>
|
|
| 455 | 455 | |
| 456 | 456 | </div> |
| 457 | 457 | </div> |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | <?php |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
| 462 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10);
|
|
| 463 | 463 | |
| 464 | 464 | |
| 465 | 465 | /** |
@@ -476,25 +476,25 @@ discard block |
||
| 476 | 476 | * @param $object_type |
| 477 | 477 | * @param $field_type_object |
| 478 | 478 | */ |
| 479 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
|
|
| 479 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
|
|
| 480 | 480 | |
| 481 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
| 481 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
| 482 | 482 | |
| 483 | 483 | $field_options_array = array( |
| 484 | 484 | 'class' => 'give-hidden give-level-id-input', |
| 485 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
| 486 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
| 485 | + 'name' => $field_type_object->_name('[level_id]'),
|
|
| 486 | + 'id' => $field_type_object->_id('_level_id'),
|
|
| 487 | 487 | 'value' => $escaped_value, |
| 488 | 488 | 'type' => 'number', |
| 489 | 489 | 'desc' => '', |
| 490 | 490 | ); |
| 491 | 491 | |
| 492 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
| 493 | - echo $field_type_object->input( $field_options_array ); |
|
| 492 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
| 493 | + echo $field_type_object->input($field_options_array); |
|
| 494 | 494 | |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
| 497 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5);
|
|
| 498 | 498 | |
| 499 | 499 | |
| 500 | 500 | /** |
@@ -506,13 +506,13 @@ discard block |
||
| 506 | 506 | * @param $object_type |
| 507 | 507 | * @param $field_type_object |
| 508 | 508 | */ |
| 509 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
|
|
| 510 | - 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 ) . '>'; |
|
| 511 | - echo '<label for="' . $field_object->args['id'] . '">' . esc_html__( 'Default', 'give' ) . '</label>'; |
|
| 509 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
|
|
| 510 | + 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).'>';
|
|
| 511 | + echo '<label for="'.$field_object->args['id'].'">'.esc_html__('Default', 'give').'</label>';
|
|
| 512 | 512 | |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
| 515 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5);
|
|
| 516 | 516 | |
| 517 | 517 | |
| 518 | 518 | /** |
@@ -522,20 +522,20 @@ discard block |
||
| 522 | 522 | */ |
| 523 | 523 | function give_add_shortcode_to_publish_metabox() {
|
| 524 | 524 | |
| 525 | - if ( 'give_forms' !== get_post_type() ) {
|
|
| 525 | + if ('give_forms' !== get_post_type()) {
|
|
| 526 | 526 | return false; |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | global $post; |
| 530 | 530 | |
| 531 | 531 | //Only enqueue scripts for CPT on post type screen |
| 532 | - if ( 'give_forms' === $post->post_type ) {
|
|
| 532 | + if ('give_forms' === $post->post_type) {
|
|
| 533 | 533 | //Shortcode column with select all input |
| 534 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
| 535 | - echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
| 534 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
|
|
| 535 | + echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
|
|
| 536 | 536 | |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
| 541 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
|
|
@@ -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,50 +23,50 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return string Donation form. |
| 25 | 25 | */ |
| 26 | -function give_get_donation_form( $args = array() ) { |
|
| 26 | +function give_get_donation_form($args = array()) { |
|
| 27 | 27 | |
| 28 | 28 | global $post; |
| 29 | 29 | |
| 30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
| 30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
| 31 | 31 | |
| 32 | - if ( isset( $args['id'] ) ) { |
|
| 32 | + if (isset($args['id'])) { |
|
| 33 | 33 | $form_id = $args['id']; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
| 36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
| 37 | 37 | 'form_id' => $form_id, |
| 38 | - ) ); |
|
| 38 | + )); |
|
| 39 | 39 | |
| 40 | - $args = wp_parse_args( $args, $defaults ); |
|
| 40 | + $args = wp_parse_args($args, $defaults); |
|
| 41 | 41 | |
| 42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
| 42 | + $form = new Give_Donate_Form($args['form_id']); |
|
| 43 | 43 | |
| 44 | 44 | //bail if no form ID. |
| 45 | - if ( empty( $form->ID ) ) { |
|
| 45 | + if (empty($form->ID)) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
| 49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
| 50 | 50 | |
| 51 | - $form_action = add_query_arg( apply_filters( 'give_form_action_args', array( |
|
| 51 | + $form_action = add_query_arg(apply_filters('give_form_action_args', array( |
|
| 52 | 52 | 'payment-mode' => $payment_mode, |
| 53 | - ) ), |
|
| 53 | + )), |
|
| 54 | 54 | give_get_current_page_url() |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
| 58 | 58 | if ( |
| 59 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
| 60 | - || ( 'trash' === $form->post_status ) |
|
| 59 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
| 60 | + || ('trash' === $form->post_status) |
|
| 61 | 61 | ) { |
| 62 | 62 | return false; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | //Get the form wrap CSS classes. |
| 66 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
| 66 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
| 67 | 67 | |
| 68 | 68 | //Get the <form> tag wrap CSS classes. |
| 69 | - $form_classes = $form->get_form_classes( $args ); |
|
| 69 | + $form_classes = $form->get_form_classes($args); |
|
| 70 | 70 | |
| 71 | 71 | ob_start(); |
| 72 | 72 | |
@@ -78,23 +78,23 @@ discard block |
||
| 78 | 78 | * @param int $form_id The form ID. |
| 79 | 79 | * @param array $args An array of form arguments. |
| 80 | 80 | */ |
| 81 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
| 81 | + do_action('give_pre_form_output', $form->ID, $args); |
|
| 82 | 82 | |
| 83 | 83 | ?> |
| 84 | 84 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
| 85 | 85 | |
| 86 | - <?php if ( $form->is_close_donation_form() ) { |
|
| 86 | + <?php if ($form->is_close_donation_form()) { |
|
| 87 | 87 | |
| 88 | 88 | //Get Goal thank you message. |
| 89 | - $display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
| 90 | - $display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ); |
|
| 89 | + $display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
| 90 | + $display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give'); |
|
| 91 | 91 | |
| 92 | 92 | //Print thank you message. |
| 93 | - apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) ); |
|
| 93 | + apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success')); |
|
| 94 | 94 | |
| 95 | 95 | } else { |
| 96 | 96 | |
| 97 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
| 97 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Filter the title |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @param int $form_id |
| 105 | 105 | * @param Give_Donate_Form $form |
| 106 | 106 | */ |
| 107 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>', $form_id, $form ); |
|
| 107 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>', $form_id, $form); |
|
| 108 | 108 | |
| 109 | 109 | } |
| 110 | 110 | |
@@ -116,19 +116,19 @@ discard block |
||
| 116 | 116 | * @param int $form_id The form ID. |
| 117 | 117 | * @param array $args An array of form arguments. |
| 118 | 118 | */ |
| 119 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
| 119 | + do_action('give_pre_form', $form->ID, $args); |
|
| 120 | 120 | ?> |
| 121 | 121 | |
| 122 | 122 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" |
| 123 | - action="<?php echo esc_url_raw( $form_action ); ?>" method="post"> |
|
| 123 | + action="<?php echo esc_url_raw($form_action); ?>" method="post"> |
|
| 124 | 124 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
| 125 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
| 125 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
| 126 | 126 | <input type="hidden" name="give-current-url" |
| 127 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 127 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 128 | 128 | <input type="hidden" name="give-form-url" |
| 129 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 129 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 130 | 130 | <input type="hidden" name="give-form-minimum" |
| 131 | - value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
| 131 | + value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
| 132 | 132 | |
| 133 | 133 | <!-- The following field is for robots only, invisible to humans: --> |
| 134 | 134 | <span class="give-hidden" style="display: none !important;"> |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | <?php |
| 141 | 141 | |
| 142 | 142 | //Price ID hidden field for variable (mult-level) donation forms. |
| 143 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 143 | + if (give_has_variable_prices($form_id)) { |
|
| 144 | 144 | //get default selected price ID. |
| 145 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 145 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 146 | 146 | $price_id = 0; |
| 147 | 147 | //loop through prices. |
| 148 | - foreach ( $prices as $price ) { |
|
| 149 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 148 | + foreach ($prices as $price) { |
|
| 149 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 150 | 150 | $price_id = $price['_give_id']['level_id']; |
| 151 | 151 | }; |
| 152 | 152 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * @param int $form_id The form ID. |
| 163 | 163 | * @param array $args An array of form arguments. |
| 164 | 164 | */ |
| 165 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
| 165 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | 168 | * Fires while outputing donation form, for payment gatways fields. |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @param int $form_id The form ID. |
| 173 | 173 | * @param array $args An array of form arguments. |
| 174 | 174 | */ |
| 175 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
| 175 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | 178 | * Fires while outputing donation form, after all other fields. |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @param int $form_id The form ID. |
| 183 | 183 | * @param array $args An array of form arguments. |
| 184 | 184 | */ |
| 185 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
| 185 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
| 186 | 186 | |
| 187 | 187 | ?> |
| 188 | 188 | </form> |
@@ -196,12 +196,12 @@ discard block |
||
| 196 | 196 | * @param int $form_id The form ID. |
| 197 | 197 | * @param array $args An array of form arguments. |
| 198 | 198 | */ |
| 199 | - do_action( 'give_post_form', $form->ID, $args ); |
|
| 199 | + do_action('give_post_form', $form->ID, $args); |
|
| 200 | 200 | |
| 201 | 201 | } |
| 202 | 202 | ?> |
| 203 | 203 | |
| 204 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
| 204 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
| 205 | 205 | <?php |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -212,11 +212,11 @@ discard block |
||
| 212 | 212 | * @param int $form_id The form ID. |
| 213 | 213 | * @param array $args An array of form arguments. |
| 214 | 214 | */ |
| 215 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
| 215 | + do_action('give_post_form_output', $form->ID, $args); |
|
| 216 | 216 | |
| 217 | 217 | $final_output = ob_get_clean(); |
| 218 | 218 | |
| 219 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
| 219 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @return string |
| 235 | 235 | */ |
| 236 | -function give_show_purchase_form( $form_id ) { |
|
| 236 | +function give_show_purchase_form($form_id) { |
|
| 237 | 237 | |
| 238 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 238 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 239 | 239 | |
| 240 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
| 240 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
| 241 | 241 | $form_id = $_POST['give_form_id']; |
| 242 | 242 | } |
| 243 | 243 | |
@@ -246,33 +246,33 @@ discard block |
||
| 246 | 246 | * |
| 247 | 247 | * @since 1.7 |
| 248 | 248 | */ |
| 249 | - do_action( 'give_donation_form_top', $form_id ); |
|
| 249 | + do_action('give_donation_form_top', $form_id); |
|
| 250 | 250 | |
| 251 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
| 251 | + if (give_can_checkout() && isset($form_id)) { |
|
| 252 | 252 | |
| 253 | 253 | /** |
| 254 | 254 | * Fires while displaying donation form, before registration login. |
| 255 | 255 | * |
| 256 | 256 | * @since 1.7 |
| 257 | 257 | */ |
| 258 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
| 258 | + do_action('give_donation_form_before_register_login', $form_id); |
|
| 259 | 259 | |
| 260 | 260 | /** |
| 261 | 261 | * Fire when register/login form fields render. |
| 262 | 262 | * |
| 263 | 263 | * @since 1.7 |
| 264 | 264 | */ |
| 265 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
| 265 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
| 266 | 266 | |
| 267 | 267 | /** |
| 268 | 268 | * Fire when credit card form fields render. |
| 269 | 269 | * |
| 270 | 270 | * @since 1.7 |
| 271 | 271 | */ |
| 272 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
| 272 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
| 273 | 273 | |
| 274 | 274 | // Load the credit card form and allow gateways to load their own if they wish. |
| 275 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
| 275 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
| 276 | 276 | /** |
| 277 | 277 | * Fires while displaying donation form, credit card form fields for a given gateway. |
| 278 | 278 | * |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | * |
| 281 | 281 | * @param int $form_id The form ID. |
| 282 | 282 | */ |
| 283 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
| 283 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
| 284 | 284 | } else { |
| 285 | 285 | /** |
| 286 | 286 | * Fires while displaying donation form, credit card form fields. |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * |
| 290 | 290 | * @param int $form_id The form ID. |
| 291 | 291 | */ |
| 292 | - do_action( 'give_cc_form', $form_id ); |
|
| 292 | + do_action('give_cc_form', $form_id); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * |
| 298 | 298 | * @since 1.7 |
| 299 | 299 | */ |
| 300 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
| 300 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
| 301 | 301 | |
| 302 | 302 | } else { |
| 303 | 303 | /** |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | * |
| 306 | 306 | * @since 1.7 |
| 307 | 307 | */ |
| 308 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
| 308 | + do_action('give_donation_form_no_access', $form_id); |
|
| 309 | 309 | |
| 310 | 310 | } |
| 311 | 311 | |
@@ -314,10 +314,10 @@ discard block |
||
| 314 | 314 | * |
| 315 | 315 | * @since 1.7 |
| 316 | 316 | */ |
| 317 | - do_action( 'give_donation_form_bottom', $form_id ); |
|
| 317 | + do_action('give_donation_form_bottom', $form_id); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
| 320 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
| 321 | 321 | |
| 322 | 322 | /** |
| 323 | 323 | * Give Show Login/Register Form Fields. |
@@ -328,11 +328,11 @@ discard block |
||
| 328 | 328 | * |
| 329 | 329 | * @return void |
| 330 | 330 | */ |
| 331 | -function give_show_register_login_fields( $form_id ) { |
|
| 331 | +function give_show_register_login_fields($form_id) { |
|
| 332 | 332 | |
| 333 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 333 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 334 | 334 | |
| 335 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 335 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 336 | 336 | ?> |
| 337 | 337 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 338 | 338 | <?php |
@@ -341,11 +341,11 @@ discard block |
||
| 341 | 341 | * |
| 342 | 342 | * @since 1.7 |
| 343 | 343 | */ |
| 344 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
| 344 | + do_action('give_donation_form_register_fields', $form_id); |
|
| 345 | 345 | ?> |
| 346 | 346 | </div> |
| 347 | 347 | <?php |
| 348 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 348 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 349 | 349 | ?> |
| 350 | 350 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 351 | 351 | <?php |
@@ -354,23 +354,23 @@ discard block |
||
| 354 | 354 | * |
| 355 | 355 | * @since 1.7 |
| 356 | 356 | */ |
| 357 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
| 357 | + do_action('give_donation_form_login_fields', $form_id); |
|
| 358 | 358 | ?> |
| 359 | 359 | </div> |
| 360 | 360 | <?php |
| 361 | 361 | endif; |
| 362 | 362 | |
| 363 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
| 363 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
| 364 | 364 | /** |
| 365 | 365 | * Fire when user info render. |
| 366 | 366 | * |
| 367 | 367 | * @since 1.7 |
| 368 | 368 | */ |
| 369 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
| 369 | + do_action('give_donation_form_after_user_info', $form_id); |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
| 373 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
| 374 | 374 | |
| 375 | 375 | /** |
| 376 | 376 | * Donation Amount Field. |
@@ -384,16 +384,16 @@ discard block |
||
| 384 | 384 | * |
| 385 | 385 | * @return void |
| 386 | 386 | */ |
| 387 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
| 387 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
| 388 | 388 | |
| 389 | 389 | $give_options = give_get_settings(); |
| 390 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
| 391 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 392 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 393 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
| 394 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
| 395 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
| 396 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 390 | + $variable_pricing = give_has_variable_prices($form_id); |
|
| 391 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 392 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 393 | + $symbol = give_currency_symbol(give_get_currency()); |
|
| 394 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
| 395 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
| 396 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 397 | 397 | |
| 398 | 398 | /** |
| 399 | 399 | * Fires while displaying donation form, before donation level fields. |
@@ -403,20 +403,20 @@ discard block |
||
| 403 | 403 | * @param int $form_id The form ID. |
| 404 | 404 | * @param array $args An array of form arguments. |
| 405 | 405 | */ |
| 406 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
| 406 | + do_action('give_before_donation_levels', $form_id, $args); |
|
| 407 | 407 | |
| 408 | 408 | //Set Price, No Custom Amount Allowed means hidden price field. |
| 409 | - if ( $allow_custom_amount == 'no' ) { |
|
| 409 | + if ($allow_custom_amount == 'no') { |
|
| 410 | 410 | ?> |
| 411 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 411 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 412 | 412 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
| 413 | 413 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
| 414 | 414 | <div class="set-price give-donation-amount form-row-wide"> |
| 415 | - <?php if ( $currency_position == 'before' ) { |
|
| 415 | + <?php if ($currency_position == 'before') { |
|
| 416 | 416 | echo $currency_output; |
| 417 | 417 | } ?> |
| 418 | 418 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
| 419 | - <?php if ( $currency_position == 'after' ) { |
|
| 419 | + <?php if ($currency_position == 'after') { |
|
| 420 | 420 | echo $currency_output; |
| 421 | 421 | } ?> |
| 422 | 422 | </div> |
@@ -426,13 +426,13 @@ discard block |
||
| 426 | 426 | ?> |
| 427 | 427 | <div class="give-total-wrap"> |
| 428 | 428 | <div class="give-donation-amount form-row-wide"> |
| 429 | - <?php if ( $currency_position == 'before' ) { |
|
| 429 | + <?php if ($currency_position == 'before') { |
|
| 430 | 430 | echo $currency_output; |
| 431 | 431 | } ?> |
| 432 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 432 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 433 | 433 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
| 434 | 434 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
| 435 | - <?php if ( $currency_position == 'after' ) { |
|
| 435 | + <?php if ($currency_position == 'after') { |
|
| 436 | 436 | echo $currency_output; |
| 437 | 437 | } ?> |
| 438 | 438 | </div> |
@@ -447,16 +447,16 @@ discard block |
||
| 447 | 447 | * @param int $form_id The form ID. |
| 448 | 448 | * @param array $args An array of form arguments. |
| 449 | 449 | */ |
| 450 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
| 450 | + do_action('give_after_donation_amount', $form_id, $args); |
|
| 451 | 451 | |
| 452 | 452 | //Custom Amount Text. |
| 453 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
| 453 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
| 454 | 454 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
| 455 | 455 | <?php } |
| 456 | 456 | |
| 457 | 457 | //Output Variable Pricing Levels. |
| 458 | - if ( $variable_pricing ) { |
|
| 459 | - give_output_levels( $form_id ); |
|
| 458 | + if ($variable_pricing) { |
|
| 459 | + give_output_levels($form_id); |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | /** |
@@ -467,10 +467,10 @@ discard block |
||
| 467 | 467 | * @param int $form_id The form ID. |
| 468 | 468 | * @param array $args An array of form arguments. |
| 469 | 469 | */ |
| 470 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
| 470 | + do_action('give_after_donation_levels', $form_id, $args); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
| 473 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
| 474 | 474 | |
| 475 | 475 | /** |
| 476 | 476 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -481,32 +481,32 @@ discard block |
||
| 481 | 481 | * |
| 482 | 482 | * @return string Donation levels. |
| 483 | 483 | */ |
| 484 | -function give_output_levels( $form_id ) { |
|
| 484 | +function give_output_levels($form_id) { |
|
| 485 | 485 | |
| 486 | 486 | //Get variable pricing. |
| 487 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 488 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
| 489 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 490 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 491 | - if ( empty( $custom_amount_text ) ) { |
|
| 492 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
| 487 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 488 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
| 489 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 490 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 491 | + if (empty($custom_amount_text)) { |
|
| 492 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | $output = ''; |
| 496 | 496 | $counter = 0; |
| 497 | 497 | |
| 498 | - switch ( $display_style ) { |
|
| 498 | + switch ($display_style) { |
|
| 499 | 499 | case 'buttons': |
| 500 | 500 | |
| 501 | 501 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 502 | 502 | |
| 503 | - foreach ( $prices as $price ) { |
|
| 504 | - $counter ++; |
|
| 505 | - $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 ); |
|
| 506 | - $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 ); |
|
| 503 | + foreach ($prices as $price) { |
|
| 504 | + $counter++; |
|
| 505 | + $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); |
|
| 506 | + $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); |
|
| 507 | 507 | |
| 508 | 508 | $output .= '<li>'; |
| 509 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 509 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 510 | 510 | $output .= $level_text; |
| 511 | 511 | $output .= '</button>'; |
| 512 | 512 | $output .= '</li>'; |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | //Custom Amount. |
| 517 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 517 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 518 | 518 | $output .= '<li>'; |
| 519 | 519 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
| 520 | 520 | $output .= $custom_amount_text; |
@@ -530,23 +530,23 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 532 | 532 | |
| 533 | - foreach ( $prices as $price ) { |
|
| 534 | - $counter ++; |
|
| 535 | - $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 ); |
|
| 536 | - $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 ); |
|
| 533 | + foreach ($prices as $price) { |
|
| 534 | + $counter++; |
|
| 535 | + $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); |
|
| 536 | + $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); |
|
| 537 | 537 | |
| 538 | 538 | $output .= '<li>'; |
| 539 | - $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'] ) . '">'; |
|
| 540 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
| 539 | + $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']).'">'; |
|
| 540 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
| 541 | 541 | $output .= '</li>'; |
| 542 | 542 | |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | //Custom Amount. |
| 546 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 546 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 547 | 547 | $output .= '<li>'; |
| 548 | 548 | $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">'; |
| 549 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
| 549 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
| 550 | 550 | $output .= '</li>'; |
| 551 | 551 | } |
| 552 | 552 | |
@@ -556,23 +556,23 @@ discard block |
||
| 556 | 556 | |
| 557 | 557 | case 'dropdown': |
| 558 | 558 | |
| 559 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
| 560 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 559 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
| 560 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 561 | 561 | |
| 562 | 562 | //first loop through prices. |
| 563 | - foreach ( $prices as $price ) { |
|
| 564 | - $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 ); |
|
| 565 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 563 | + foreach ($prices as $price) { |
|
| 564 | + $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); |
|
| 565 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 566 | 566 | |
| 567 | - $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'] ) . '">'; |
|
| 567 | + $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']).'">'; |
|
| 568 | 568 | $output .= $level_text; |
| 569 | 569 | $output .= '</option>'; |
| 570 | 570 | |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | //Custom Amount. |
| 574 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
| 575 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
| 574 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
| 575 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | $output .= '</select>'; |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | break; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
| 583 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | /** |
@@ -595,26 +595,26 @@ discard block |
||
| 595 | 595 | * |
| 596 | 596 | * @return string Checkout button. |
| 597 | 597 | */ |
| 598 | -function give_display_checkout_button( $form_id, $args ) { |
|
| 598 | +function give_display_checkout_button($form_id, $args) { |
|
| 599 | 599 | |
| 600 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 600 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 601 | 601 | ? $args['display_style'] |
| 602 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
| 602 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
| 603 | 603 | |
| 604 | 604 | //no btn for onpage. |
| 605 | - if ( $display_option === 'onpage' ) { |
|
| 605 | + if ($display_option === 'onpage') { |
|
| 606 | 606 | return; |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
| 610 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 609 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
| 610 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 611 | 611 | |
| 612 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
| 612 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
| 613 | 613 | |
| 614 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
| 614 | + echo apply_filters('give_display_checkout_button', $output); |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
| 617 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
| 618 | 618 | |
| 619 | 619 | /** |
| 620 | 620 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -625,57 +625,57 @@ discard block |
||
| 625 | 625 | * |
| 626 | 626 | * @return void |
| 627 | 627 | */ |
| 628 | -function give_user_info_fields( $form_id ) { |
|
| 628 | +function give_user_info_fields($form_id) { |
|
| 629 | 629 | // Get user info. |
| 630 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 630 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 631 | 631 | |
| 632 | 632 | /** |
| 633 | 633 | * Fire before user personal information fields |
| 634 | 634 | * |
| 635 | 635 | * @since 1.7 |
| 636 | 636 | */ |
| 637 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
| 637 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
| 638 | 638 | ?> |
| 639 | 639 | <fieldset id="give_checkout_user_info"> |
| 640 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
| 640 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
| 641 | 641 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
| 642 | 642 | <label class="give-label" for="give-first"> |
| 643 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
| 644 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
| 643 | + <?php esc_html_e('First Name', 'give'); ?> |
|
| 644 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
| 645 | 645 | <span class="give-required-indicator">*</span> |
| 646 | 646 | <?php endif ?> |
| 647 | 647 | <span class="give-tooltip give-icon give-icon-question" |
| 648 | - data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
| 648 | + data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
| 649 | 649 | </label> |
| 650 | 650 | <input |
| 651 | 651 | class="give-input required" |
| 652 | 652 | type="text" |
| 653 | 653 | name="give_first" |
| 654 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
| 654 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
| 655 | 655 | id="give-first" |
| 656 | - value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>" |
|
| 657 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 656 | + value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>" |
|
| 657 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 658 | 658 | /> |
| 659 | 659 | </p> |
| 660 | 660 | |
| 661 | 661 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
| 662 | 662 | <label class="give-label" for="give-last"> |
| 663 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
| 664 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
| 663 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
| 664 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
| 665 | 665 | <span class="give-required-indicator">*</span> |
| 666 | 666 | <?php endif ?> |
| 667 | 667 | <span class="give-tooltip give-icon give-icon-question" |
| 668 | - data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
| 668 | + data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
| 669 | 669 | </label> |
| 670 | 670 | |
| 671 | 671 | <input |
| 672 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
| 672 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
| 673 | 673 | type="text" |
| 674 | 674 | name="give_last" |
| 675 | 675 | id="give-last" |
| 676 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
| 677 | - value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>" |
|
| 678 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 676 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
| 677 | + value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>" |
|
| 678 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 679 | 679 | /> |
| 680 | 680 | </p> |
| 681 | 681 | |
@@ -685,26 +685,26 @@ discard block |
||
| 685 | 685 | * |
| 686 | 686 | * @since 1.7 |
| 687 | 687 | */ |
| 688 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
| 688 | + do_action('give_donation_form_before_email', $form_id); |
|
| 689 | 689 | ?> |
| 690 | 690 | <p id="give-email-wrap" class="form-row form-row-wide"> |
| 691 | 691 | <label class="give-label" for="give-email"> |
| 692 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
| 693 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
| 692 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
| 693 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
| 694 | 694 | <span class="give-required-indicator">*</span> |
| 695 | 695 | <?php } ?> |
| 696 | 696 | <span class="give-tooltip give-icon give-icon-question" |
| 697 | - data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
| 697 | + data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
| 698 | 698 | </label> |
| 699 | 699 | |
| 700 | 700 | <input |
| 701 | 701 | class="give-input required" |
| 702 | 702 | type="email" |
| 703 | 703 | name="give_email" |
| 704 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
| 704 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
| 705 | 705 | id="give-email" |
| 706 | - value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>" |
|
| 707 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 706 | + value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>" |
|
| 707 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 708 | 708 | /> |
| 709 | 709 | |
| 710 | 710 | </p> |
@@ -714,14 +714,14 @@ discard block |
||
| 714 | 714 | * |
| 715 | 715 | * @since 1.7 |
| 716 | 716 | */ |
| 717 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
| 717 | + do_action('give_donation_form_after_email', $form_id); |
|
| 718 | 718 | |
| 719 | 719 | /** |
| 720 | 720 | * Fire after personal email field |
| 721 | 721 | * |
| 722 | 722 | * @since 1.7 |
| 723 | 723 | */ |
| 724 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 724 | + do_action('give_donation_form_user_info', $form_id); |
|
| 725 | 725 | ?> |
| 726 | 726 | </fieldset> |
| 727 | 727 | <?php |
@@ -730,11 +730,11 @@ discard block |
||
| 730 | 730 | * |
| 731 | 731 | * @since 1.7 |
| 732 | 732 | */ |
| 733 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
| 733 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
| 734 | 734 | } |
| 735 | 735 | |
| 736 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
| 737 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
| 736 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
| 737 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
| 738 | 738 | |
| 739 | 739 | /** |
| 740 | 740 | * Renders the credit card info form. |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | * |
| 746 | 746 | * @return void |
| 747 | 747 | */ |
| 748 | -function give_get_cc_form( $form_id ) { |
|
| 748 | +function give_get_cc_form($form_id) { |
|
| 749 | 749 | |
| 750 | 750 | ob_start(); |
| 751 | 751 | |
@@ -756,53 +756,53 @@ discard block |
||
| 756 | 756 | * |
| 757 | 757 | * @param int $form_id The form ID. |
| 758 | 758 | */ |
| 759 | - do_action( 'give_before_cc_fields', $form_id ); |
|
| 759 | + do_action('give_before_cc_fields', $form_id); |
|
| 760 | 760 | ?> |
| 761 | 761 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
| 762 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
| 763 | - <?php if ( is_ssl() ) : ?> |
|
| 762 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
| 763 | + <?php if (is_ssl()) : ?> |
|
| 764 | 764 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
| 765 | 765 | <span class="give-icon padlock"></span> |
| 766 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
| 766 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
| 767 | 767 | </div> |
| 768 | 768 | <?php endif; ?> |
| 769 | 769 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
| 770 | 770 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
| 771 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
| 771 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
| 772 | 772 | <span class="give-required-indicator">*</span> |
| 773 | 773 | <span class="give-tooltip give-icon give-icon-question" |
| 774 | - data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
| 774 | + data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
| 775 | 775 | <span class="card-type"></span> |
| 776 | 776 | </label> |
| 777 | 777 | |
| 778 | 778 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
| 779 | - class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" |
|
| 779 | + class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" |
|
| 780 | 780 | required aria-required="true"/> |
| 781 | 781 | </p> |
| 782 | 782 | |
| 783 | 783 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
| 784 | 784 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
| 785 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
| 785 | + <?php esc_html_e('CVC', 'give'); ?> |
|
| 786 | 786 | <span class="give-required-indicator">*</span> |
| 787 | 787 | <span class="give-tooltip give-icon give-icon-question" |
| 788 | - data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
| 788 | + data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
| 789 | 789 | </label> |
| 790 | 790 | |
| 791 | 791 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
| 792 | - class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" |
|
| 792 | + class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" |
|
| 793 | 793 | required aria-required="true"/> |
| 794 | 794 | </p> |
| 795 | 795 | |
| 796 | 796 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
| 797 | 797 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
| 798 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
| 798 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
| 799 | 799 | <span class="give-required-indicator">*</span> |
| 800 | 800 | <span class="give-tooltip give-icon give-icon-question" |
| 801 | - data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
| 801 | + data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
| 802 | 802 | </label> |
| 803 | 803 | |
| 804 | 804 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
| 805 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
| 805 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
| 806 | 806 | required aria-required="true"/> |
| 807 | 807 | </p> |
| 808 | 808 | <?php |
@@ -813,14 +813,14 @@ discard block |
||
| 813 | 813 | * |
| 814 | 814 | * @param int $form_id The form ID. |
| 815 | 815 | */ |
| 816 | - do_action( 'give_before_cc_expiration' ); |
|
| 816 | + do_action('give_before_cc_expiration'); |
|
| 817 | 817 | ?> |
| 818 | 818 | <p class="card-expiration form-row form-row-one-third"> |
| 819 | 819 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
| 820 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
| 820 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
| 821 | 821 | <span class="give-required-indicator">*</span> |
| 822 | 822 | <span class="give-tooltip give-icon give-icon-question" |
| 823 | - data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
| 823 | + data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
| 824 | 824 | </label> |
| 825 | 825 | |
| 826 | 826 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | class="card-expiry-year"/> |
| 830 | 830 | |
| 831 | 831 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" |
| 832 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
| 832 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
| 833 | 833 | required aria-required="true"/> |
| 834 | 834 | </p> |
| 835 | 835 | <?php |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | * |
| 841 | 841 | * @param int $form_id The form ID. |
| 842 | 842 | */ |
| 843 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
| 843 | + do_action('give_after_cc_expiration', $form_id); |
|
| 844 | 844 | ?> |
| 845 | 845 | </fieldset> |
| 846 | 846 | <?php |
@@ -851,12 +851,12 @@ discard block |
||
| 851 | 851 | * |
| 852 | 852 | * @param int $form_id The form ID. |
| 853 | 853 | */ |
| 854 | - do_action( 'give_after_cc_fields', $form_id ); |
|
| 854 | + do_action('give_after_cc_fields', $form_id); |
|
| 855 | 855 | |
| 856 | 856 | echo ob_get_clean(); |
| 857 | 857 | } |
| 858 | 858 | |
| 859 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
| 859 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
| 860 | 860 | |
| 861 | 861 | /** |
| 862 | 862 | * Outputs the default credit card address fields. |
@@ -867,24 +867,24 @@ discard block |
||
| 867 | 867 | * |
| 868 | 868 | * @return void |
| 869 | 869 | */ |
| 870 | -function give_default_cc_address_fields( $form_id ) { |
|
| 870 | +function give_default_cc_address_fields($form_id) { |
|
| 871 | 871 | // Get user info. |
| 872 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 872 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 873 | 873 | |
| 874 | 874 | $logged_in = is_user_logged_in(); |
| 875 | 875 | |
| 876 | - if ( $logged_in ) { |
|
| 877 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
| 876 | + if ($logged_in) { |
|
| 877 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
| 878 | 878 | } |
| 879 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
| 880 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
| 881 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
| 882 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
| 879 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
| 880 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
| 881 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
| 882 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
| 883 | 883 | |
| 884 | 884 | ob_start(); |
| 885 | 885 | ?> |
| 886 | 886 | <fieldset id="give_cc_address" class="cc-address"> |
| 887 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
| 887 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
| 888 | 888 | <?php |
| 889 | 889 | /** |
| 890 | 890 | * Fires while rendering credit card billing form, before address fields. |
@@ -893,79 +893,79 @@ discard block |
||
| 893 | 893 | * |
| 894 | 894 | * @param int $form_id The form ID. |
| 895 | 895 | */ |
| 896 | - do_action( 'give_cc_billing_top' ); |
|
| 896 | + do_action('give_cc_billing_top'); |
|
| 897 | 897 | ?> |
| 898 | 898 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
| 899 | 899 | <label for="card_address" class="give-label"> |
| 900 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
| 900 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
| 901 | 901 | <?php |
| 902 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
| 902 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
| 903 | 903 | <span class="give-required-indicator">*</span> |
| 904 | 904 | <?php endif; ?> |
| 905 | 905 | <span class="give-tooltip give-icon give-icon-question" |
| 906 | - data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
| 906 | + data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
| 907 | 907 | </label> |
| 908 | 908 | |
| 909 | 909 | <input |
| 910 | 910 | type="text" |
| 911 | 911 | id="card_address" |
| 912 | 912 | name="card_address" |
| 913 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
| 914 | - placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" |
|
| 915 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
| 916 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 913 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
| 914 | + placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" |
|
| 915 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
| 916 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 917 | 917 | /> |
| 918 | 918 | </p> |
| 919 | 919 | |
| 920 | 920 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
| 921 | 921 | <label for="card_address_2" class="give-label"> |
| 922 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
| 923 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
| 922 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
| 923 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
| 924 | 924 | <span class="give-required-indicator">*</span> |
| 925 | 925 | <?php endif; ?> |
| 926 | 926 | <span class="give-tooltip give-icon give-icon-question" |
| 927 | - data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
| 927 | + data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
| 928 | 928 | </label> |
| 929 | 929 | |
| 930 | 930 | <input |
| 931 | 931 | type="text" |
| 932 | 932 | id="card_address_2" |
| 933 | 933 | name="card_address_2" |
| 934 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
| 935 | - placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" |
|
| 936 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 937 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 934 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
| 935 | + placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" |
|
| 936 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 937 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 938 | 938 | /> |
| 939 | 939 | </p> |
| 940 | 940 | |
| 941 | 941 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
| 942 | 942 | <label for="card_city" class="give-label"> |
| 943 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
| 944 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
| 943 | + <?php esc_html_e('City', 'give'); ?> |
|
| 944 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
| 945 | 945 | <span class="give-required-indicator">*</span> |
| 946 | 946 | <?php endif; ?> |
| 947 | 947 | <span class="give-tooltip give-icon give-icon-question" |
| 948 | - data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
| 948 | + data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
| 949 | 949 | </label> |
| 950 | 950 | <input |
| 951 | 951 | type="text" |
| 952 | 952 | id="card_city" |
| 953 | 953 | name="card_city" |
| 954 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
| 955 | - placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" |
|
| 956 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
| 957 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 954 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
| 955 | + placeholder="<?php esc_attr_e('City', 'give'); ?>" |
|
| 956 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
| 957 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 958 | 958 | /> |
| 959 | 959 | </p> |
| 960 | 960 | |
| 961 | 961 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
| 962 | 962 | <label for="card_zip" class="give-label"> |
| 963 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
| 964 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
| 963 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
| 964 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
| 965 | 965 | <span class="give-required-indicator">*</span> |
| 966 | 966 | <?php endif; ?> |
| 967 | 967 | <span class="give-tooltip give-icon give-icon-question" |
| 968 | - data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
| 968 | + data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
| 969 | 969 | </label> |
| 970 | 970 | |
| 971 | 971 | <input |
@@ -973,40 +973,40 @@ discard block |
||
| 973 | 973 | size="4" |
| 974 | 974 | id="card_zip" |
| 975 | 975 | name="card_zip" |
| 976 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
| 977 | - placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" |
|
| 978 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 979 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 976 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
| 977 | + placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" |
|
| 978 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 979 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 980 | 980 | /> |
| 981 | 981 | </p> |
| 982 | 982 | |
| 983 | 983 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
| 984 | 984 | <label for="billing_country" class="give-label"> |
| 985 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
| 986 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
| 985 | + <?php esc_html_e('Country', 'give'); ?> |
|
| 986 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
| 987 | 987 | <span class="give-required-indicator">*</span> |
| 988 | 988 | <?php endif; ?> |
| 989 | 989 | <span class="give-tooltip give-icon give-icon-question" |
| 990 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
| 990 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
| 991 | 991 | </label> |
| 992 | 992 | |
| 993 | 993 | <select |
| 994 | 994 | name="billing_country" |
| 995 | 995 | id="billing_country" |
| 996 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
| 997 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 996 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
| 997 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 998 | 998 | > |
| 999 | 999 | <?php |
| 1000 | 1000 | |
| 1001 | 1001 | $selected_country = give_get_country(); |
| 1002 | 1002 | |
| 1003 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
| 1003 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
| 1004 | 1004 | $selected_country = $give_user_info['billing_country']; |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | $countries = give_get_country_list(); |
| 1008 | - foreach ( $countries as $country_code => $country ) { |
|
| 1009 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 1008 | + foreach ($countries as $country_code => $country) { |
|
| 1009 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 1010 | 1010 | } |
| 1011 | 1011 | ?> |
| 1012 | 1012 | </select> |
@@ -1014,39 +1014,39 @@ discard block |
||
| 1014 | 1014 | |
| 1015 | 1015 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
| 1016 | 1016 | <label for="card_state" class="give-label"> |
| 1017 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
| 1018 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?> |
|
| 1017 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
| 1018 | + <?php if (give_field_is_required('card_state', $form_id)) : ?> |
|
| 1019 | 1019 | <span class="give-required-indicator">*</span> |
| 1020 | 1020 | <?php endif; ?> |
| 1021 | 1021 | <span class="give-tooltip give-icon give-icon-question" |
| 1022 | - data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
| 1022 | + data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
| 1023 | 1023 | </label> |
| 1024 | 1024 | |
| 1025 | 1025 | <?php |
| 1026 | 1026 | $selected_state = give_get_state(); |
| 1027 | - $states = give_get_states( $selected_country ); |
|
| 1027 | + $states = give_get_states($selected_country); |
|
| 1028 | 1028 | |
| 1029 | - if ( ! empty( $give_user_info['card_state'] ) ) { |
|
| 1029 | + if ( ! empty($give_user_info['card_state'])) { |
|
| 1030 | 1030 | $selected_state = $give_user_info['card_state']; |
| 1031 | 1031 | } |
| 1032 | 1032 | |
| 1033 | - if ( ! empty( $states ) ) : ?> |
|
| 1033 | + if ( ! empty($states)) : ?> |
|
| 1034 | 1034 | <select |
| 1035 | 1035 | name="card_state" |
| 1036 | 1036 | id="card_state" |
| 1037 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
| 1038 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ) { |
|
| 1037 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
| 1038 | + <?php if (give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : '') { |
|
| 1039 | 1039 | ; |
| 1040 | 1040 | } ?>> |
| 1041 | 1041 | <?php |
| 1042 | - foreach ( $states as $state_code => $state ) { |
|
| 1043 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 1042 | + foreach ($states as $state_code => $state) { |
|
| 1043 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 1044 | 1044 | } |
| 1045 | 1045 | ?> |
| 1046 | 1046 | </select> |
| 1047 | 1047 | <?php else : ?> |
| 1048 | 1048 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
| 1049 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
| 1049 | + placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
| 1050 | 1050 | <?php endif; ?> |
| 1051 | 1051 | </p> |
| 1052 | 1052 | <?php |
@@ -1057,14 +1057,14 @@ discard block |
||
| 1057 | 1057 | * |
| 1058 | 1058 | * @param int $form_id The form ID. |
| 1059 | 1059 | */ |
| 1060 | - do_action( 'give_cc_billing_bottom' ); |
|
| 1060 | + do_action('give_cc_billing_bottom'); |
|
| 1061 | 1061 | ?> |
| 1062 | 1062 | </fieldset> |
| 1063 | 1063 | <?php |
| 1064 | 1064 | echo ob_get_clean(); |
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
| 1067 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
| 1068 | 1068 | |
| 1069 | 1069 | |
| 1070 | 1070 | /** |
@@ -1076,27 +1076,27 @@ discard block |
||
| 1076 | 1076 | * |
| 1077 | 1077 | * @return string |
| 1078 | 1078 | */ |
| 1079 | -function give_get_register_fields( $form_id ) { |
|
| 1079 | +function give_get_register_fields($form_id) { |
|
| 1080 | 1080 | |
| 1081 | 1081 | global $user_ID; |
| 1082 | 1082 | |
| 1083 | - if ( is_user_logged_in() ) { |
|
| 1084 | - $user_data = get_userdata( $user_ID ); |
|
| 1083 | + if (is_user_logged_in()) { |
|
| 1084 | + $user_data = get_userdata($user_ID); |
|
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1087 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1088 | 1088 | |
| 1089 | 1089 | ob_start(); ?> |
| 1090 | 1090 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
| 1091 | 1091 | |
| 1092 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1092 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1093 | 1093 | <div class="give-login-account-wrap"> |
| 1094 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
| 1095 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
| 1096 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
| 1094 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
| 1095 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
| 1096 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
| 1097 | 1097 | </p> |
| 1098 | 1098 | <p class="give-loading-text"> |
| 1099 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p> |
|
| 1099 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p> |
|
| 1100 | 1100 | </div> |
| 1101 | 1101 | <?php } ?> |
| 1102 | 1102 | |
@@ -1108,15 +1108,15 @@ discard block |
||
| 1108 | 1108 | * |
| 1109 | 1109 | * @param int $form_id The form ID. |
| 1110 | 1110 | */ |
| 1111 | - do_action( 'give_register_fields_before', $form_id ); |
|
| 1111 | + do_action('give_register_fields_before', $form_id); |
|
| 1112 | 1112 | ?> |
| 1113 | 1113 | |
| 1114 | 1114 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
| 1115 | 1115 | <legend> |
| 1116 | 1116 | <?php |
| 1117 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
| 1118 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1119 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1117 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
| 1118 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1119 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1120 | 1120 | } |
| 1121 | 1121 | ?> |
| 1122 | 1122 | </legend> |
@@ -1128,52 +1128,52 @@ discard block |
||
| 1128 | 1128 | * |
| 1129 | 1129 | * @param int $form_id The form ID. |
| 1130 | 1130 | */ |
| 1131 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
| 1131 | + do_action('give_register_account_fields_before', $form_id); |
|
| 1132 | 1132 | ?> |
| 1133 | 1133 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
| 1134 | 1134 | <label for="give-user-login-<?php echo $form_id; ?>"> |
| 1135 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1136 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1135 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1136 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1137 | 1137 | <span class="give-required-indicator">*</span> |
| 1138 | 1138 | <?php } ?> |
| 1139 | 1139 | <span class="give-tooltip give-icon give-icon-question" |
| 1140 | - data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
| 1140 | + data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
| 1141 | 1141 | </label> |
| 1142 | 1142 | |
| 1143 | 1143 | <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" |
| 1144 | 1144 | type="text" |
| 1145 | - placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1145 | + placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1146 | 1146 | </div> |
| 1147 | 1147 | |
| 1148 | 1148 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
| 1149 | 1149 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
| 1150 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1151 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1150 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1151 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1152 | 1152 | <span class="give-required-indicator">*</span> |
| 1153 | 1153 | <?php } ?> |
| 1154 | 1154 | <span class="give-tooltip give-icon give-icon-question" |
| 1155 | - data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
| 1155 | + data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
| 1156 | 1156 | </label> |
| 1157 | 1157 | |
| 1158 | 1158 | <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" |
| 1159 | - placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" |
|
| 1160 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1159 | + placeholder="<?php esc_attr_e('Password', 'give'); ?>" |
|
| 1160 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1161 | 1161 | </div> |
| 1162 | 1162 | |
| 1163 | 1163 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" |
| 1164 | 1164 | class="give-register-password form-row form-row-one-third"> |
| 1165 | 1165 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
| 1166 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
| 1167 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1166 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
| 1167 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1168 | 1168 | <span class="give-required-indicator">*</span> |
| 1169 | 1169 | <?php } ?> |
| 1170 | 1170 | <span class="give-tooltip give-icon give-icon-question" |
| 1171 | - data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
| 1171 | + data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
| 1172 | 1172 | </label> |
| 1173 | 1173 | |
| 1174 | 1174 | <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" |
| 1175 | - class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" |
|
| 1176 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1175 | + class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" |
|
| 1176 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1177 | 1177 | </div> |
| 1178 | 1178 | <?php |
| 1179 | 1179 | /** |
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | * |
| 1184 | 1184 | * @param int $form_id The form ID. |
| 1185 | 1185 | */ |
| 1186 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
| 1186 | + do_action('give_register_account_fields_after', $form_id); |
|
| 1187 | 1187 | ?> |
| 1188 | 1188 | </fieldset> |
| 1189 | 1189 | |
@@ -1195,7 +1195,7 @@ discard block |
||
| 1195 | 1195 | * |
| 1196 | 1196 | * @param int $form_id The form ID. |
| 1197 | 1197 | */ |
| 1198 | - do_action( 'give_register_fields_after', $form_id ); |
|
| 1198 | + do_action('give_register_fields_after', $form_id); |
|
| 1199 | 1199 | ?> |
| 1200 | 1200 | |
| 1201 | 1201 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1206,7 +1206,7 @@ discard block |
||
| 1206 | 1206 | * |
| 1207 | 1207 | * @since 1.7 |
| 1208 | 1208 | */ |
| 1209 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 1209 | + do_action('give_donation_form_user_info', $form_id); |
|
| 1210 | 1210 | ?> |
| 1211 | 1211 | |
| 1212 | 1212 | </fieldset> |
@@ -1214,7 +1214,7 @@ discard block |
||
| 1214 | 1214 | echo ob_get_clean(); |
| 1215 | 1215 | } |
| 1216 | 1216 | |
| 1217 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
| 1217 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
| 1218 | 1218 | |
| 1219 | 1219 | /** |
| 1220 | 1220 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1227,32 +1227,32 @@ discard block |
||
| 1227 | 1227 | * |
| 1228 | 1228 | * @return string |
| 1229 | 1229 | */ |
| 1230 | -function give_get_login_fields( $form_id ) { |
|
| 1230 | +function give_get_login_fields($form_id) { |
|
| 1231 | 1231 | |
| 1232 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
| 1233 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1232 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
| 1233 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1234 | 1234 | |
| 1235 | 1235 | ob_start(); |
| 1236 | 1236 | ?> |
| 1237 | 1237 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
| 1238 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
| 1239 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1240 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1238 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
| 1239 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1240 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1241 | 1241 | } ?> |
| 1242 | 1242 | </legend> |
| 1243 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1243 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1244 | 1244 | <p class="give-new-account-link"> |
| 1245 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
| 1246 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
| 1245 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
| 1246 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
| 1247 | 1247 | data-action="give_checkout_register"> |
| 1248 | - <?php esc_html_e( 'Register', 'give' ); |
|
| 1249 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1250 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
| 1248 | + <?php esc_html_e('Register', 'give'); |
|
| 1249 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1250 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
| 1251 | 1251 | } ?> |
| 1252 | 1252 | </a> |
| 1253 | 1253 | </p> |
| 1254 | 1254 | <p class="give-loading-text"> |
| 1255 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p> |
|
| 1255 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p> |
|
| 1256 | 1256 | <?php } ?> |
| 1257 | 1257 | <?php |
| 1258 | 1258 | /** |
@@ -1262,48 +1262,48 @@ discard block |
||
| 1262 | 1262 | * |
| 1263 | 1263 | * @param int $form_id The form ID. |
| 1264 | 1264 | */ |
| 1265 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
| 1265 | + do_action('give_checkout_login_fields_before', $form_id); |
|
| 1266 | 1266 | ?> |
| 1267 | 1267 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
| 1268 | 1268 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
| 1269 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1270 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1269 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1270 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1271 | 1271 | <span class="give-required-indicator">*</span> |
| 1272 | 1272 | <?php } ?> |
| 1273 | 1273 | </label> |
| 1274 | 1274 | |
| 1275 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
| 1275 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
| 1276 | 1276 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
| 1277 | - placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1277 | + placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1278 | 1278 | </div> |
| 1279 | 1279 | |
| 1280 | 1280 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
| 1281 | 1281 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
| 1282 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1283 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1282 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1283 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1284 | 1284 | <span class="give-required-indicator">*</span> |
| 1285 | 1285 | <?php } ?> |
| 1286 | 1286 | </label> |
| 1287 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
| 1287 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
| 1288 | 1288 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
| 1289 | - placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1289 | + placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1290 | 1290 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
| 1291 | 1291 | </div> |
| 1292 | 1292 | |
| 1293 | 1293 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
| 1294 | 1294 | <span class="give-forgot-password "> |
| 1295 | 1295 | <a href="<?php echo wp_lostpassword_url() ?>" |
| 1296 | - target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
| 1296 | + target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
| 1297 | 1297 | </span> |
| 1298 | 1298 | </div> |
| 1299 | 1299 | |
| 1300 | 1300 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
| 1301 | 1301 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
| 1302 | - value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
| 1303 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
| 1302 | + value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
| 1303 | + <?php if ($show_register_form !== 'login') { ?> |
|
| 1304 | 1304 | <input type="button" data-action="give_cancel_login" |
| 1305 | 1305 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
| 1306 | - value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
| 1306 | + value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
| 1307 | 1307 | <?php } ?> |
| 1308 | 1308 | <span class="give-loading-animation"></span> |
| 1309 | 1309 | </div> |
@@ -1315,14 +1315,14 @@ discard block |
||
| 1315 | 1315 | * |
| 1316 | 1316 | * @param int $form_id The form ID. |
| 1317 | 1317 | */ |
| 1318 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
| 1318 | + do_action('give_checkout_login_fields_after', $form_id); |
|
| 1319 | 1319 | ?> |
| 1320 | 1320 | </fieldset><!--end #give-login-fields--> |
| 1321 | 1321 | <?php |
| 1322 | 1322 | echo ob_get_clean(); |
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
| 1325 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
| 1326 | 1326 | |
| 1327 | 1327 | /** |
| 1328 | 1328 | * Payment Mode Select. |
@@ -1338,7 +1338,7 @@ discard block |
||
| 1338 | 1338 | * |
| 1339 | 1339 | * @return void |
| 1340 | 1340 | */ |
| 1341 | -function give_payment_mode_select( $form_id ) { |
|
| 1341 | +function give_payment_mode_select($form_id) { |
|
| 1342 | 1342 | |
| 1343 | 1343 | $gateways = give_get_enabled_payment_gateways(); |
| 1344 | 1344 | |
@@ -1349,10 +1349,10 @@ discard block |
||
| 1349 | 1349 | * |
| 1350 | 1350 | * @param int $form_id The form ID. |
| 1351 | 1351 | */ |
| 1352 | - do_action( 'give_payment_mode_top', $form_id ); |
|
| 1352 | + do_action('give_payment_mode_top', $form_id); |
|
| 1353 | 1353 | ?> |
| 1354 | 1354 | |
| 1355 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
| 1355 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
| 1356 | 1356 | echo 'style="display: none;"'; |
| 1357 | 1357 | } ?>> |
| 1358 | 1358 | <?php |
@@ -1363,14 +1363,14 @@ discard block |
||
| 1363 | 1363 | * |
| 1364 | 1364 | * @param int $form_id The form ID. |
| 1365 | 1365 | */ |
| 1366 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
| 1366 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
| 1367 | 1367 | ?> |
| 1368 | 1368 | <legend |
| 1369 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?></legend> |
|
| 1369 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?></legend> |
|
| 1370 | 1370 | |
| 1371 | 1371 | <div id="give-payment-mode-wrap"> |
| 1372 | 1372 | <span class="give-loading-text"><span |
| 1373 | - class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span> |
|
| 1373 | + class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span> |
|
| 1374 | 1374 | |
| 1375 | 1375 | <?php |
| 1376 | 1376 | /** |
@@ -1378,26 +1378,26 @@ discard block |
||
| 1378 | 1378 | * |
| 1379 | 1379 | * @since 1.7 |
| 1380 | 1380 | */ |
| 1381 | - do_action( 'give_payment_mode_before_gateways' ) |
|
| 1381 | + do_action('give_payment_mode_before_gateways') |
|
| 1382 | 1382 | ?> |
| 1383 | 1383 | <ul id="give-gateway-radio-list"> |
| 1384 | 1384 | <?php |
| 1385 | 1385 | /** |
| 1386 | 1386 | * Loop through the active payment gateways. |
| 1387 | 1387 | */ |
| 1388 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
| 1388 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
| 1389 | 1389 | |
| 1390 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
| 1390 | + foreach ($gateways as $gateway_id => $gateway) : |
|
| 1391 | 1391 | //Determine the default gateway. |
| 1392 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
| 1392 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
| 1393 | 1393 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?> |
| 1394 | 1394 | <li<?php echo $checked_class?>> |
| 1395 | 1395 | <input type="radio" name="payment-mode" class="give-gateway" |
| 1396 | - id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1397 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
| 1398 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1396 | + id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1397 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
| 1398 | + <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1399 | 1399 | class="give-gateway-option" |
| 1400 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label> |
|
| 1400 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label> |
|
| 1401 | 1401 | </li> |
| 1402 | 1402 | <?php |
| 1403 | 1403 | endforeach; |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | * |
| 1410 | 1410 | * @since 1.7 |
| 1411 | 1411 | */ |
| 1412 | - do_action( 'give_payment_mode_after_gateways' ); |
|
| 1412 | + do_action('give_payment_mode_after_gateways'); |
|
| 1413 | 1413 | ?> |
| 1414 | 1414 | </div> |
| 1415 | 1415 | <?php |
@@ -1420,7 +1420,7 @@ discard block |
||
| 1420 | 1420 | * |
| 1421 | 1421 | * @param int $form_id The form ID. |
| 1422 | 1422 | */ |
| 1423 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
| 1423 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
| 1424 | 1424 | ?> |
| 1425 | 1425 | </fieldset> |
| 1426 | 1426 | |
@@ -1432,7 +1432,7 @@ discard block |
||
| 1432 | 1432 | * |
| 1433 | 1433 | * @param int $form_id The form ID. |
| 1434 | 1434 | */ |
| 1435 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
| 1435 | + do_action('give_payment_mode_bottom', $form_id); |
|
| 1436 | 1436 | ?> |
| 1437 | 1437 | |
| 1438 | 1438 | <div id="give_purchase_form_wrap"> |
@@ -1443,7 +1443,7 @@ discard block |
||
| 1443 | 1443 | * |
| 1444 | 1444 | * @since 1.7 |
| 1445 | 1445 | */ |
| 1446 | - do_action( 'give_donation_form', $form_id ); |
|
| 1446 | + do_action('give_donation_form', $form_id); |
|
| 1447 | 1447 | ?> |
| 1448 | 1448 | |
| 1449 | 1449 | </div> |
@@ -1454,10 +1454,10 @@ discard block |
||
| 1454 | 1454 | * |
| 1455 | 1455 | * @since 1.7 |
| 1456 | 1456 | */ |
| 1457 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
| 1457 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
| 1458 | 1458 | } |
| 1459 | 1459 | |
| 1460 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
| 1460 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
| 1461 | 1461 | |
| 1462 | 1462 | /** |
| 1463 | 1463 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1470,25 +1470,25 @@ discard block |
||
| 1470 | 1470 | * |
| 1471 | 1471 | * @return void|bool |
| 1472 | 1472 | */ |
| 1473 | -function give_terms_agreement( $form_id ) { |
|
| 1474 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1473 | +function give_terms_agreement($form_id) { |
|
| 1474 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1475 | 1475 | |
| 1476 | 1476 | // Bailout if per form and global term and conditions is not setup. |
| 1477 | - if ( 'yes' !== $form_option ) { |
|
| 1477 | + if ('yes' !== $form_option) { |
|
| 1478 | 1478 | return false; |
| 1479 | 1479 | } |
| 1480 | 1480 | |
| 1481 | - $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
| 1482 | - $terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' ); |
|
| 1481 | + $label = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
| 1482 | + $terms = ($terms = get_post_meta($form_id, '_give_agree_text', true)) ? $terms : give_get_option('agreement_text', ''); |
|
| 1483 | 1483 | |
| 1484 | 1484 | // Set term and conditions label and text on basis of per form and global setting. |
| 1485 | 1485 | // $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
| 1486 | 1486 | // $terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' ); |
| 1487 | 1487 | |
| 1488 | 1488 | // Bailout: Check if term and conditions text is empty or not. |
| 1489 | - if ( empty( $terms ) ) { |
|
| 1490 | - if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) { |
|
| 1491 | - echo sprintf( __( 'Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), admin_url( 'post.php?post=' . $form_id . '&action=edit' ) ); |
|
| 1489 | + if (empty($terms)) { |
|
| 1490 | + if (is_user_logged_in() && current_user_can('manage_options')) { |
|
| 1491 | + echo sprintf(__('Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give'), admin_url('post.php?post='.$form_id.'&action=edit')); |
|
| 1492 | 1492 | } |
| 1493 | 1493 | |
| 1494 | 1494 | return false; |
@@ -1496,7 +1496,7 @@ discard block |
||
| 1496 | 1496 | |
| 1497 | 1497 | ?> |
| 1498 | 1498 | <fieldset id="give_terms_agreement"> |
| 1499 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
| 1499 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
| 1500 | 1500 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
| 1501 | 1501 | <?php |
| 1502 | 1502 | /** |
@@ -1504,22 +1504,22 @@ discard block |
||
| 1504 | 1504 | * |
| 1505 | 1505 | * @since 1.0 |
| 1506 | 1506 | */ |
| 1507 | - do_action( 'give_before_terms' ); |
|
| 1507 | + do_action('give_before_terms'); |
|
| 1508 | 1508 | |
| 1509 | - echo wpautop( stripslashes( $terms ) ); |
|
| 1509 | + echo wpautop(stripslashes($terms)); |
|
| 1510 | 1510 | /** |
| 1511 | 1511 | * Fires while rendering terms of agreement, after the fields. |
| 1512 | 1512 | * |
| 1513 | 1513 | * @since 1.0 |
| 1514 | 1514 | */ |
| 1515 | - do_action( 'give_after_terms' ); |
|
| 1515 | + do_action('give_after_terms'); |
|
| 1516 | 1516 | ?> |
| 1517 | 1517 | </div> |
| 1518 | 1518 | <div id="give_show_terms"> |
| 1519 | 1519 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1520 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
| 1520 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
| 1521 | 1521 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1522 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
| 1522 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
| 1523 | 1523 | </div> |
| 1524 | 1524 | |
| 1525 | 1525 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms-<?php echo $form_id; ?>" value="1" required aria-required="true" /> |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | <?php |
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
| 1532 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
| 1533 | 1533 | |
| 1534 | 1534 | /** |
| 1535 | 1535 | * Checkout Final Total. |
@@ -1542,29 +1542,29 @@ discard block |
||
| 1542 | 1542 | * |
| 1543 | 1543 | * @return void |
| 1544 | 1544 | */ |
| 1545 | -function give_checkout_final_total( $form_id ) { |
|
| 1545 | +function give_checkout_final_total($form_id) { |
|
| 1546 | 1546 | |
| 1547 | - if ( isset( $_POST['give_total'] ) ) { |
|
| 1548 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
| 1547 | + if (isset($_POST['give_total'])) { |
|
| 1548 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
| 1549 | 1549 | } else { |
| 1550 | 1550 | //default total. |
| 1551 | - $total = give_get_default_form_amount( $form_id ); |
|
| 1551 | + $total = give_get_default_form_amount($form_id); |
|
| 1552 | 1552 | } |
| 1553 | 1553 | //Only proceed if give_total available. |
| 1554 | - if ( empty( $total ) ) { |
|
| 1554 | + if (empty($total)) { |
|
| 1555 | 1555 | return; |
| 1556 | 1556 | } |
| 1557 | 1557 | ?> |
| 1558 | 1558 | <p id="give-final-total-wrap" class="form-wrap "> |
| 1559 | 1559 | <span |
| 1560 | - class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
| 1560 | + class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
| 1561 | 1561 | <span class="give-final-total-amount" |
| 1562 | - data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
| 1562 | + data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
| 1563 | 1563 | </p> |
| 1564 | 1564 | <?php |
| 1565 | 1565 | } |
| 1566 | 1566 | |
| 1567 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
| 1567 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
| 1568 | 1568 | |
| 1569 | 1569 | /** |
| 1570 | 1570 | * Renders the Checkout Submit section. |
@@ -1575,7 +1575,7 @@ discard block |
||
| 1575 | 1575 | * |
| 1576 | 1576 | * @return void |
| 1577 | 1577 | */ |
| 1578 | -function give_checkout_submit( $form_id ) { |
|
| 1578 | +function give_checkout_submit($form_id) { |
|
| 1579 | 1579 | ?> |
| 1580 | 1580 | <fieldset id="give_purchase_submit"> |
| 1581 | 1581 | <?php |
@@ -1584,24 +1584,24 @@ discard block |
||
| 1584 | 1584 | * |
| 1585 | 1585 | * @since 1.7 |
| 1586 | 1586 | */ |
| 1587 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
| 1587 | + do_action('give_donation_form_before_submit', $form_id); |
|
| 1588 | 1588 | |
| 1589 | - give_checkout_hidden_fields( $form_id ); |
|
| 1589 | + give_checkout_hidden_fields($form_id); |
|
| 1590 | 1590 | |
| 1591 | - echo give_checkout_button_purchase( $form_id ); |
|
| 1591 | + echo give_checkout_button_purchase($form_id); |
|
| 1592 | 1592 | |
| 1593 | 1593 | /** |
| 1594 | 1594 | * Fire after donation form submit. |
| 1595 | 1595 | * |
| 1596 | 1596 | * @since 1.7 |
| 1597 | 1597 | */ |
| 1598 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
| 1598 | + do_action('give_donation_form_after_submit', $form_id); |
|
| 1599 | 1599 | ?> |
| 1600 | 1600 | </fieldset> |
| 1601 | 1601 | <?php |
| 1602 | 1602 | } |
| 1603 | 1603 | |
| 1604 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
| 1604 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
| 1605 | 1605 | |
| 1606 | 1606 | /** |
| 1607 | 1607 | * Give Checkout Button. |
@@ -1614,10 +1614,10 @@ discard block |
||
| 1614 | 1614 | * |
| 1615 | 1615 | * @return string |
| 1616 | 1616 | */ |
| 1617 | -function give_checkout_button_purchase( $form_id ) { |
|
| 1617 | +function give_checkout_button_purchase($form_id) { |
|
| 1618 | 1618 | |
| 1619 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
| 1620 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 1619 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
| 1620 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 1621 | 1621 | ob_start(); ?> |
| 1622 | 1622 | <div class="give-submit-button-wrap give-clearfix"> |
| 1623 | 1623 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" |
@@ -1625,7 +1625,7 @@ discard block |
||
| 1625 | 1625 | <span class="give-loading-animation"></span> |
| 1626 | 1626 | </div> |
| 1627 | 1627 | <?php |
| 1628 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
| 1628 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
| 1629 | 1629 | } |
| 1630 | 1630 | |
| 1631 | 1631 | /** |
@@ -1639,18 +1639,18 @@ discard block |
||
| 1639 | 1639 | * |
| 1640 | 1640 | * @return void |
| 1641 | 1641 | */ |
| 1642 | -function give_agree_to_terms_js( $form_id ) { |
|
| 1642 | +function give_agree_to_terms_js($form_id) { |
|
| 1643 | 1643 | |
| 1644 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1644 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1645 | 1645 | |
| 1646 | - if ( $form_option === 'yes' ) { |
|
| 1646 | + if ($form_option === 'yes') { |
|
| 1647 | 1647 | ?> |
| 1648 | 1648 | <script type="text/javascript"> |
| 1649 | 1649 | jQuery(document).ready(function ($) { |
| 1650 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
| 1650 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
| 1651 | 1651 | e.preventDefault(); |
| 1652 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
| 1653 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
| 1652 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
| 1653 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
| 1654 | 1654 | return false; |
| 1655 | 1655 | }); |
| 1656 | 1656 | }); |
@@ -1659,7 +1659,7 @@ discard block |
||
| 1659 | 1659 | } |
| 1660 | 1660 | } |
| 1661 | 1661 | |
| 1662 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
| 1662 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
| 1663 | 1663 | |
| 1664 | 1664 | /** |
| 1665 | 1665 | * Show Give Goals. |
@@ -1673,17 +1673,17 @@ discard block |
||
| 1673 | 1673 | * |
| 1674 | 1674 | * @return mixed |
| 1675 | 1675 | */ |
| 1676 | -function give_show_goal_progress( $form_id, $args ) { |
|
| 1676 | +function give_show_goal_progress($form_id, $args) { |
|
| 1677 | 1677 | |
| 1678 | 1678 | ob_start(); |
| 1679 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
| 1679 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
| 1680 | 1680 | |
| 1681 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
| 1681 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
| 1682 | 1682 | |
| 1683 | 1683 | return true; |
| 1684 | 1684 | } |
| 1685 | 1685 | |
| 1686 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
| 1686 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
| 1687 | 1687 | |
| 1688 | 1688 | /** |
| 1689 | 1689 | * Adds Actions to Render Form Content. |
@@ -1695,19 +1695,19 @@ discard block |
||
| 1695 | 1695 | * |
| 1696 | 1696 | * @return void |
| 1697 | 1697 | */ |
| 1698 | -function give_form_content( $form_id, $args ) { |
|
| 1698 | +function give_form_content($form_id, $args) { |
|
| 1699 | 1699 | |
| 1700 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
| 1700 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
| 1701 | 1701 | ? $args['show_content'] |
| 1702 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1702 | + : get_post_meta($form_id, '_give_content_option', true); |
|
| 1703 | 1703 | |
| 1704 | - if ( $show_content !== 'none' ) { |
|
| 1704 | + if ($show_content !== 'none') { |
|
| 1705 | 1705 | //add action according to value. |
| 1706 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
| 1706 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
| 1707 | 1707 | } |
| 1708 | 1708 | } |
| 1709 | 1709 | |
| 1710 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
| 1710 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
| 1711 | 1711 | |
| 1712 | 1712 | /** |
| 1713 | 1713 | * Renders Post Form Content. |
@@ -1721,24 +1721,24 @@ discard block |
||
| 1721 | 1721 | * |
| 1722 | 1722 | * @return void |
| 1723 | 1723 | */ |
| 1724 | -function give_form_display_content( $form_id, $args ) { |
|
| 1724 | +function give_form_display_content($form_id, $args) { |
|
| 1725 | 1725 | |
| 1726 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
| 1727 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
| 1726 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
| 1727 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
| 1728 | 1728 | ? $args['show_content'] |
| 1729 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1729 | + : get_post_meta($form_id, '_give_content_option', true); |
|
| 1730 | 1730 | |
| 1731 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
| 1732 | - $content = apply_filters( 'the_content', $content ); |
|
| 1731 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
| 1732 | + $content = apply_filters('the_content', $content); |
|
| 1733 | 1733 | } |
| 1734 | 1734 | |
| 1735 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
| 1735 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
| 1736 | 1736 | |
| 1737 | - echo apply_filters( 'give_form_content_output', $output ); |
|
| 1737 | + echo apply_filters('give_form_content_output', $output); |
|
| 1738 | 1738 | |
| 1739 | 1739 | //remove action to prevent content output on addition forms on page. |
| 1740 | 1740 | //@see: https://github.com/WordImpress/Give/issues/634. |
| 1741 | - remove_action( $show_content, 'give_form_display_content' ); |
|
| 1741 | + remove_action($show_content, 'give_form_display_content'); |
|
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | 1744 | /** |
@@ -1750,7 +1750,7 @@ discard block |
||
| 1750 | 1750 | * |
| 1751 | 1751 | * @return void |
| 1752 | 1752 | */ |
| 1753 | -function give_checkout_hidden_fields( $form_id ) { |
|
| 1753 | +function give_checkout_hidden_fields($form_id) { |
|
| 1754 | 1754 | |
| 1755 | 1755 | /** |
| 1756 | 1756 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1759,13 +1759,13 @@ discard block |
||
| 1759 | 1759 | * |
| 1760 | 1760 | * @param int $form_id The form ID. |
| 1761 | 1761 | */ |
| 1762 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
| 1762 | + do_action('give_hidden_fields_before', $form_id); |
|
| 1763 | 1763 | |
| 1764 | - if ( is_user_logged_in() ) { ?> |
|
| 1764 | + if (is_user_logged_in()) { ?> |
|
| 1765 | 1765 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
| 1766 | 1766 | <?php } ?> |
| 1767 | 1767 | <input type="hidden" name="give_action" value="purchase"/> |
| 1768 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
| 1768 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
| 1769 | 1769 | <?php |
| 1770 | 1770 | /** |
| 1771 | 1771 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1774,7 +1774,7 @@ discard block |
||
| 1774 | 1774 | * |
| 1775 | 1775 | * @param int $form_id The form ID. |
| 1776 | 1776 | */ |
| 1777 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
| 1777 | + do_action('give_hidden_fields_after', $form_id); |
|
| 1778 | 1778 | |
| 1779 | 1779 | } |
| 1780 | 1780 | |
@@ -1789,20 +1789,20 @@ discard block |
||
| 1789 | 1789 | * |
| 1790 | 1790 | * @return string $content Filtered content. |
| 1791 | 1791 | */ |
| 1792 | -function give_filter_success_page_content( $content ) { |
|
| 1792 | +function give_filter_success_page_content($content) { |
|
| 1793 | 1793 | |
| 1794 | 1794 | $give_options = give_get_settings(); |
| 1795 | 1795 | |
| 1796 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
| 1797 | - if ( has_filter( 'give_donation_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
| 1798 | - $content = apply_filters( 'give_donation_confirm_' . $_GET['payment-confirmation'], $content ); |
|
| 1796 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
| 1797 | + if (has_filter('give_donation_confirm_'.$_GET['payment-confirmation'])) { |
|
| 1798 | + $content = apply_filters('give_donation_confirm_'.$_GET['payment-confirmation'], $content); |
|
| 1799 | 1799 | } |
| 1800 | 1800 | } |
| 1801 | 1801 | |
| 1802 | 1802 | return $content; |
| 1803 | 1803 | } |
| 1804 | 1804 | |
| 1805 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
| 1805 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
| 1806 | 1806 | |
| 1807 | 1807 | /** |
| 1808 | 1808 | * Test Mode Frontend Warning. |
@@ -1813,12 +1813,12 @@ discard block |
||
| 1813 | 1813 | */ |
| 1814 | 1814 | function give_test_mode_frontend_warning() { |
| 1815 | 1815 | |
| 1816 | - if ( give_is_test_mode() ) { |
|
| 1817 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
| 1816 | + if (give_is_test_mode()) { |
|
| 1817 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
| 1818 | 1818 | } |
| 1819 | 1819 | } |
| 1820 | 1820 | |
| 1821 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
| 1821 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
| 1822 | 1822 | |
| 1823 | 1823 | /** |
| 1824 | 1824 | * Members-only Form. |
@@ -1832,21 +1832,21 @@ discard block |
||
| 1832 | 1832 | * |
| 1833 | 1833 | * @return string |
| 1834 | 1834 | */ |
| 1835 | -function give_members_only_form( $final_output, $args ) { |
|
| 1835 | +function give_members_only_form($final_output, $args) { |
|
| 1836 | 1836 | |
| 1837 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
| 1837 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
| 1838 | 1838 | |
| 1839 | 1839 | //Sanity Check: Must have form_id & not be logged in. |
| 1840 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
| 1840 | + if (empty($form_id) || is_user_logged_in()) { |
|
| 1841 | 1841 | return $final_output; |
| 1842 | 1842 | } |
| 1843 | 1843 | |
| 1844 | 1844 | //Logged in only and Register / Login set to none. |
| 1845 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
| 1845 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
| 1846 | 1846 | |
| 1847 | - $final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
| 1847 | + $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
| 1848 | 1848 | |
| 1849 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
| 1849 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
| 1850 | 1850 | |
| 1851 | 1851 | } |
| 1852 | 1852 | |
@@ -1854,4 +1854,4 @@ discard block |
||
| 1854 | 1854 | |
| 1855 | 1855 | } |
| 1856 | 1856 | |
| 1857 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
| 1857 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|