@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -add_action( 'cmb2_init', 'give_single_forms_cmb2_metaboxes', 6 ); |
|
17 | +add_action('cmb2_init', 'give_single_forms_cmb2_metaboxes', 6); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Define the metabox and field configurations. |
@@ -22,20 +22,20 @@ discard block |
||
22 | 22 | function give_single_forms_cmb2_metaboxes() { |
23 | 23 | |
24 | 24 | $post_id = give_get_admin_post_id(); |
25 | - $price = give_get_form_price( $post_id ); |
|
26 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
27 | - $goal = give_get_form_goal( $post_id ); |
|
28 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
29 | - $prices = give_get_variable_prices( $post_id ); |
|
25 | + $price = give_get_form_price($post_id); |
|
26 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
27 | + $goal = give_get_form_goal($post_id); |
|
28 | + $variable_pricing = give_has_variable_prices($post_id); |
|
29 | + $prices = give_get_variable_prices($post_id); |
|
30 | 30 | |
31 | 31 | //No empty prices - min. 1.00 for new forms |
32 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
33 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
32 | + if (empty($price) && is_null($post_id)) { |
|
33 | + $price = esc_attr(give_format_amount('1.00')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | //Min. $1.00 for new forms |
37 | - if ( empty( $custom_amount_minimum ) ) { |
|
38 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
37 | + if (empty($custom_amount_minimum)) { |
|
38 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00')); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | // Start with an underscore to hide fields from custom fields list |
@@ -47,327 +47,327 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * Repeatable Field Groups |
49 | 49 | */ |
50 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
50 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array( |
|
51 | 51 | 'id' => 'form_field_options', |
52 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
53 | - 'object_types' => array( 'give_forms' ), |
|
52 | + 'title' => esc_html__('Donation Options', 'give'), |
|
53 | + 'object_types' => array('give_forms'), |
|
54 | 54 | 'context' => 'normal', |
55 | 55 | 'priority' => 'high', //Show above Content WYSIWYG |
56 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
56 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
57 | 57 | //Donation Option |
58 | 58 | array( |
59 | - 'name' => esc_html__( 'Donation Option', 'give' ), |
|
60 | - 'description' => esc_html__( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
61 | - 'id' => $prefix . 'price_option', |
|
59 | + 'name' => esc_html__('Donation Option', 'give'), |
|
60 | + 'description' => esc_html__('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
61 | + 'id' => $prefix.'price_option', |
|
62 | 62 | 'type' => 'radio_inline', |
63 | 63 | 'default' => 'set', |
64 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
65 | - 'set' => esc_html__( 'Set Donation', 'give' ), |
|
66 | - 'multi' => esc_html__( 'Multi-level Donation', 'give' ), |
|
67 | - ) ), |
|
64 | + 'options' => apply_filters('give_forms_price_options', array( |
|
65 | + 'set' => esc_html__('Set Donation', 'give'), |
|
66 | + 'multi' => esc_html__('Multi-level Donation', 'give'), |
|
67 | + )), |
|
68 | 68 | ), |
69 | 69 | array( |
70 | - 'name' => esc_html__( 'Set Donation', 'give' ), |
|
71 | - 'description' => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
72 | - 'id' => $prefix . 'set_price', |
|
70 | + 'name' => esc_html__('Set Donation', 'give'), |
|
71 | + 'description' => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
72 | + 'id' => $prefix.'set_price', |
|
73 | 73 | 'type' => 'text_small', |
74 | 74 | 'row_classes' => 'give-subfield', |
75 | 75 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
76 | 76 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
77 | 77 | 'attributes' => array( |
78 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
79 | - 'value' => give_format_decimal( $price ), |
|
78 | + 'placeholder' => give_format_decimal('1.00'), |
|
79 | + 'value' => give_format_decimal($price), |
|
80 | 80 | 'class' => 'cmb-type-text-small give-money-field', |
81 | 81 | ), |
82 | 82 | ), |
83 | 83 | //Donation levels: Header |
84 | 84 | array( |
85 | - 'id' => $prefix . 'levels_header', |
|
85 | + 'id' => $prefix.'levels_header', |
|
86 | 86 | 'type' => 'levels_repeater_header', |
87 | 87 | ), |
88 | 88 | //Donation Levels: Repeatable CMB2 Group |
89 | 89 | array( |
90 | - 'id' => $prefix . 'donation_levels', |
|
90 | + 'id' => $prefix.'donation_levels', |
|
91 | 91 | 'type' => 'group', |
92 | 92 | 'row_classes' => 'give-subfield', |
93 | 93 | 'options' => array( |
94 | - 'add_button' => esc_html__( 'Add Level', 'give' ), |
|
94 | + 'add_button' => esc_html__('Add Level', 'give'), |
|
95 | 95 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
96 | 96 | 'sortable' => true, // beta |
97 | 97 | ), |
98 | 98 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
99 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
99 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
100 | 100 | array( |
101 | - 'name' => esc_html__( 'ID', 'give' ), |
|
102 | - 'id' => $prefix . 'id', |
|
101 | + 'name' => esc_html__('ID', 'give'), |
|
102 | + 'id' => $prefix.'id', |
|
103 | 103 | 'type' => 'levels_id', |
104 | 104 | ), |
105 | 105 | array( |
106 | - 'name' => esc_html__( 'Amount', 'give' ), |
|
107 | - 'id' => $prefix . 'amount', |
|
106 | + 'name' => esc_html__('Amount', 'give'), |
|
107 | + 'id' => $prefix.'amount', |
|
108 | 108 | 'type' => 'text_small', |
109 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
110 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
109 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
110 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
111 | 111 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
112 | 112 | 'attributes' => array( |
113 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
113 | + 'placeholder' => give_format_decimal('1.00'), |
|
114 | 114 | 'class' => 'cmb-type-text-small give-money-field', |
115 | 115 | ), |
116 | 116 | 'before' => 'give_format_admin_multilevel_amount', |
117 | 117 | ), |
118 | 118 | array( |
119 | - 'name' => esc_html__( 'Text', 'give' ), |
|
120 | - 'id' => $prefix . 'text', |
|
119 | + 'name' => esc_html__('Text', 'give'), |
|
120 | + 'id' => $prefix.'text', |
|
121 | 121 | 'type' => 'text', |
122 | 122 | 'attributes' => array( |
123 | - 'placeholder' => esc_html__( 'Donation Level', 'give' ), |
|
123 | + 'placeholder' => esc_html__('Donation Level', 'give'), |
|
124 | 124 | 'class' => 'give-multilevel-text-field', |
125 | 125 | ), |
126 | 126 | ), |
127 | 127 | array( |
128 | - 'name' => esc_html__( 'Default', 'give' ), |
|
129 | - 'id' => $prefix . 'default', |
|
128 | + 'name' => esc_html__('Default', 'give'), |
|
129 | + 'id' => $prefix.'default', |
|
130 | 130 | 'type' => 'give_default_radio_inline' |
131 | 131 | ), |
132 | - ) ), |
|
132 | + )), |
|
133 | 133 | ), |
134 | 134 | //Display Style |
135 | 135 | array( |
136 | - 'name' => esc_html__( 'Display Style', 'give' ), |
|
137 | - 'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ), |
|
138 | - 'id' => $prefix . 'display_style', |
|
136 | + 'name' => esc_html__('Display Style', 'give'), |
|
137 | + 'description' => esc_html__('Set how the donations levels will display on the form.', 'give'), |
|
138 | + 'id' => $prefix.'display_style', |
|
139 | 139 | 'type' => 'radio_inline', |
140 | 140 | 'default' => 'buttons', |
141 | 141 | 'options' => array( |
142 | - 'buttons' => esc_html__( 'Buttons', 'give' ), |
|
143 | - 'radios' => esc_html__( 'Radios', 'give' ), |
|
144 | - 'dropdown' => esc_html__( 'Dropdown', 'give' ), |
|
142 | + 'buttons' => esc_html__('Buttons', 'give'), |
|
143 | + 'radios' => esc_html__('Radios', 'give'), |
|
144 | + 'dropdown' => esc_html__('Dropdown', 'give'), |
|
145 | 145 | ), |
146 | 146 | ), |
147 | 147 | //Custom Amount |
148 | 148 | array( |
149 | - 'name' => esc_html__( 'Custom Amount', 'give' ), |
|
150 | - 'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
151 | - 'id' => $prefix . 'custom_amount', |
|
149 | + 'name' => esc_html__('Custom Amount', 'give'), |
|
150 | + 'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'), |
|
151 | + 'id' => $prefix.'custom_amount', |
|
152 | 152 | 'type' => 'radio_inline', |
153 | 153 | 'default' => 'no', |
154 | 154 | 'options' => array( |
155 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
156 | - 'no' => esc_html__( 'No', 'give' ), |
|
155 | + 'yes' => esc_html__('Yes', 'give'), |
|
156 | + 'no' => esc_html__('No', 'give'), |
|
157 | 157 | ), |
158 | 158 | ), |
159 | 159 | array( |
160 | - 'name' => esc_html__( 'Custom Amount Minimum', 'give' ), |
|
161 | - 'description' => esc_html__( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
162 | - 'id' => $prefix . 'custom_amount_minimum', |
|
160 | + 'name' => esc_html__('Custom Amount Minimum', 'give'), |
|
161 | + 'description' => esc_html__('If you would like to set a minimum custom donation amount please enter it here.', 'give'), |
|
162 | + 'id' => $prefix.'custom_amount_minimum', |
|
163 | 163 | 'type' => 'text_small', |
164 | 164 | 'row_classes' => 'give-subfield', |
165 | 165 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
166 | 166 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
167 | 167 | 'attributes' => array( |
168 | 168 | 'placeholder' => give_format_decimal('1.00'), |
169 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
169 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
170 | 170 | 'class' => 'cmb-type-text-small give-money-field', |
171 | 171 | ) |
172 | 172 | ), |
173 | 173 | array( |
174 | - 'name' => esc_html__( 'Custom Amount Text', 'give' ), |
|
175 | - 'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
176 | - 'id' => $prefix . 'custom_amount_text', |
|
174 | + 'name' => esc_html__('Custom Amount Text', 'give'), |
|
175 | + 'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
176 | + 'id' => $prefix.'custom_amount_text', |
|
177 | 177 | 'type' => 'text', |
178 | 178 | 'row_classes' => 'give-subfield', |
179 | 179 | 'attributes' => array( |
180 | 180 | 'rows' => 3, |
181 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
181 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
182 | 182 | ), |
183 | 183 | ), |
184 | 184 | //Goals |
185 | 185 | array( |
186 | - 'name' => esc_html__( 'Goal', 'give' ), |
|
187 | - 'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ), |
|
188 | - 'id' => $prefix . 'goal_option', |
|
186 | + 'name' => esc_html__('Goal', 'give'), |
|
187 | + 'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'), |
|
188 | + 'id' => $prefix.'goal_option', |
|
189 | 189 | 'type' => 'radio_inline', |
190 | 190 | 'default' => 'no', |
191 | 191 | 'options' => array( |
192 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
193 | - 'no' => esc_html__( 'No', 'give' ), |
|
192 | + 'yes' => esc_html__('Yes', 'give'), |
|
193 | + 'no' => esc_html__('No', 'give'), |
|
194 | 194 | ), |
195 | 195 | ), |
196 | 196 | array( |
197 | - 'name' => esc_html__( 'Goal Amount', 'give' ), |
|
198 | - 'description' => esc_html__( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
199 | - 'id' => $prefix . 'set_goal', |
|
197 | + 'name' => esc_html__('Goal Amount', 'give'), |
|
198 | + 'description' => esc_html__('This is the monetary goal amount you want to reach for this donation form.', 'give'), |
|
199 | + 'id' => $prefix.'set_goal', |
|
200 | 200 | 'type' => 'text_small', |
201 | 201 | 'row_classes' => 'give-subfield', |
202 | 202 | 'render_row_cb' => 'give_cmb_amount_field_render_row_cb', |
203 | 203 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
204 | 204 | 'attributes' => array( |
205 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
206 | - 'value' => give_format_decimal( $goal ), |
|
205 | + 'placeholder' => give_format_decimal('0.00'), |
|
206 | + 'value' => give_format_decimal($goal), |
|
207 | 207 | 'class' => 'cmb-type-text-small give-money-field', |
208 | 208 | ), |
209 | 209 | ), |
210 | 210 | |
211 | 211 | array( |
212 | - 'name' => esc_html__( 'Goal Format', 'give' ), |
|
213 | - 'description' => esc_html__( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
214 | - 'id' => $prefix . 'goal_format', |
|
212 | + 'name' => esc_html__('Goal Format', 'give'), |
|
213 | + 'description' => esc_html__('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
214 | + 'id' => $prefix.'goal_format', |
|
215 | 215 | 'type' => 'radio_inline', |
216 | 216 | 'default' => 'amount', |
217 | 217 | 'row_classes' => 'give-subfield', |
218 | 218 | 'options' => array( |
219 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
220 | - 'percentage' => esc_html__( 'Percentage', 'give' ), |
|
219 | + 'amount' => esc_html__('Amount', 'give'), |
|
220 | + 'percentage' => esc_html__('Percentage', 'give'), |
|
221 | 221 | ), |
222 | 222 | ), |
223 | 223 | array( |
224 | - 'name' => esc_html__( 'Goal Progress Bar Color', 'give' ), |
|
225 | - 'id' => $prefix . 'goal_color', |
|
224 | + 'name' => esc_html__('Goal Progress Bar Color', 'give'), |
|
225 | + 'id' => $prefix.'goal_color', |
|
226 | 226 | 'type' => 'colorpicker', |
227 | 227 | 'row_classes' => 'give-subfield', |
228 | 228 | 'default' => '#2bc253', |
229 | 229 | ), |
230 | 230 | |
231 | 231 | array( |
232 | - 'name' => esc_html__( 'Close Form when Goal Achieved', 'give' ), |
|
233 | - 'desc' => esc_html__( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
234 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
232 | + 'name' => esc_html__('Close Form when Goal Achieved', 'give'), |
|
233 | + 'desc' => esc_html__('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
234 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
235 | 235 | 'type' => 'radio_inline', |
236 | 236 | 'row_classes' => 'give-subfield', |
237 | 237 | 'options' => array( |
238 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
239 | - 'no' => esc_html__( 'No', 'give' ), |
|
238 | + 'yes' => esc_html__('Yes', 'give'), |
|
239 | + 'no' => esc_html__('No', 'give'), |
|
240 | 240 | ), |
241 | 241 | 'default' => 'no', |
242 | 242 | ), |
243 | 243 | array( |
244 | - 'name' => esc_html__( 'Goal Achieved Message', 'give' ), |
|
245 | - 'desc' => esc_html__( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ), |
|
246 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
244 | + 'name' => esc_html__('Goal Achieved Message', 'give'), |
|
245 | + 'desc' => esc_html__('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'), |
|
246 | + 'id' => $prefix.'form_goal_achieved_message', |
|
247 | 247 | 'type' => 'textarea', |
248 | 248 | 'row_classes' => 'give-subfield', |
249 | 249 | 'attributes' => array( |
250 | - 'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
250 | + 'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
251 | 251 | ), |
252 | 252 | ) |
253 | 253 | ) |
254 | 254 | ) |
255 | - ) ); |
|
255 | + )); |
|
256 | 256 | |
257 | 257 | |
258 | 258 | /** |
259 | 259 | * Content Field |
260 | 260 | */ |
261 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
261 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array( |
|
262 | 262 | 'id' => 'form_content_options', |
263 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
264 | - 'object_types' => array( 'give_forms' ), |
|
263 | + 'title' => esc_html__('Form Content', 'give'), |
|
264 | + 'object_types' => array('give_forms'), |
|
265 | 265 | 'context' => 'normal', |
266 | 266 | 'priority' => 'high', //Show above Content WYSIWYG |
267 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
267 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
268 | 268 | //Donation Option |
269 | 269 | array( |
270 | - 'name' => esc_html__( 'Display Content', 'give' ), |
|
271 | - 'description' => esc_html__( 'Do you want to display content? If you choose to display content, a WYSIWYG editor will appear which you will be able to enter content.', 'give' ), |
|
272 | - 'id' => $prefix . 'content_option', |
|
270 | + 'name' => esc_html__('Display Content', 'give'), |
|
271 | + 'description' => esc_html__('Do you want to display content? If you choose to display content, a WYSIWYG editor will appear which you will be able to enter content.', 'give'), |
|
272 | + 'id' => $prefix.'content_option', |
|
273 | 273 | 'type' => 'select', |
274 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
275 | - 'none' => esc_html__( 'No Content', 'give' ), |
|
276 | - 'give_pre_form' => esc_html__( 'Display content ABOVE the fields', 'give' ), |
|
277 | - 'give_post_form' => esc_html__( 'Display content BELOW the fields', 'give' ), |
|
274 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
275 | + 'none' => esc_html__('No Content', 'give'), |
|
276 | + 'give_pre_form' => esc_html__('Display content ABOVE the fields', 'give'), |
|
277 | + 'give_post_form' => esc_html__('Display content BELOW the fields', 'give'), |
|
278 | 278 | ) |
279 | 279 | ), |
280 | 280 | 'default' => 'none', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => esc_html__( 'Content', 'give' ), |
|
284 | - 'description' => esc_html__( 'This content will display on the single give form page.', 'give' ), |
|
285 | - 'id' => $prefix . 'form_content', |
|
283 | + 'name' => esc_html__('Content', 'give'), |
|
284 | + 'description' => esc_html__('This content will display on the single give form page.', 'give'), |
|
285 | + 'id' => $prefix.'form_content', |
|
286 | 286 | 'row_classes' => 'give-subfield', |
287 | 287 | 'type' => 'wysiwyg' |
288 | 288 | ), |
289 | 289 | ) |
290 | 290 | ) |
291 | - ) ); |
|
291 | + )); |
|
292 | 292 | |
293 | 293 | |
294 | 294 | /** |
295 | 295 | * Display Options |
296 | 296 | */ |
297 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
297 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array( |
|
298 | 298 | 'id' => 'form_display_options', |
299 | - 'title' => esc_html__( 'Form Display Options', 'give' ), |
|
300 | - 'object_types' => array( 'give_forms' ), |
|
299 | + 'title' => esc_html__('Form Display Options', 'give'), |
|
300 | + 'object_types' => array('give_forms'), |
|
301 | 301 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
302 | 302 | 'priority' => 'high', //Show above Content WYSIWYG |
303 | 303 | 'show_names' => true, // Show field names on the left |
304 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
304 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
305 | 305 | array( |
306 | - 'name' => esc_html__( 'Payment Fields', 'give' ), |
|
307 | - 'desc' => esc_html__( 'How would you like to display donation information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
308 | - 'id' => $prefix . 'payment_display', |
|
306 | + 'name' => esc_html__('Payment Fields', 'give'), |
|
307 | + 'desc' => esc_html__('How would you like to display donation information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), |
|
308 | + 'id' => $prefix.'payment_display', |
|
309 | 309 | 'type' => 'select', |
310 | 310 | 'options' => array( |
311 | - 'onpage' => esc_html__( 'Show on Page', 'give' ), |
|
312 | - 'reveal' => esc_html__( 'Reveal Upon Click', 'give' ), |
|
313 | - 'modal' => esc_html__( 'Modal Window Upon Click', 'give' ), |
|
311 | + 'onpage' => esc_html__('Show on Page', 'give'), |
|
312 | + 'reveal' => esc_html__('Reveal Upon Click', 'give'), |
|
313 | + 'modal' => esc_html__('Modal Window Upon Click', 'give'), |
|
314 | 314 | ), |
315 | 315 | 'default' => 'onpage', |
316 | 316 | ), |
317 | 317 | array( |
318 | - 'id' => $prefix . 'reveal_label', |
|
319 | - 'name' => esc_html__( 'Reveal / Modal Open Text', 'give' ), |
|
320 | - 'desc' => esc_html__( 'The button label for completing the donation.', 'give' ), |
|
318 | + 'id' => $prefix.'reveal_label', |
|
319 | + 'name' => esc_html__('Reveal / Modal Open Text', 'give'), |
|
320 | + 'desc' => esc_html__('The button label for completing the donation.', 'give'), |
|
321 | 321 | 'type' => 'text_small', |
322 | 322 | 'row_classes' => 'give-subfield', |
323 | 323 | 'attributes' => array( |
324 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
324 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
325 | 325 | ), |
326 | 326 | ), |
327 | 327 | array( |
328 | - 'id' => $prefix . 'checkout_label', |
|
329 | - 'name' => esc_html__( 'Complete Donation Text', 'give' ), |
|
330 | - 'desc' => esc_html__( 'The button label for completing a donation.', 'give' ), |
|
328 | + 'id' => $prefix.'checkout_label', |
|
329 | + 'name' => esc_html__('Complete Donation Text', 'give'), |
|
330 | + 'desc' => esc_html__('The button label for completing a donation.', 'give'), |
|
331 | 331 | 'type' => 'text_small', |
332 | 332 | 'attributes' => array( |
333 | - 'placeholder' => esc_html__( 'Donate Now', 'give' ), |
|
333 | + 'placeholder' => esc_html__('Donate Now', 'give'), |
|
334 | 334 | ), |
335 | 335 | ), |
336 | 336 | array( |
337 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
338 | - 'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
339 | - 'id' => $prefix . 'default_gateway', |
|
337 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
338 | + 'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
339 | + 'id' => $prefix.'default_gateway', |
|
340 | 340 | 'type' => 'default_gateway' |
341 | 341 | ), |
342 | 342 | array( |
343 | - 'name' => esc_html__( 'Disable Guest Donations', 'give' ), |
|
344 | - 'desc' => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
345 | - 'id' => $prefix . 'logged_in_only', |
|
343 | + 'name' => esc_html__('Disable Guest Donations', 'give'), |
|
344 | + 'desc' => esc_html__('Do you want to require users be logged-in to make donations?', 'give'), |
|
345 | + 'id' => $prefix.'logged_in_only', |
|
346 | 346 | 'type' => 'checkbox' |
347 | 347 | ), |
348 | 348 | array( |
349 | - 'name' => esc_html__( 'Register / Login Form', 'give' ), |
|
350 | - 'desc' => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
351 | - 'id' => $prefix . 'show_register_form', |
|
349 | + 'name' => esc_html__('Register / Login Form', 'give'), |
|
350 | + 'desc' => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
351 | + 'id' => $prefix.'show_register_form', |
|
352 | 352 | 'type' => 'select', |
353 | 353 | 'options' => array( |
354 | - 'both' => esc_html__( 'Registration and Login Forms', 'give' ), |
|
355 | - 'registration' => esc_html__( 'Registration Form Only', 'give' ), |
|
356 | - 'login' => esc_html__( 'Login Form Only', 'give' ), |
|
357 | - 'none' => esc_html__( 'None', 'give' ), |
|
354 | + 'both' => esc_html__('Registration and Login Forms', 'give'), |
|
355 | + 'registration' => esc_html__('Registration Form Only', 'give'), |
|
356 | + 'login' => esc_html__('Login Form Only', 'give'), |
|
357 | + 'none' => esc_html__('None', 'give'), |
|
358 | 358 | ), |
359 | 359 | 'default' => 'none', |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => esc_html__( 'Floating Labels', 'give' ), |
|
362 | + 'name' => esc_html__('Floating Labels', 'give'), |
|
363 | 363 | /* translators: %s: forms https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */ |
364 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ), |
|
365 | - 'id' => $prefix . 'form_floating_labels', |
|
364 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')), |
|
365 | + 'id' => $prefix.'form_floating_labels', |
|
366 | 366 | 'type' => 'select', |
367 | 367 | 'options' => array( |
368 | - '' => esc_html__( 'Use the global setting', 'give' ), |
|
369 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
370 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
368 | + '' => esc_html__('Use the global setting', 'give'), |
|
369 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
370 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
371 | 371 | ), |
372 | 372 | 'default' => 'none', |
373 | 373 | ) |
@@ -379,50 +379,50 @@ discard block |
||
379 | 379 | /** |
380 | 380 | * Terms & Conditions |
381 | 381 | */ |
382 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
382 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
383 | 383 | 'id' => 'form_terms_options', |
384 | - 'title' => esc_html__( 'Terms and Conditions', 'give' ), |
|
385 | - 'object_types' => array( 'give_forms' ), |
|
384 | + 'title' => esc_html__('Terms and Conditions', 'give'), |
|
385 | + 'object_types' => array('give_forms'), |
|
386 | 386 | 'context' => 'normal', |
387 | 387 | 'priority' => 'high', //Show above Content WYSIWYG |
388 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
388 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
389 | 389 | //Donation Option |
390 | 390 | array( |
391 | - 'name' => esc_html__( 'Terms and Conditions', 'give' ), |
|
392 | - 'description' => esc_html__( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
393 | - 'id' => $prefix . 'terms_option', |
|
391 | + 'name' => esc_html__('Terms and Conditions', 'give'), |
|
392 | + 'description' => esc_html__('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
393 | + 'id' => $prefix.'terms_option', |
|
394 | 394 | 'type' => 'select', |
395 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
396 | - 'none' => esc_html__( 'No', 'give' ), |
|
397 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
395 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
396 | + 'none' => esc_html__('No', 'give'), |
|
397 | + 'yes' => esc_html__('Yes', 'give'), |
|
398 | 398 | ) |
399 | 399 | ), |
400 | 400 | 'default' => 'none', |
401 | 401 | ), |
402 | 402 | array( |
403 | - 'id' => $prefix . 'agree_label', |
|
404 | - 'name' => esc_html__( 'Agree to Terms Label', 'give' ), |
|
405 | - 'desc' => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
403 | + 'id' => $prefix.'agree_label', |
|
404 | + 'name' => esc_html__('Agree to Terms Label', 'give'), |
|
405 | + 'desc' => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
406 | 406 | 'type' => 'text', |
407 | 407 | 'row_classes' => 'give-subfield', |
408 | 408 | 'size' => 'regular', |
409 | 409 | 'attributes' => array( |
410 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
410 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
411 | 411 | ), |
412 | 412 | ), |
413 | 413 | array( |
414 | - 'id' => $prefix . 'agree_text', |
|
414 | + 'id' => $prefix.'agree_text', |
|
415 | 415 | 'row_classes' => 'give-subfield', |
416 | - 'name' => esc_html__( 'Agreement Text', 'give' ), |
|
417 | - 'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
416 | + 'name' => esc_html__('Agreement Text', 'give'), |
|
417 | + 'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
418 | 418 | 'type' => 'wysiwyg' |
419 | 419 | ), |
420 | 420 | ) |
421 | 421 | ) |
422 | - ) ); |
|
422 | + )); |
|
423 | 423 | |
424 | - foreach ( $meta_boxes as $box ) { |
|
425 | - $cmb = new_cmb2_box( $box ); |
|
424 | + foreach ($meta_boxes as $box) { |
|
425 | + $cmb = new_cmb2_box($box); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | } |
@@ -435,9 +435,9 @@ discard block |
||
435 | 435 | |
436 | 436 | <div class="table-container"> |
437 | 437 | <div class="table-row"> |
438 | - <div class="table-cell col-amount"><?php esc_html_e( 'Amount', 'give' ); ?></div> |
|
439 | - <div class="table-cell col-text"><?php esc_html_e( 'Text', 'give' ); ?></div> |
|
440 | - <div class="table-cell col-default"><?php esc_html_e( 'Default', 'give' ); ?></div> |
|
438 | + <div class="table-cell col-amount"><?php esc_html_e('Amount', 'give'); ?></div> |
|
439 | + <div class="table-cell col-text"><?php esc_html_e('Text', 'give'); ?></div> |
|
440 | + <div class="table-cell col-default"><?php esc_html_e('Default', 'give'); ?></div> |
|
441 | 441 | <?php |
442 | 442 | /** |
443 | 443 | * Fires in repeatable donation levels table head. |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | * |
450 | 450 | * @since 1.0 |
451 | 451 | */ |
452 | - do_action( 'give_donation_levels_table_head' ); |
|
452 | + do_action('give_donation_levels_table_head'); |
|
453 | 453 | ?> |
454 | - <div class="table-cell col-sort"><?php esc_html_e( 'Sort', 'give' ); ?></div> |
|
454 | + <div class="table-cell col-sort"><?php esc_html_e('Sort', 'give'); ?></div> |
|
455 | 455 | |
456 | 456 | </div> |
457 | 457 | </div> |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | <?php |
460 | 460 | } |
461 | 461 | |
462 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
462 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
463 | 463 | |
464 | 464 | |
465 | 465 | /** |
@@ -476,25 +476,25 @@ discard block |
||
476 | 476 | * @param $object_type |
477 | 477 | * @param $field_type_object |
478 | 478 | */ |
479 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
479 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
480 | 480 | |
481 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
481 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
482 | 482 | |
483 | 483 | $field_options_array = array( |
484 | 484 | 'class' => 'give-hidden give-level-id-input', |
485 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
486 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
485 | + 'name' => $field_type_object->_name('[level_id]'), |
|
486 | + 'id' => $field_type_object->_id('_level_id'), |
|
487 | 487 | 'value' => $escaped_value, |
488 | 488 | 'type' => 'number', |
489 | 489 | 'desc' => '', |
490 | 490 | ); |
491 | 491 | |
492 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
493 | - echo $field_type_object->input( $field_options_array ); |
|
492 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
493 | + echo $field_type_object->input($field_options_array); |
|
494 | 494 | |
495 | 495 | } |
496 | 496 | |
497 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
497 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
498 | 498 | |
499 | 499 | |
500 | 500 | /** |
@@ -506,13 +506,13 @@ discard block |
||
506 | 506 | * @param $object_type |
507 | 507 | * @param $field_type_object |
508 | 508 | */ |
509 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
510 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
511 | - echo '<label for="' . $field_object->args['id'] . '">' . esc_html__( 'Default', 'give' ) . '</label>'; |
|
509 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
510 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>'; |
|
511 | + echo '<label for="'.$field_object->args['id'].'">'.esc_html__('Default', 'give').'</label>'; |
|
512 | 512 | |
513 | 513 | } |
514 | 514 | |
515 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
515 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
516 | 516 | |
517 | 517 | |
518 | 518 | /** |
@@ -522,20 +522,20 @@ discard block |
||
522 | 522 | */ |
523 | 523 | function give_add_shortcode_to_publish_metabox() { |
524 | 524 | |
525 | - if ( 'give_forms' !== get_post_type() ) { |
|
525 | + if ('give_forms' !== get_post_type()) { |
|
526 | 526 | return false; |
527 | 527 | } |
528 | 528 | |
529 | 529 | global $post; |
530 | 530 | |
531 | 531 | //Only enqueue scripts for CPT on post type screen |
532 | - if ( 'give_forms' === $post->post_type ) { |
|
532 | + if ('give_forms' === $post->post_type) { |
|
533 | 533 | //Shortcode column with select all input |
534 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
535 | - echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
534 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
535 | + echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
536 | 536 | |
537 | 537 | } |
538 | 538 | |
539 | 539 | } |
540 | 540 | |
541 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
541 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |