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