@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | |
14 | 14 | public function __construct() { |
15 | 15 | |
16 | - foreach( $this->get_elements() as $element ) { |
|
16 | + foreach ($this->get_elements() as $element) { |
|
17 | 17 | $element = $element['type']; |
18 | 18 | |
19 | - if ( method_exists( $this, "render_{$element}_template" ) ) { |
|
20 | - add_action( 'wpinv_payment_form_render_element_template', array( $this, "render_{$element}_template" ), 10, 2 ); |
|
19 | + if (method_exists($this, "render_{$element}_template")) { |
|
20 | + add_action('wpinv_payment_form_render_element_template', array($this, "render_{$element}_template"), 10, 2); |
|
21 | 21 | } |
22 | 22 | |
23 | - if ( method_exists( $this, "edit_{$element}_template" ) ) { |
|
24 | - add_action( 'wpinv_payment_form_edit_element_template', array( $this, "edit_{$element}_template" ), 10, 2 ); |
|
23 | + if (method_exists($this, "edit_{$element}_template")) { |
|
24 | + add_action('wpinv_payment_form_edit_element_template', array($this, "edit_{$element}_template"), 10, 2); |
|
25 | 25 | } |
26 | 26 | |
27 | - if ( method_exists( $this, "frontend_render_{$element}_template" ) ) { |
|
28 | - add_action( "wpinv_frontend_render_payment_form_$element", array( $this, "frontend_render_{$element}_template" ), 10, 3 ); |
|
27 | + if (method_exists($this, "frontend_render_{$element}_template")) { |
|
28 | + add_action("wpinv_frontend_render_payment_form_$element", array($this, "frontend_render_{$element}_template"), 10, 3); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function get_elements() { |
39 | 39 | |
40 | - if ( ! empty( $this->elements ) ) { |
|
40 | + if (!empty($this->elements)) { |
|
41 | 41 | return $this->elements; |
42 | 42 | } |
43 | 43 | |
@@ -45,28 +45,28 @@ discard block |
||
45 | 45 | |
46 | 46 | array( |
47 | 47 | 'type' => 'heading', |
48 | - 'name' => __( 'Heading', 'invoicing' ), |
|
48 | + 'name' => __('Heading', 'invoicing'), |
|
49 | 49 | 'defaults' => array( |
50 | 50 | 'level' => 'h2', |
51 | - 'text' => __( 'Heading', 'invoicing' ), |
|
51 | + 'text' => __('Heading', 'invoicing'), |
|
52 | 52 | ) |
53 | 53 | ), |
54 | 54 | |
55 | 55 | array( |
56 | 56 | 'type' => 'paragraph', |
57 | - 'name' => __( 'Paragraph', 'invoicing' ), |
|
57 | + 'name' => __('Paragraph', 'invoicing'), |
|
58 | 58 | 'defaults' => array( |
59 | - 'text' => __( 'Paragraph text', 'invoicing' ), |
|
59 | + 'text' => __('Paragraph text', 'invoicing'), |
|
60 | 60 | ) |
61 | 61 | ), |
62 | 62 | |
63 | 63 | array( |
64 | 64 | 'type' => 'alert', |
65 | - 'name' => __( 'Alert', 'invoicing' ), |
|
65 | + 'name' => __('Alert', 'invoicing'), |
|
66 | 66 | 'defaults' => array( |
67 | 67 | 'value' => '', |
68 | 68 | 'class' => 'alert-warning', |
69 | - 'text' => __( 'Alert', 'invoicing' ), |
|
69 | + 'text' => __('Alert', 'invoicing'), |
|
70 | 70 | 'dismissible' => false, |
71 | 71 | ) |
72 | 72 | ), |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | |
83 | 83 | array( |
84 | 84 | 'type' => 'text', |
85 | - 'name' => __( 'Text Input', 'invoicing' ), |
|
85 | + 'name' => __('Text Input', 'invoicing'), |
|
86 | 86 | 'defaults' => array( |
87 | - 'placeholder' => __( 'Enter some text', 'invoicing' ), |
|
87 | + 'placeholder' => __('Enter some text', 'invoicing'), |
|
88 | 88 | 'value' => '', |
89 | - 'label' => __( 'Field Label', 'invoicing' ), |
|
89 | + 'label' => __('Field Label', 'invoicing'), |
|
90 | 90 | 'description' => '', |
91 | 91 | 'required' => false, |
92 | 92 | ) |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | |
95 | 95 | array( |
96 | 96 | 'type' => 'textarea', |
97 | - 'name' => __( 'Textarea', 'invoicing' ), |
|
97 | + 'name' => __('Textarea', 'invoicing'), |
|
98 | 98 | 'defaults' => array( |
99 | - 'placeholder' => __( 'Enter your text hear', 'invoicing' ), |
|
99 | + 'placeholder' => __('Enter your text hear', 'invoicing'), |
|
100 | 100 | 'value' => '', |
101 | - 'label' => __( 'Textarea Label', 'invoicing' ), |
|
101 | + 'label' => __('Textarea Label', 'invoicing'), |
|
102 | 102 | 'description' => '', |
103 | 103 | 'required' => false, |
104 | 104 | ) |
@@ -106,27 +106,27 @@ discard block |
||
106 | 106 | |
107 | 107 | array( |
108 | 108 | 'type' => 'select', |
109 | - 'name' => __( 'Dropdown', 'invoicing' ), |
|
109 | + 'name' => __('Dropdown', 'invoicing'), |
|
110 | 110 | 'defaults' => array( |
111 | - 'placeholder' => __( 'Select a value', 'invoicing' ), |
|
111 | + 'placeholder' => __('Select a value', 'invoicing'), |
|
112 | 112 | 'value' => '', |
113 | - 'label' => __( 'Dropdown Label', 'invoicing' ), |
|
113 | + 'label' => __('Dropdown Label', 'invoicing'), |
|
114 | 114 | 'description' => '', |
115 | 115 | 'required' => false, |
116 | 116 | 'options' => array( |
117 | - esc_attr__( 'Option One', 'invoicing' ), |
|
118 | - esc_attr__( 'Option Two', 'invoicing' ), |
|
119 | - esc_attr__( 'Option Three', 'invoicing' ) |
|
117 | + esc_attr__('Option One', 'invoicing'), |
|
118 | + esc_attr__('Option Two', 'invoicing'), |
|
119 | + esc_attr__('Option Three', 'invoicing') |
|
120 | 120 | ), |
121 | 121 | ) |
122 | 122 | ), |
123 | 123 | |
124 | 124 | array( |
125 | 125 | 'type' => 'checkbox', |
126 | - 'name' => __( 'Checkbox', 'invoicing' ), |
|
126 | + 'name' => __('Checkbox', 'invoicing'), |
|
127 | 127 | 'defaults' => array( |
128 | 128 | 'value' => '', |
129 | - 'label' => __( 'Checkbox Label', 'invoicing' ), |
|
129 | + 'label' => __('Checkbox Label', 'invoicing'), |
|
130 | 130 | 'description' => '', |
131 | 131 | 'required' => false, |
132 | 132 | ) |
@@ -134,24 +134,24 @@ discard block |
||
134 | 134 | |
135 | 135 | array( |
136 | 136 | 'type' => 'radio', |
137 | - 'name' => __( 'Multiple Choice', 'invoicing' ), |
|
137 | + 'name' => __('Multiple Choice', 'invoicing'), |
|
138 | 138 | 'defaults' => array( |
139 | - 'label' => __( 'Select one choice', 'invoicing' ), |
|
139 | + 'label' => __('Select one choice', 'invoicing'), |
|
140 | 140 | 'options' => array( |
141 | - esc_attr__( 'Choice One', 'invoicing' ), |
|
142 | - esc_attr__( 'Choice Two', 'invoicing' ), |
|
143 | - esc_attr__( 'Choice Three', 'invoicing' ) |
|
141 | + esc_attr__('Choice One', 'invoicing'), |
|
142 | + esc_attr__('Choice Two', 'invoicing'), |
|
143 | + esc_attr__('Choice Three', 'invoicing') |
|
144 | 144 | ), |
145 | 145 | ) |
146 | 146 | ), |
147 | 147 | |
148 | 148 | array( |
149 | 149 | 'type' => 'date', |
150 | - 'name' => __( 'Date', 'invoicing' ), |
|
150 | + 'name' => __('Date', 'invoicing'), |
|
151 | 151 | 'defaults' => array( |
152 | 152 | 'placeholder' => '', |
153 | 153 | 'value' => '', |
154 | - 'label' => __( 'Date', 'invoicing' ), |
|
154 | + 'label' => __('Date', 'invoicing'), |
|
155 | 155 | 'description' => '', |
156 | 156 | 'required' => false, |
157 | 157 | ) |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | |
160 | 160 | array( |
161 | 161 | 'type' => 'time', |
162 | - 'name' => __( 'Time', 'invoicing' ), |
|
162 | + 'name' => __('Time', 'invoicing'), |
|
163 | 163 | 'defaults' => array( |
164 | 164 | 'placeholder' => '', |
165 | 165 | 'value' => '', |
166 | - 'label' => __( 'Time', 'invoicing' ), |
|
166 | + 'label' => __('Time', 'invoicing'), |
|
167 | 167 | 'description' => '', |
168 | 168 | 'required' => false, |
169 | 169 | ) |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | |
172 | 172 | array( |
173 | 173 | 'type' => 'number', |
174 | - 'name' => __( 'Number', 'invoicing' ), |
|
174 | + 'name' => __('Number', 'invoicing'), |
|
175 | 175 | 'defaults' => array( |
176 | 176 | 'placeholder' => '', |
177 | 177 | 'value' => '', |
178 | - 'label' => __( 'Number', 'invoicing' ), |
|
178 | + 'label' => __('Number', 'invoicing'), |
|
179 | 179 | 'description' => '', |
180 | 180 | 'required' => false, |
181 | 181 | ) |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | |
184 | 184 | array( |
185 | 185 | 'type' => 'website', |
186 | - 'name' => __( 'Website', 'invoicing' ), |
|
186 | + 'name' => __('Website', 'invoicing'), |
|
187 | 187 | 'defaults' => array( |
188 | 188 | 'placeholder' => 'http://example.com', |
189 | 189 | 'value' => '', |
190 | - 'label' => __( 'Website', 'invoicing' ), |
|
190 | + 'label' => __('Website', 'invoicing'), |
|
191 | 191 | 'description' => '', |
192 | 192 | 'required' => false, |
193 | 193 | ) |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | |
196 | 196 | array( |
197 | 197 | 'type' => 'email', |
198 | - 'name' => __( 'Email', 'invoicing' ), |
|
198 | + 'name' => __('Email', 'invoicing'), |
|
199 | 199 | 'defaults' => array( |
200 | 200 | 'placeholder' => '[email protected]', |
201 | 201 | 'value' => '', |
202 | - 'label' => __( 'Email Address', 'invoicing' ), |
|
202 | + 'label' => __('Email Address', 'invoicing'), |
|
203 | 203 | 'description' => '', |
204 | 204 | 'required' => false, |
205 | 205 | ) |
@@ -207,18 +207,18 @@ discard block |
||
207 | 207 | |
208 | 208 | array( |
209 | 209 | 'type' => 'discount', |
210 | - 'name' => __( 'Discount Input', 'invoicing' ), |
|
210 | + 'name' => __('Discount Input', 'invoicing'), |
|
211 | 211 | 'defaults' => array( |
212 | 212 | 'value' => '', |
213 | - 'input_label' => __( 'Coupon Code', 'invoicing' ), |
|
214 | - 'button_label' => __( 'Apply Coupon', 'invoicing' ), |
|
215 | - 'description' => __( 'Have a discount code? Enter it above.', 'invoicing' ), |
|
213 | + 'input_label' => __('Coupon Code', 'invoicing'), |
|
214 | + 'button_label' => __('Apply Coupon', 'invoicing'), |
|
215 | + 'description' => __('Have a discount code? Enter it above.', 'invoicing'), |
|
216 | 216 | ) |
217 | 217 | ), |
218 | 218 | |
219 | 219 | array( |
220 | 220 | 'type' => 'items', |
221 | - 'name' => __( 'Items', 'invoicing' ), |
|
221 | + 'name' => __('Items', 'invoicing'), |
|
222 | 222 | 'defaults' => array( |
223 | 223 | 'value' => '', |
224 | 224 | 'items_type' => 'total', |
@@ -228,24 +228,24 @@ discard block |
||
228 | 228 | |
229 | 229 | array( |
230 | 230 | 'type' => 'pay_button', |
231 | - 'name' => __( 'Payment Button', 'invoicing' ), |
|
231 | + 'name' => __('Payment Button', 'invoicing'), |
|
232 | 232 | 'defaults' => array( |
233 | 233 | 'value' => '', |
234 | 234 | 'class' => 'btn-primary', |
235 | - 'label' => __( 'Pay Now »', 'invoicing' ), |
|
236 | - 'description' => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
235 | + 'label' => __('Pay Now »', 'invoicing'), |
|
236 | + 'description' => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
237 | 237 | ) |
238 | 238 | ) |
239 | 239 | ); |
240 | 240 | |
241 | - $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements ); |
|
241 | + $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements); |
|
242 | 242 | return $this->elements; |
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
246 | 246 | * Returns the restrict markup. |
247 | 247 | */ |
248 | - public function get_restrict_markup( $field, $field_type ) { |
|
248 | + public function get_restrict_markup($field, $field_type) { |
|
249 | 249 | $restrict = "$field.type=='$field_type'"; |
250 | 250 | return "v-if=\"$restrict\""; |
251 | 251 | } |
@@ -253,15 +253,15 @@ discard block |
||
253 | 253 | /** |
254 | 254 | * Renders the title element template. |
255 | 255 | */ |
256 | - public function render_heading_template( $field ) { |
|
257 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
256 | + public function render_heading_template($field) { |
|
257 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
258 | 258 | echo "<component :is='$field.level' $restrict v-html='$field.text'></component>"; |
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
262 | 262 | * Renders the title element on the frontend. |
263 | 263 | */ |
264 | - public function frontend_render_heading_template( $field ) { |
|
264 | + public function frontend_render_heading_template($field) { |
|
265 | 265 | $tag = $field['level']; |
266 | 266 | echo "<$tag>{$field['text']}</$tag>"; |
267 | 267 | } |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | /** |
270 | 270 | * Renders the edit title element template. |
271 | 271 | */ |
272 | - public function edit_heading_template( $field ) { |
|
273 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
274 | - $label = __( 'Heading', 'invoicing' ); |
|
275 | - $label2 = __( 'Select Heading Level', 'invoicing' ); |
|
272 | + public function edit_heading_template($field) { |
|
273 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
274 | + $label = __('Heading', 'invoicing'); |
|
275 | + $label2 = __('Select Heading Level', 'invoicing'); |
|
276 | 276 | $id = $field . '.id + "_edit"'; |
277 | 277 | $id2 = $field . '.id + "_edit2"'; |
278 | 278 | |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | /** |
305 | 305 | * Renders a paragraph element template. |
306 | 306 | */ |
307 | - public function render_paragraph_template( $field ) { |
|
308 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
307 | + public function render_paragraph_template($field) { |
|
308 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
309 | 309 | $label = "$field.text"; |
310 | 310 | echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>"; |
311 | 311 | } |
@@ -313,16 +313,16 @@ discard block |
||
313 | 313 | /** |
314 | 314 | * Renders the paragraph element on the frontend. |
315 | 315 | */ |
316 | - public function frontend_render_paragraph_template( $field ) { |
|
316 | + public function frontend_render_paragraph_template($field) { |
|
317 | 317 | echo "<p>{$field['text']}</p>"; |
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
321 | 321 | * Renders the edit paragraph element template. |
322 | 322 | */ |
323 | - public function edit_paragraph_template( $field ) { |
|
324 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
325 | - $label = __( 'Enter your text', 'invoicing' ); |
|
323 | + public function edit_paragraph_template($field) { |
|
324 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
325 | + $label = __('Enter your text', 'invoicing'); |
|
326 | 326 | $id = $field . '.id + "_edit"'; |
327 | 327 | echo " |
328 | 328 | <div $restrict> |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | /** |
339 | 339 | * Renders the text element template. |
340 | 340 | */ |
341 | - public function render_text_template( $field ) { |
|
342 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
341 | + public function render_text_template($field) { |
|
342 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
343 | 343 | $label = "$field.label"; |
344 | 344 | echo " |
345 | 345 | <div $restrict> |
@@ -353,23 +353,23 @@ discard block |
||
353 | 353 | /** |
354 | 354 | * Renders the text element on the frontend. |
355 | 355 | */ |
356 | - public function frontend_render_text_template( $field ) { |
|
356 | + public function frontend_render_text_template($field) { |
|
357 | 357 | |
358 | 358 | echo "<div class='form-group'>"; |
359 | 359 | |
360 | 360 | echo aui()->input( |
361 | 361 | array( |
362 | - 'name' => esc_attr( $field['id'] ), |
|
363 | - 'id' => esc_attr( $field['id'] ), |
|
364 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
362 | + 'name' => esc_attr($field['id']), |
|
363 | + 'id' => esc_attr($field['id']), |
|
364 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
365 | 365 | 'required' => (bool) $field['required'], |
366 | - 'label' => wp_kses_post( $field['label'] ), |
|
366 | + 'label' => wp_kses_post($field['label']), |
|
367 | 367 | 'no_wrap' => true, |
368 | 368 | ) |
369 | 369 | ); |
370 | 370 | |
371 | - if ( ! empty( $field['description'] ) ) { |
|
372 | - $description = wp_kses_post( $field['description'] ); |
|
371 | + if (!empty($field['description'])) { |
|
372 | + $description = wp_kses_post($field['description']); |
|
373 | 373 | echo "<small class='form-text text-muted'>$description</small>"; |
374 | 374 | } |
375 | 375 | |
@@ -380,16 +380,16 @@ discard block |
||
380 | 380 | /** |
381 | 381 | * Renders the edit text element template. |
382 | 382 | */ |
383 | - public function edit_text_template( $field ) { |
|
384 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
385 | - $label = __( 'Field Label', 'invoicing' ); |
|
383 | + public function edit_text_template($field) { |
|
384 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
385 | + $label = __('Field Label', 'invoicing'); |
|
386 | 386 | $id = $field . '.id + "_edit"'; |
387 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
387 | + $label2 = __('Placeholder text', 'invoicing'); |
|
388 | 388 | $id2 = $field . '.id + "_edit2"'; |
389 | - $label3 = __( 'Help text', 'invoicing' ); |
|
390 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
389 | + $label3 = __('Help text', 'invoicing'); |
|
390 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
391 | 391 | $id3 = $field . '.id + "_edit3"'; |
392 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
392 | + $label5 = __('Is this field required?', 'invoicing'); |
|
393 | 393 | $id4 = $field . '.id + "_edit4"'; |
394 | 394 | echo " |
395 | 395 | <div $restrict> |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | /** |
418 | 418 | * Renders the textarea element template. |
419 | 419 | */ |
420 | - public function render_textarea_template( $field ) { |
|
421 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
420 | + public function render_textarea_template($field) { |
|
421 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
422 | 422 | $label = "$field.label"; |
423 | 423 | echo " |
424 | 424 | <div $restrict> |
@@ -432,24 +432,24 @@ discard block |
||
432 | 432 | /** |
433 | 433 | * Renders the textarea element on the frontend. |
434 | 434 | */ |
435 | - public function frontend_render_textarea_template( $field ) { |
|
435 | + public function frontend_render_textarea_template($field) { |
|
436 | 436 | |
437 | 437 | echo "<div class='form-group'>"; |
438 | 438 | |
439 | 439 | echo aui()->textarea( |
440 | 440 | array( |
441 | - 'name' => esc_attr( $field['id'] ), |
|
442 | - 'id' => esc_attr( $field['id'] ), |
|
443 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
441 | + 'name' => esc_attr($field['id']), |
|
442 | + 'id' => esc_attr($field['id']), |
|
443 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
444 | 444 | 'required' => (bool) $field['required'], |
445 | - 'label' => wp_kses_post( $field['label'] ), |
|
445 | + 'label' => wp_kses_post($field['label']), |
|
446 | 446 | 'no_wrap' => true, |
447 | 447 | 'rows' => 3, |
448 | 448 | ) |
449 | 449 | ); |
450 | 450 | |
451 | - if ( ! empty( $field['description'] ) ) { |
|
452 | - $description = wp_kses_post( $field['description'] ); |
|
451 | + if (!empty($field['description'])) { |
|
452 | + $description = wp_kses_post($field['description']); |
|
453 | 453 | echo "<small class='form-text text-muted'>$description</small>"; |
454 | 454 | } |
455 | 455 | |
@@ -460,16 +460,16 @@ discard block |
||
460 | 460 | /** |
461 | 461 | * Renders the edit textarea element template. |
462 | 462 | */ |
463 | - public function edit_textarea_template( $field ) { |
|
464 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
465 | - $label = __( 'Field Label', 'invoicing' ); |
|
463 | + public function edit_textarea_template($field) { |
|
464 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
465 | + $label = __('Field Label', 'invoicing'); |
|
466 | 466 | $id = $field . '.id + "_edit"'; |
467 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
467 | + $label2 = __('Placeholder text', 'invoicing'); |
|
468 | 468 | $id2 = $field . '.id + "_edit2"'; |
469 | - $label3 = __( 'Help text', 'invoicing' ); |
|
470 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
469 | + $label3 = __('Help text', 'invoicing'); |
|
470 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
471 | 471 | $id3 = $field . '.id + "_edit3"'; |
472 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
472 | + $label5 = __('Is this field required?', 'invoicing'); |
|
473 | 473 | $id4 = $field . '.id + "_edit4"'; |
474 | 474 | echo " |
475 | 475 | <div $restrict> |
@@ -497,8 +497,8 @@ discard block |
||
497 | 497 | /** |
498 | 498 | * Renders the select element template. |
499 | 499 | */ |
500 | - public function render_select_template( $field ) { |
|
501 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
500 | + public function render_select_template($field) { |
|
501 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
502 | 502 | $label = "$field.label"; |
503 | 503 | $placeholder = "$field.placeholder"; |
504 | 504 | $id = $field . '.id'; |
@@ -517,24 +517,24 @@ discard block |
||
517 | 517 | /** |
518 | 518 | * Renders the select element on the frontend. |
519 | 519 | */ |
520 | - public function frontend_render_select_template( $field ) { |
|
520 | + public function frontend_render_select_template($field) { |
|
521 | 521 | |
522 | 522 | echo "<div class='form-group'>"; |
523 | 523 | |
524 | 524 | echo aui()->select( |
525 | 525 | array( |
526 | - 'name' => esc_attr( $field['id'] ), |
|
527 | - 'id' => esc_attr( $field['id'] ), |
|
528 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
526 | + 'name' => esc_attr($field['id']), |
|
527 | + 'id' => esc_attr($field['id']), |
|
528 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
529 | 529 | 'required' => (bool) $field['required'], |
530 | - 'label' => wp_kses_post( $field['label'] ), |
|
530 | + 'label' => wp_kses_post($field['label']), |
|
531 | 531 | 'no_wrap' => true, |
532 | 532 | 'options' => $field['options'], |
533 | 533 | ) |
534 | 534 | ); |
535 | 535 | |
536 | - if ( ! empty( $field['description'] ) ) { |
|
537 | - $description = wp_kses_post( $field['description'] ); |
|
536 | + if (!empty($field['description'])) { |
|
537 | + $description = wp_kses_post($field['description']); |
|
538 | 538 | echo "<small class='form-text text-muted'>$description</small>"; |
539 | 539 | } |
540 | 540 | |
@@ -545,18 +545,18 @@ discard block |
||
545 | 545 | /** |
546 | 546 | * Renders the edit select element template. |
547 | 547 | */ |
548 | - public function edit_select_template( $field ) { |
|
549 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
550 | - $label = __( 'Field Label', 'invoicing' ); |
|
548 | + public function edit_select_template($field) { |
|
549 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
550 | + $label = __('Field Label', 'invoicing'); |
|
551 | 551 | $id = $field . '.id + "_edit"'; |
552 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
552 | + $label2 = __('Placeholder text', 'invoicing'); |
|
553 | 553 | $id2 = $field . '.id + "_edit2"'; |
554 | - $label3 = __( 'Help text', 'invoicing' ); |
|
555 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
554 | + $label3 = __('Help text', 'invoicing'); |
|
555 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
556 | 556 | $id3 = $field . '.id + "_edit3"'; |
557 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
557 | + $label5 = __('Is this field required?', 'invoicing'); |
|
558 | 558 | $id4 = $field . '.id + "_edit4"'; |
559 | - $label6 = __( 'Available Options', 'invoicing' ); |
|
559 | + $label6 = __('Available Options', 'invoicing'); |
|
560 | 560 | echo " |
561 | 561 | <div $restrict> |
562 | 562 | <div class='form-group'> |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | /** |
595 | 595 | * Renders the checkbox element template. |
596 | 596 | */ |
597 | - public function render_checkbox_template( $field ) { |
|
598 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
597 | + public function render_checkbox_template($field) { |
|
598 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
599 | 599 | $label = "$field.label"; |
600 | 600 | echo " |
601 | 601 | <div class='form-check' $restrict> |
@@ -609,23 +609,23 @@ discard block |
||
609 | 609 | /** |
610 | 610 | * Renders the checkbox element on the frontend. |
611 | 611 | */ |
612 | - public function frontend_render_checkbox_template( $field ) { |
|
612 | + public function frontend_render_checkbox_template($field) { |
|
613 | 613 | |
614 | 614 | echo "<div class='form-group'>"; |
615 | 615 | |
616 | 616 | echo aui()->input( |
617 | 617 | array( |
618 | - 'name' => esc_attr( $field['id'] ), |
|
619 | - 'id' => esc_attr( $field['id'] ), |
|
618 | + 'name' => esc_attr($field['id']), |
|
619 | + 'id' => esc_attr($field['id']), |
|
620 | 620 | 'required' => (bool) $field['required'], |
621 | - 'label' => wp_kses_post( $field['label'] ), |
|
621 | + 'label' => wp_kses_post($field['label']), |
|
622 | 622 | 'no_wrap' => true, |
623 | 623 | 'type' => 'checkbox', |
624 | 624 | ) |
625 | 625 | ); |
626 | 626 | |
627 | - if ( ! empty( $field['description'] ) ) { |
|
628 | - $description = wp_kses_post( $field['description'] ); |
|
627 | + if (!empty($field['description'])) { |
|
628 | + $description = wp_kses_post($field['description']); |
|
629 | 629 | echo "<small class='form-text text-muted'>$description</small>"; |
630 | 630 | } |
631 | 631 | |
@@ -636,14 +636,14 @@ discard block |
||
636 | 636 | /** |
637 | 637 | * Renders the edit checkbox element template. |
638 | 638 | */ |
639 | - public function edit_checkbox_template( $field ) { |
|
640 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
641 | - $label = __( 'Field Label', 'invoicing' ); |
|
639 | + public function edit_checkbox_template($field) { |
|
640 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
641 | + $label = __('Field Label', 'invoicing'); |
|
642 | 642 | $id = $field . '.id + "_edit"'; |
643 | - $label2 = __( 'Help text', 'invoicing' ); |
|
644 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
643 | + $label2 = __('Help text', 'invoicing'); |
|
644 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
645 | 645 | $id2 = $field . '.id + "_edit2"'; |
646 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
646 | + $label4 = __('Is this field required?', 'invoicing'); |
|
647 | 647 | $id3 = $field . '.id + "_edit3"'; |
648 | 648 | echo " |
649 | 649 | <div $restrict> |
@@ -667,8 +667,8 @@ discard block |
||
667 | 667 | /** |
668 | 668 | * Renders the radio element template. |
669 | 669 | */ |
670 | - public function render_radio_template( $field ) { |
|
671 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
670 | + public function render_radio_template($field) { |
|
671 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
672 | 672 | $label = "$field.label"; |
673 | 673 | $id = $field . '.id'; |
674 | 674 | echo " |
@@ -686,19 +686,19 @@ discard block |
||
686 | 686 | /** |
687 | 687 | * Renders the radio element on the frontend. |
688 | 688 | */ |
689 | - public function frontend_render_radio_template( $field ) { |
|
689 | + public function frontend_render_radio_template($field) { |
|
690 | 690 | |
691 | 691 | echo "<div class='form-group'>"; |
692 | 692 | |
693 | - if ( ! empty( $field['label'] ) ) { |
|
694 | - $label = wp_kses_post( $field['label'] ); |
|
693 | + if (!empty($field['label'])) { |
|
694 | + $label = wp_kses_post($field['label']); |
|
695 | 695 | echo "<legend class='col-form-label'>$label</legend>"; |
696 | 696 | } |
697 | 697 | |
698 | - foreach( $field['options'] as $index => $option ) { |
|
698 | + foreach ($field['options'] as $index => $option) { |
|
699 | 699 | $id = $field['id'] . $index; |
700 | - $value = esc_attr( $option ); |
|
701 | - $label = wp_kses_post( $option ); |
|
700 | + $value = esc_attr($option); |
|
701 | + $label = wp_kses_post($option); |
|
702 | 702 | |
703 | 703 | echo " |
704 | 704 | <div class='form-check'> |
@@ -708,8 +708,8 @@ discard block |
||
708 | 708 | "; |
709 | 709 | } |
710 | 710 | |
711 | - if ( ! empty( $field['description'] ) ) { |
|
712 | - $description = wp_kses_post( $field['description'] ); |
|
711 | + if (!empty($field['description'])) { |
|
712 | + $description = wp_kses_post($field['description']); |
|
713 | 713 | echo "<small class='form-text text-muted'>$description</small>"; |
714 | 714 | } |
715 | 715 | |
@@ -720,16 +720,16 @@ discard block |
||
720 | 720 | /** |
721 | 721 | * Renders the edit radio element template. |
722 | 722 | */ |
723 | - public function edit_radio_template( $field ) { |
|
724 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
725 | - $label = __( 'Field Label', 'invoicing' ); |
|
723 | + public function edit_radio_template($field) { |
|
724 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
725 | + $label = __('Field Label', 'invoicing'); |
|
726 | 726 | $id = $field . '.id + "_edit"'; |
727 | - $label2 = __( 'Help text', 'invoicing' ); |
|
728 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
727 | + $label2 = __('Help text', 'invoicing'); |
|
728 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
729 | 729 | $id2 = $field . '.id + "_edit3"'; |
730 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
730 | + $label4 = __('Is this field required?', 'invoicing'); |
|
731 | 731 | $id3 = $field . '.id + "_edit4"'; |
732 | - $label5 = __( 'Available Options', 'invoicing' ); |
|
732 | + $label5 = __('Available Options', 'invoicing'); |
|
733 | 733 | echo " |
734 | 734 | <div $restrict> |
735 | 735 | <div class='form-group'> |
@@ -763,8 +763,8 @@ discard block |
||
763 | 763 | /** |
764 | 764 | * Renders the email element template. |
765 | 765 | */ |
766 | - public function render_email_template( $field ) { |
|
767 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
766 | + public function render_email_template($field) { |
|
767 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
768 | 768 | $label = "$field.label"; |
769 | 769 | echo " |
770 | 770 | <div $restrict> |
@@ -778,23 +778,23 @@ discard block |
||
778 | 778 | /** |
779 | 779 | * Renders the email element on the frontend. |
780 | 780 | */ |
781 | - public function frontend_render_email_template( $field ) { |
|
781 | + public function frontend_render_email_template($field) { |
|
782 | 782 | |
783 | 783 | echo "<div class='form-group'>"; |
784 | 784 | |
785 | 785 | echo aui()->input( |
786 | 786 | array( |
787 | - 'name' => esc_attr( $field['id'] ), |
|
788 | - 'id' => esc_attr( $field['id'] ), |
|
787 | + 'name' => esc_attr($field['id']), |
|
788 | + 'id' => esc_attr($field['id']), |
|
789 | 789 | 'required' => (bool) $field['required'], |
790 | - 'label' => wp_kses_post( $field['label'] ), |
|
790 | + 'label' => wp_kses_post($field['label']), |
|
791 | 791 | 'no_wrap' => true, |
792 | 792 | 'type' => 'email', |
793 | 793 | ) |
794 | 794 | ); |
795 | 795 | |
796 | - if ( ! empty( $field['description'] ) ) { |
|
797 | - $description = wp_kses_post( $field['description'] ); |
|
796 | + if (!empty($field['description'])) { |
|
797 | + $description = wp_kses_post($field['description']); |
|
798 | 798 | echo "<small class='form-text text-muted'>$description</small>"; |
799 | 799 | } |
800 | 800 | |
@@ -805,16 +805,16 @@ discard block |
||
805 | 805 | /** |
806 | 806 | * Renders the edit email element template. |
807 | 807 | */ |
808 | - public function edit_email_template( $field ) { |
|
809 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
810 | - $label = __( 'Field Label', 'invoicing' ); |
|
808 | + public function edit_email_template($field) { |
|
809 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
810 | + $label = __('Field Label', 'invoicing'); |
|
811 | 811 | $id = $field . '.id + "_edit"'; |
812 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
812 | + $label2 = __('Placeholder text', 'invoicing'); |
|
813 | 813 | $id2 = $field . '.id + "_edit2"'; |
814 | - $label3 = __( 'Help text', 'invoicing' ); |
|
815 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
814 | + $label3 = __('Help text', 'invoicing'); |
|
815 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
816 | 816 | $id3 = $field . '.id + "_edit3"'; |
817 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
817 | + $label5 = __('Is this field required?', 'invoicing'); |
|
818 | 818 | $id4 = $field . '.id + "_edit4"'; |
819 | 819 | echo " |
820 | 820 | <div $restrict> |
@@ -842,8 +842,8 @@ discard block |
||
842 | 842 | /** |
843 | 843 | * Renders the website element template. |
844 | 844 | */ |
845 | - public function render_website_template( $field ) { |
|
846 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
845 | + public function render_website_template($field) { |
|
846 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
847 | 847 | $label = "$field.label"; |
848 | 848 | echo " |
849 | 849 | <div $restrict> |
@@ -857,23 +857,23 @@ discard block |
||
857 | 857 | /** |
858 | 858 | * Renders the website element on the frontend. |
859 | 859 | */ |
860 | - public function frontend_render_website_template( $field ) { |
|
860 | + public function frontend_render_website_template($field) { |
|
861 | 861 | |
862 | 862 | echo "<div class='form-group'>"; |
863 | 863 | |
864 | 864 | echo aui()->input( |
865 | 865 | array( |
866 | - 'name' => esc_attr( $field['id'] ), |
|
867 | - 'id' => esc_attr( $field['id'] ), |
|
866 | + 'name' => esc_attr($field['id']), |
|
867 | + 'id' => esc_attr($field['id']), |
|
868 | 868 | 'required' => (bool) $field['required'], |
869 | - 'label' => wp_kses_post( $field['label'] ), |
|
869 | + 'label' => wp_kses_post($field['label']), |
|
870 | 870 | 'no_wrap' => true, |
871 | 871 | 'type' => 'url', |
872 | 872 | ) |
873 | 873 | ); |
874 | 874 | |
875 | - if ( ! empty( $field['description'] ) ) { |
|
876 | - $description = wp_kses_post( $field['description'] ); |
|
875 | + if (!empty($field['description'])) { |
|
876 | + $description = wp_kses_post($field['description']); |
|
877 | 877 | echo "<small class='form-text text-muted'>$description</small>"; |
878 | 878 | } |
879 | 879 | |
@@ -884,16 +884,16 @@ discard block |
||
884 | 884 | /** |
885 | 885 | * Renders the edit website element template. |
886 | 886 | */ |
887 | - public function edit_website_template( $field ) { |
|
888 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
889 | - $label = __( 'Field Label', 'invoicing' ); |
|
887 | + public function edit_website_template($field) { |
|
888 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
889 | + $label = __('Field Label', 'invoicing'); |
|
890 | 890 | $id = $field . '.id + "_edit"'; |
891 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
891 | + $label2 = __('Placeholder text', 'invoicing'); |
|
892 | 892 | $id2 = $field . '.id + "_edit2"'; |
893 | - $label3 = __( 'Help text', 'invoicing' ); |
|
894 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
893 | + $label3 = __('Help text', 'invoicing'); |
|
894 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
895 | 895 | $id3 = $field . '.id + "_edit3"'; |
896 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
896 | + $label5 = __('Is this field required?', 'invoicing'); |
|
897 | 897 | $id4 = $field . '.id + "_edit4"'; |
898 | 898 | echo " |
899 | 899 | <div $restrict> |
@@ -921,8 +921,8 @@ discard block |
||
921 | 921 | /** |
922 | 922 | * Renders the date element template. |
923 | 923 | */ |
924 | - public function render_date_template( $field ) { |
|
925 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
924 | + public function render_date_template($field) { |
|
925 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
926 | 926 | $label = "$field.label"; |
927 | 927 | echo " |
928 | 928 | <div $restrict> |
@@ -936,23 +936,23 @@ discard block |
||
936 | 936 | /** |
937 | 937 | * Renders the date element on the frontend. |
938 | 938 | */ |
939 | - public function frontend_render_date_template( $field ) { |
|
939 | + public function frontend_render_date_template($field) { |
|
940 | 940 | |
941 | 941 | echo "<div class='form-group'>"; |
942 | 942 | |
943 | 943 | echo aui()->input( |
944 | 944 | array( |
945 | - 'name' => esc_attr( $field['id'] ), |
|
946 | - 'id' => esc_attr( $field['id'] ), |
|
945 | + 'name' => esc_attr($field['id']), |
|
946 | + 'id' => esc_attr($field['id']), |
|
947 | 947 | 'required' => (bool) $field['required'], |
948 | - 'label' => wp_kses_post( $field['label'] ), |
|
948 | + 'label' => wp_kses_post($field['label']), |
|
949 | 949 | 'no_wrap' => true, |
950 | 950 | 'type' => 'date', |
951 | 951 | ) |
952 | 952 | ); |
953 | 953 | |
954 | - if ( ! empty( $field['description'] ) ) { |
|
955 | - $description = wp_kses_post( $field['description'] ); |
|
954 | + if (!empty($field['description'])) { |
|
955 | + $description = wp_kses_post($field['description']); |
|
956 | 956 | echo "<small class='form-text text-muted'>$description</small>"; |
957 | 957 | } |
958 | 958 | |
@@ -963,16 +963,16 @@ discard block |
||
963 | 963 | /** |
964 | 964 | * Renders the edit date element template. |
965 | 965 | */ |
966 | - public function edit_date_template( $field ) { |
|
967 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
968 | - $label = __( 'Field Label', 'invoicing' ); |
|
966 | + public function edit_date_template($field) { |
|
967 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
968 | + $label = __('Field Label', 'invoicing'); |
|
969 | 969 | $id = $field . '.id + "_edit"'; |
970 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
970 | + $label2 = __('Placeholder text', 'invoicing'); |
|
971 | 971 | $id2 = $field . '.id + "_edit2"'; |
972 | - $label3 = __( 'Help text', 'invoicing' ); |
|
973 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
972 | + $label3 = __('Help text', 'invoicing'); |
|
973 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
974 | 974 | $id3 = $field . '.id + "_edit3"'; |
975 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
975 | + $label5 = __('Is this field required?', 'invoicing'); |
|
976 | 976 | $id4 = $field . '.id + "_edit4"'; |
977 | 977 | echo " |
978 | 978 | <div $restrict> |
@@ -1000,8 +1000,8 @@ discard block |
||
1000 | 1000 | /** |
1001 | 1001 | * Renders the time element template. |
1002 | 1002 | */ |
1003 | - public function render_time_template( $field ) { |
|
1004 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
1003 | + public function render_time_template($field) { |
|
1004 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
1005 | 1005 | $label = "$field.label"; |
1006 | 1006 | echo " |
1007 | 1007 | <div $restrict> |
@@ -1015,23 +1015,23 @@ discard block |
||
1015 | 1015 | /** |
1016 | 1016 | * Renders the time element on the frontend. |
1017 | 1017 | */ |
1018 | - public function frontend_render_time_template( $field ) { |
|
1018 | + public function frontend_render_time_template($field) { |
|
1019 | 1019 | |
1020 | 1020 | echo "<div class='form-group'>"; |
1021 | 1021 | |
1022 | 1022 | echo aui()->input( |
1023 | 1023 | array( |
1024 | - 'name' => esc_attr( $field['id'] ), |
|
1025 | - 'id' => esc_attr( $field['id'] ), |
|
1024 | + 'name' => esc_attr($field['id']), |
|
1025 | + 'id' => esc_attr($field['id']), |
|
1026 | 1026 | 'required' => (bool) $field['required'], |
1027 | - 'label' => wp_kses_post( $field['label'] ), |
|
1027 | + 'label' => wp_kses_post($field['label']), |
|
1028 | 1028 | 'no_wrap' => true, |
1029 | 1029 | 'type' => 'time', |
1030 | 1030 | ) |
1031 | 1031 | ); |
1032 | 1032 | |
1033 | - if ( ! empty( $field['description'] ) ) { |
|
1034 | - $description = wp_kses_post( $field['description'] ); |
|
1033 | + if (!empty($field['description'])) { |
|
1034 | + $description = wp_kses_post($field['description']); |
|
1035 | 1035 | echo "<small class='form-text text-muted'>$description</small>"; |
1036 | 1036 | } |
1037 | 1037 | |
@@ -1042,16 +1042,16 @@ discard block |
||
1042 | 1042 | /** |
1043 | 1043 | * Renders the edit time element template. |
1044 | 1044 | */ |
1045 | - public function edit_time_template( $field ) { |
|
1046 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
1047 | - $label = __( 'Field Label', 'invoicing' ); |
|
1045 | + public function edit_time_template($field) { |
|
1046 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
1047 | + $label = __('Field Label', 'invoicing'); |
|
1048 | 1048 | $id = $field . '.id + "_edit"'; |
1049 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1049 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1050 | 1050 | $id2 = $field . '.id + "_edit2"'; |
1051 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1052 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1051 | + $label3 = __('Help text', 'invoicing'); |
|
1052 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1053 | 1053 | $id3 = $field . '.id + "_edit3"'; |
1054 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1054 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1055 | 1055 | $id4 = $field . '.id + "_edit4"'; |
1056 | 1056 | echo " |
1057 | 1057 | <div $restrict> |
@@ -1079,8 +1079,8 @@ discard block |
||
1079 | 1079 | /** |
1080 | 1080 | * Renders the number element template. |
1081 | 1081 | */ |
1082 | - public function render_number_template( $field ) { |
|
1083 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
1082 | + public function render_number_template($field) { |
|
1083 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
1084 | 1084 | $label = "$field.label"; |
1085 | 1085 | echo " |
1086 | 1086 | <div $restrict> |
@@ -1094,23 +1094,23 @@ discard block |
||
1094 | 1094 | /** |
1095 | 1095 | * Renders the number element on the frontend. |
1096 | 1096 | */ |
1097 | - public function frontend_render_number_template( $field ) { |
|
1097 | + public function frontend_render_number_template($field) { |
|
1098 | 1098 | |
1099 | 1099 | echo "<div class='form-group'>"; |
1100 | 1100 | |
1101 | 1101 | echo aui()->input( |
1102 | 1102 | array( |
1103 | - 'name' => esc_attr( $field['id'] ), |
|
1104 | - 'id' => esc_attr( $field['id'] ), |
|
1103 | + 'name' => esc_attr($field['id']), |
|
1104 | + 'id' => esc_attr($field['id']), |
|
1105 | 1105 | 'required' => (bool) $field['required'], |
1106 | - 'label' => wp_kses_post( $field['label'] ), |
|
1106 | + 'label' => wp_kses_post($field['label']), |
|
1107 | 1107 | 'no_wrap' => true, |
1108 | 1108 | 'type' => 'number', |
1109 | 1109 | ) |
1110 | 1110 | ); |
1111 | 1111 | |
1112 | - if ( ! empty( $field['description'] ) ) { |
|
1113 | - $description = wp_kses_post( $field['description'] ); |
|
1112 | + if (!empty($field['description'])) { |
|
1113 | + $description = wp_kses_post($field['description']); |
|
1114 | 1114 | echo "<small class='form-text text-muted'>$description</small>"; |
1115 | 1115 | } |
1116 | 1116 | |
@@ -1121,16 +1121,16 @@ discard block |
||
1121 | 1121 | /** |
1122 | 1122 | * Renders the edit number element template. |
1123 | 1123 | */ |
1124 | - public function edit_number_template( $field ) { |
|
1125 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
1126 | - $label = __( 'Field Label', 'invoicing' ); |
|
1124 | + public function edit_number_template($field) { |
|
1125 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
1126 | + $label = __('Field Label', 'invoicing'); |
|
1127 | 1127 | $id = $field . '.id + "_edit"'; |
1128 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1128 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1129 | 1129 | $id2 = $field . '.id + "_edit2"'; |
1130 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1131 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1130 | + $label3 = __('Help text', 'invoicing'); |
|
1131 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1132 | 1132 | $id3 = $field . '.id + "_edit3"'; |
1133 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1133 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1134 | 1134 | $id4 = $field . '.id + "_edit4"'; |
1135 | 1135 | echo " |
1136 | 1136 | <div $restrict> |
@@ -1158,23 +1158,23 @@ discard block |
||
1158 | 1158 | /** |
1159 | 1159 | * Renders the separator element template. |
1160 | 1160 | */ |
1161 | - public function render_separator_template( $field ) { |
|
1162 | - $restrict = $this->get_restrict_markup( $field, 'separator' ); |
|
1161 | + public function render_separator_template($field) { |
|
1162 | + $restrict = $this->get_restrict_markup($field, 'separator'); |
|
1163 | 1163 | echo "<hr class='featurette-divider mt-0 mb-2' $restrict>"; |
1164 | 1164 | } |
1165 | 1165 | |
1166 | 1166 | /** |
1167 | 1167 | * Renders the separator element on the frontend. |
1168 | 1168 | */ |
1169 | - public function frontend_render_separator_template( $field ) { |
|
1169 | + public function frontend_render_separator_template($field) { |
|
1170 | 1170 | echo '<hr class="featurette-divider mt-0 mb-2" />'; |
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | /** |
1174 | 1174 | * Renders the pay button element template. |
1175 | 1175 | */ |
1176 | - public function render_pay_button_template( $field ) { |
|
1177 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
1176 | + public function render_pay_button_template($field) { |
|
1177 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
1178 | 1178 | $label = "$field.label"; |
1179 | 1179 | echo " |
1180 | 1180 | <div $restrict> |
@@ -1187,24 +1187,24 @@ discard block |
||
1187 | 1187 | /** |
1188 | 1188 | * Renders the pay_button element on the frontend. |
1189 | 1189 | */ |
1190 | - public function frontend_render_pay_button_template( $field ) { |
|
1190 | + public function frontend_render_pay_button_template($field) { |
|
1191 | 1191 | |
1192 | 1192 | echo "<div class='form-group'>"; |
1193 | 1193 | |
1194 | - $class = 'btn btn-block submit-button ' . sanitize_html_class( $field['class'] ); |
|
1194 | + $class = 'btn btn-block submit-button ' . sanitize_html_class($field['class']); |
|
1195 | 1195 | echo aui()->button( |
1196 | 1196 | array( |
1197 | - 'name' => esc_attr( $field['id'] ), |
|
1198 | - 'id' => esc_attr( $field['id'] ), |
|
1199 | - 'content' => wp_kses_post( $field['label'] ), |
|
1197 | + 'name' => esc_attr($field['id']), |
|
1198 | + 'id' => esc_attr($field['id']), |
|
1199 | + 'content' => wp_kses_post($field['label']), |
|
1200 | 1200 | 'no_wrap' => true, |
1201 | 1201 | 'type' => 'button', |
1202 | 1202 | 'class' => $class, |
1203 | 1203 | ) |
1204 | 1204 | ); |
1205 | 1205 | |
1206 | - if ( ! empty( $field['description'] ) ) { |
|
1207 | - $description = wp_kses_post( $field['description'] ); |
|
1206 | + if (!empty($field['description'])) { |
|
1207 | + $description = wp_kses_post($field['description']); |
|
1208 | 1208 | echo "<small class='form-text text-muted'>$description</small>"; |
1209 | 1209 | } |
1210 | 1210 | |
@@ -1215,14 +1215,14 @@ discard block |
||
1215 | 1215 | /** |
1216 | 1216 | * Renders the pay button element template. |
1217 | 1217 | */ |
1218 | - public function edit_pay_button_template( $field ) { |
|
1219 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
1220 | - $label = __( 'Button Text', 'invoicing' ); |
|
1218 | + public function edit_pay_button_template($field) { |
|
1219 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
1220 | + $label = __('Button Text', 'invoicing'); |
|
1221 | 1221 | $id = $field . '.id + "_edit"'; |
1222 | - $label2 = __( 'Help text', 'invoicing' ); |
|
1223 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1222 | + $label2 = __('Help text', 'invoicing'); |
|
1223 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1224 | 1224 | $id2 = $field . '.id + "_edit2"'; |
1225 | - $label4 = esc_attr__( 'Button Type', 'invoicing' ); |
|
1225 | + $label4 = esc_attr__('Button Type', 'invoicing'); |
|
1226 | 1226 | $id3 = $field . '.id + "_edit3"'; |
1227 | 1227 | echo " |
1228 | 1228 | <div $restrict> |
@@ -1238,15 +1238,15 @@ discard block |
||
1238 | 1238 | <label :for='$id3'>$label4</label> |
1239 | 1239 | |
1240 | 1240 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
1241 | - <option value='btn-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
1242 | - <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
1243 | - <option value='btn-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
1244 | - <option value='btn-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
1245 | - <option value='btn-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
1246 | - <option value='btn-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
1247 | - <option value='btn-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
1248 | - <option value='btn-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
1249 | - <option value='btn-link'>" . __( 'Link', 'invoicing' ) ."</option> |
|
1241 | + <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option> |
|
1242 | + <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
1243 | + <option value='btn-success'>" . __('Success', 'invoicing') . "</option> |
|
1244 | + <option value='btn-danger'>" . __('Danger', 'invoicing') . "</option> |
|
1245 | + <option value='btn-warning'>" . __('Warning', 'invoicing') . "</option> |
|
1246 | + <option value='btn-info'>" . __('Info', 'invoicing') . "</option> |
|
1247 | + <option value='btn-light'>" . __('Light', 'invoicing') . "</option> |
|
1248 | + <option value='btn-dark'>" . __('Dark', 'invoicing') . "</option> |
|
1249 | + <option value='btn-link'>" . __('Link', 'invoicing') . "</option> |
|
1250 | 1250 | </select> |
1251 | 1251 | </div> |
1252 | 1252 | </div> |
@@ -1257,8 +1257,8 @@ discard block |
||
1257 | 1257 | /** |
1258 | 1258 | * Renders the alert element template. |
1259 | 1259 | */ |
1260 | - public function render_alert_template( $field ) { |
|
1261 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
1260 | + public function render_alert_template($field) { |
|
1261 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
1262 | 1262 | $text = "$field.text"; |
1263 | 1263 | echo " |
1264 | 1264 | <div $restrict class='alert' :class='$field.class' role='alert'> |
@@ -1273,15 +1273,15 @@ discard block |
||
1273 | 1273 | /** |
1274 | 1274 | * Renders the alert element on the frontend. |
1275 | 1275 | */ |
1276 | - public function frontend_render_alert_template( $field ) { |
|
1276 | + public function frontend_render_alert_template($field) { |
|
1277 | 1277 | |
1278 | 1278 | echo "<div class='form-group'>"; |
1279 | 1279 | |
1280 | 1280 | echo aui()->alert( |
1281 | 1281 | array( |
1282 | - 'content' => wp_kses_post( $field['text'] ), |
|
1282 | + 'content' => wp_kses_post($field['text']), |
|
1283 | 1283 | 'dismissible' => $field['dismissible'], |
1284 | - 'type' => str_replace( 'alert-', '', $field['class'] ), |
|
1284 | + 'type' => str_replace('alert-', '', $field['class']), |
|
1285 | 1285 | ) |
1286 | 1286 | ); |
1287 | 1287 | |
@@ -1292,14 +1292,14 @@ discard block |
||
1292 | 1292 | /** |
1293 | 1293 | * Renders the alert element template. |
1294 | 1294 | */ |
1295 | - public function edit_alert_template( $field ) { |
|
1296 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
1297 | - $label = __( 'Alert Text', 'invoicing' ); |
|
1298 | - $label2 = esc_attr__( 'Enter your alert text here', 'invoicing' ); |
|
1295 | + public function edit_alert_template($field) { |
|
1296 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
1297 | + $label = __('Alert Text', 'invoicing'); |
|
1298 | + $label2 = esc_attr__('Enter your alert text here', 'invoicing'); |
|
1299 | 1299 | $id = $field . '.id + "_edit"'; |
1300 | - $label3 = __( 'Is Dismissible?', 'invoicing' ); |
|
1300 | + $label3 = __('Is Dismissible?', 'invoicing'); |
|
1301 | 1301 | $id2 = $field . '.id + "_edit2"'; |
1302 | - $label4 = esc_attr__( 'Alert Type', 'invoicing' ); |
|
1302 | + $label4 = esc_attr__('Alert Type', 'invoicing'); |
|
1303 | 1303 | $id3 = $field . '.id + "_edit3"'; |
1304 | 1304 | echo " |
1305 | 1305 | <div $restrict> |
@@ -1315,14 +1315,14 @@ discard block |
||
1315 | 1315 | <label :for='$id3'>$label4</label> |
1316 | 1316 | |
1317 | 1317 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
1318 | - <option value='alert-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
1319 | - <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
1320 | - <option value='alert-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
1321 | - <option value='alert-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
1322 | - <option value='alert-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
1323 | - <option value='alert-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
1324 | - <option value='alert-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
1325 | - <option value='alert-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
1318 | + <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option> |
|
1319 | + <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
1320 | + <option value='alert-success'>" . __('Success', 'invoicing') . "</option> |
|
1321 | + <option value='alert-danger'>" . __('Danger', 'invoicing') . "</option> |
|
1322 | + <option value='alert-warning'>" . __('Warning', 'invoicing') . "</option> |
|
1323 | + <option value='alert-info'>" . __('Info', 'invoicing') . "</option> |
|
1324 | + <option value='alert-light'>" . __('Light', 'invoicing') . "</option> |
|
1325 | + <option value='alert-dark'>" . __('Dark', 'invoicing') . "</option> |
|
1326 | 1326 | </select> |
1327 | 1327 | </div> |
1328 | 1328 | </div> |
@@ -1333,8 +1333,8 @@ discard block |
||
1333 | 1333 | /** |
1334 | 1334 | * Renders the discount element template. |
1335 | 1335 | */ |
1336 | - public function render_discount_template( $field ) { |
|
1337 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
1336 | + public function render_discount_template($field) { |
|
1337 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
1338 | 1338 | ?> |
1339 | 1339 | |
1340 | 1340 | <div <?php echo $restrict; ?> class="discount_field border rounded p-3"> |
@@ -1351,13 +1351,13 @@ discard block |
||
1351 | 1351 | /** |
1352 | 1352 | * Renders the discount element on the frontend. |
1353 | 1353 | */ |
1354 | - public function frontend_render_discount_template( $field ) { |
|
1354 | + public function frontend_render_discount_template($field) { |
|
1355 | 1355 | |
1356 | - $placeholder = esc_attr( $field['input_label'] ); |
|
1357 | - $label = sanitize_text_field( $field['button_label'] ); |
|
1356 | + $placeholder = esc_attr($field['input_label']); |
|
1357 | + $label = sanitize_text_field($field['button_label']); |
|
1358 | 1358 | $description = ''; |
1359 | 1359 | |
1360 | - if ( ! empty( $field['description'] ) ) { |
|
1360 | + if (!empty($field['description'])) { |
|
1361 | 1361 | $description = "<small class='form-text text-muted'>{$field['description']}</small>"; |
1362 | 1362 | } |
1363 | 1363 | ?> |
@@ -1378,12 +1378,12 @@ discard block |
||
1378 | 1378 | /** |
1379 | 1379 | * Renders the discount element template. |
1380 | 1380 | */ |
1381 | - public function edit_discount_template( $field ) { |
|
1382 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
1383 | - $label = __( 'Discount Input Placeholder', 'invoicing' ); |
|
1384 | - $label2 = __( 'Help Text', 'invoicing' ); |
|
1385 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1386 | - $label4 = __( 'Button Text', 'invoicing' ); |
|
1381 | + public function edit_discount_template($field) { |
|
1382 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
1383 | + $label = __('Discount Input Placeholder', 'invoicing'); |
|
1384 | + $label2 = __('Help Text', 'invoicing'); |
|
1385 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1386 | + $label4 = __('Button Text', 'invoicing'); |
|
1387 | 1387 | $id = $field . '.id + "_edit"'; |
1388 | 1388 | $id2 = $field . '.id + "_edit2"'; |
1389 | 1389 | $id3 = $field . '.id + "_edit3"'; |
@@ -1412,8 +1412,8 @@ discard block |
||
1412 | 1412 | /** |
1413 | 1413 | * Renders the items element template. |
1414 | 1414 | */ |
1415 | - public function render_items_template( $field ) { |
|
1416 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
1415 | + public function render_items_template($field) { |
|
1416 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
1417 | 1417 | echo " |
1418 | 1418 | <div $restrict class='item_totals'> |
1419 | 1419 | |
@@ -1458,7 +1458,7 @@ discard block |
||
1458 | 1458 | <div v-if='$field.items_type == \"select\"'> |
1459 | 1459 | |
1460 | 1460 | <select class='form-control custom-select'> |
1461 | - <option value='' disabled selected='selected'>" . __( 'Select an option', 'invoicing' ) ."</option> |
|
1461 | + <option value='' disabled selected='selected'>" . __('Select an option', 'invoicing') . "</option> |
|
1462 | 1462 | <option v-for='(item, index) in form_items' :value='index'>{{item.title}} {{formatPrice(item.price)}}</option> |
1463 | 1463 | </select> |
1464 | 1464 | </div> |
@@ -1479,66 +1479,66 @@ discard block |
||
1479 | 1479 | /** |
1480 | 1480 | * Renders the items element on the frontend. |
1481 | 1481 | */ |
1482 | - public function frontend_render_items_template( $field, $items ) { |
|
1482 | + public function frontend_render_items_template($field, $items) { |
|
1483 | 1483 | |
1484 | 1484 | echo "<div class='form-group item_totals'>"; |
1485 | 1485 | |
1486 | - $id = esc_attr( $field['id'] ); |
|
1487 | - if ( 'total' == $field[ 'items_type' ] ) { |
|
1486 | + $id = esc_attr($field['id']); |
|
1487 | + if ('total' == $field['items_type']) { |
|
1488 | 1488 | $total = 0; |
1489 | 1489 | |
1490 | 1490 | ?> |
1491 | 1491 | <div class="border item_totals_type_total"> |
1492 | 1492 | |
1493 | 1493 | <?php |
1494 | - foreach( $items as $item ) { |
|
1495 | - $total = $total + floatval( $item['price'] ); |
|
1494 | + foreach ($items as $item) { |
|
1495 | + $total = $total + floatval($item['price']); |
|
1496 | 1496 | ?> |
1497 | 1497 | <div class="item_totals_item"> |
1498 | 1498 | <div class='row pl-2 pr-2 pt-2'> |
1499 | - <div class='col-8'><?php echo esc_html( $item['title'] ) ?></div> |
|
1500 | - <div class='col-4'><?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?></div> |
|
1499 | + <div class='col-8'><?php echo esc_html($item['title']) ?></div> |
|
1500 | + <div class='col-4'><?php echo wpinv_price(wpinv_format_amount($item['price'])) ?></div> |
|
1501 | 1501 | </div> |
1502 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1503 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1502 | + <?php if (!empty($item['description'])) { ?> |
|
1503 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1504 | 1504 | <?php } ?> |
1505 | 1505 | </div> |
1506 | 1506 | <?php } ?> |
1507 | 1507 | |
1508 | 1508 | <div class='mt-4 border-top item_totals_total'> |
1509 | 1509 | <div class='row p-2'> |
1510 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
1511 | - <div class='col-4'><strong><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
1510 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
1511 | + <div class='col-4'><strong><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
1512 | 1512 | </div> |
1513 | 1513 | </div> |
1514 | 1514 | |
1515 | 1515 | </div> |
1516 | 1516 | <?php } ?> |
1517 | 1517 | |
1518 | - <?php if ( 'radio' == $field[ 'items_type' ] ) { ?> |
|
1518 | + <?php if ('radio' == $field['items_type']) { ?> |
|
1519 | 1519 | <div class="item_totals_type_radio"> |
1520 | 1520 | |
1521 | - <?php foreach( $items as $index => $item ) { ?> |
|
1521 | + <?php foreach ($items as $index => $item) { ?> |
|
1522 | 1522 | <div class="form-check"> |
1523 | 1523 | <input class='form-check-input' type='radio' name='<?php echo $id; ?>' id='<?php echo $id . $index; ?>'> |
1524 | - <label class='form-check-label' for=<?php echo $id . $index; ?>'><?php echo sanitize_text_field( $item['title'] ); ?> <strong><?php echo wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); ?></strong></label> |
|
1524 | + <label class='form-check-label' for=<?php echo $id . $index; ?>'><?php echo sanitize_text_field($item['title']); ?> <strong><?php echo wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); ?></strong></label> |
|
1525 | 1525 | </div> |
1526 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1527 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1526 | + <?php if (!empty($item['description'])) { ?> |
|
1527 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1528 | 1528 | <?php } ?> |
1529 | 1529 | <?php } ?> |
1530 | 1530 | |
1531 | 1531 | </div> |
1532 | 1532 | <?php } ?> |
1533 | 1533 | |
1534 | - <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?> |
|
1534 | + <?php if ('checkbox' == $field['items_type']) { ?> |
|
1535 | 1535 | |
1536 | 1536 | <div class="item_totals_type_checkbox"> |
1537 | 1537 | |
1538 | 1538 | <?php |
1539 | - foreach ( $items as $index => $item ) { |
|
1540 | - $title = sanitize_text_field( $item['title'] ); |
|
1541 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
1539 | + foreach ($items as $index => $item) { |
|
1540 | + $title = sanitize_text_field($item['title']); |
|
1541 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
1542 | 1542 | echo aui()->input( |
1543 | 1543 | array( |
1544 | 1544 | 'name' => $id, |
@@ -1549,7 +1549,7 @@ discard block |
||
1549 | 1549 | ) |
1550 | 1550 | ); |
1551 | 1551 | |
1552 | - if ( ! empty( $item['description'] ) ) { |
|
1552 | + if (!empty($item['description'])) { |
|
1553 | 1553 | echo "<small class='form-text text-muted'>{$item['description']}</small>"; |
1554 | 1554 | } |
1555 | 1555 | } |
@@ -1558,7 +1558,7 @@ discard block |
||
1558 | 1558 | </div> |
1559 | 1559 | <?php } ?> |
1560 | 1560 | |
1561 | - <?php if ( 'select' == $field[ 'items_type' ] ) { ?> |
|
1561 | + <?php if ('select' == $field['items_type']) { ?> |
|
1562 | 1562 | |
1563 | 1563 | <div class="item_totals_type_select"> |
1564 | 1564 | |
@@ -1566,17 +1566,17 @@ discard block |
||
1566 | 1566 | |
1567 | 1567 | $options = array(); |
1568 | 1568 | |
1569 | - foreach ( $items as $index => $item ) { |
|
1570 | - $title = sanitize_text_field( $item['title'] ); |
|
1571 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
1572 | - $options[ $item['id'] ] = "$title ($price)"; |
|
1569 | + foreach ($items as $index => $item) { |
|
1570 | + $title = sanitize_text_field($item['title']); |
|
1571 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
1572 | + $options[$item['id']] = "$title ($price)"; |
|
1573 | 1573 | } |
1574 | 1574 | |
1575 | 1575 | echo aui()->select( |
1576 | 1576 | array( |
1577 | 1577 | 'name' => $id, |
1578 | 1578 | 'id' => $id, |
1579 | - 'placeholder' => __( 'Select an item', 'invoicing' ), |
|
1579 | + 'placeholder' => __('Select an item', 'invoicing'), |
|
1580 | 1580 | 'no_wrap' => true, |
1581 | 1581 | 'options' => $options, |
1582 | 1582 | ) |
@@ -1586,7 +1586,7 @@ discard block |
||
1586 | 1586 | </div> |
1587 | 1587 | <?php } ?> |
1588 | 1588 | |
1589 | - <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?> |
|
1589 | + <?php if ('multi_select' == $field['items_type']) { ?> |
|
1590 | 1590 | |
1591 | 1591 | <div class="item_totals_type_multi_select"> |
1592 | 1592 | |
@@ -1594,17 +1594,17 @@ discard block |
||
1594 | 1594 | |
1595 | 1595 | $options = array(); |
1596 | 1596 | |
1597 | - foreach ( $items as $index => $item ) { |
|
1598 | - $title = sanitize_text_field( $item['title'] ); |
|
1599 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
1600 | - $options[ $item['id'] ] = "$title ($price)"; |
|
1597 | + foreach ($items as $index => $item) { |
|
1598 | + $title = sanitize_text_field($item['title']); |
|
1599 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
1600 | + $options[$item['id']] = "$title ($price)"; |
|
1601 | 1601 | } |
1602 | 1602 | |
1603 | 1603 | echo aui()->select( |
1604 | 1604 | array( |
1605 | 1605 | 'name' => $id, |
1606 | 1606 | 'id' => $id, |
1607 | - 'placeholder' => __( 'Select one or more items', 'invoicing' ), |
|
1607 | + 'placeholder' => __('Select one or more items', 'invoicing'), |
|
1608 | 1608 | 'no_wrap' => true, |
1609 | 1609 | 'options' => $options, |
1610 | 1610 | 'multiple' => true, |
@@ -1622,11 +1622,11 @@ discard block |
||
1622 | 1622 | /** |
1623 | 1623 | * Renders the items element template. |
1624 | 1624 | */ |
1625 | - public function edit_items_template( $field ) { |
|
1626 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
1627 | - $label = __( 'Let customers...', 'invoicing' ); |
|
1628 | - $label2 = __( 'Available Items', 'invoicing' ); |
|
1629 | - $label3 = esc_attr__( 'Add some help text for this element', 'invoicing' ); |
|
1625 | + public function edit_items_template($field) { |
|
1626 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
1627 | + $label = __('Let customers...', 'invoicing'); |
|
1628 | + $label2 = __('Available Items', 'invoicing'); |
|
1629 | + $label3 = esc_attr__('Add some help text for this element', 'invoicing'); |
|
1630 | 1630 | $id = $field . '.id + "_edit"'; |
1631 | 1631 | $id2 = $field . '.id + "_edit2"'; |
1632 | 1632 | $id3 = $field . '.id + "_edit3"'; |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | <div class='form-group mt-2'> |
1677 | 1677 | |
1678 | 1678 | <select class='form-control custom-select' v-model='selected_item'> |
1679 | - <option value=''>" . __( 'Add an item to the form', 'invoicing' ) ."</option> |
|
1679 | + <option value=''>" . __('Add an item to the form', 'invoicing') . "</option> |
|
1680 | 1680 | <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option> |
1681 | 1681 | </select> |
1682 | 1682 | |
@@ -1691,11 +1691,11 @@ discard block |
||
1691 | 1691 | <label :for='$id2'>$label</label> |
1692 | 1692 | |
1693 | 1693 | <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'> |
1694 | - <option value='total'>" . __( 'Buy all items on the list', 'invoicing' ) ."</option> |
|
1695 | - <option value='radio'>" . __( 'Select a single item from the list', 'invoicing' ) ."</option> |
|
1696 | - <option value='checkbox'>" . __( 'Select one or more items on the list', 'invoicing' ) ."</option> |
|
1697 | - <option value='select'>" . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option> |
|
1698 | - <option value='multi_select'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option> |
|
1694 | + <option value='total'>" . __('Buy all items on the list', 'invoicing') . "</option> |
|
1695 | + <option value='radio'>" . __('Select a single item from the list', 'invoicing') . "</option> |
|
1696 | + <option value='checkbox'>" . __('Select one or more items on the list', 'invoicing') . "</option> |
|
1697 | + <option value='select'>" . __('Select a single item from a dropdown', 'invoicing') . "</option> |
|
1698 | + <option value='multi_select'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option> |
|
1699 | 1699 | </select> |
1700 | 1700 | |
1701 | 1701 | </div> |
@@ -1720,24 +1720,24 @@ discard block |
||
1720 | 1720 | 'orderby' => 'title', |
1721 | 1721 | 'order' => 'ASC', |
1722 | 1722 | 'posts_per_page' => -1, |
1723 | - 'post_status' => array( 'publish' ), |
|
1723 | + 'post_status' => array('publish'), |
|
1724 | 1724 | ); |
1725 | 1725 | |
1726 | - $items = get_posts( apply_filters( 'wpinv_item_dropdown_query_args', $item_args ) ); |
|
1726 | + $items = get_posts(apply_filters('wpinv_item_dropdown_query_args', $item_args)); |
|
1727 | 1727 | |
1728 | - if ( empty( $items ) ) { |
|
1728 | + if (empty($items)) { |
|
1729 | 1729 | return array(); |
1730 | 1730 | } |
1731 | 1731 | |
1732 | - $options = array(); |
|
1733 | - foreach ( $items as $item ) { |
|
1734 | - $title = esc_html( $item->post_title ); |
|
1735 | - $title .= wpinv_get_item_suffix( $item->ID, false ); |
|
1736 | - $id = absint( $item->ID ); |
|
1737 | - $price = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) ); |
|
1738 | - $recurring = (bool) get_post_meta( $id, '_wpinv_is_recurring', true ); |
|
1732 | + $options = array(); |
|
1733 | + foreach ($items as $item) { |
|
1734 | + $title = esc_html($item->post_title); |
|
1735 | + $title .= wpinv_get_item_suffix($item->ID, false); |
|
1736 | + $id = absint($item->ID); |
|
1737 | + $price = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true)); |
|
1738 | + $recurring = (bool) get_post_meta($id, '_wpinv_is_recurring', true); |
|
1739 | 1739 | $description = $item->post_excerpt; |
1740 | - $options[] = compact( 'title', 'id', 'price', 'recurring', 'description' ); |
|
1740 | + $options[] = compact('title', 'id', 'price', 'recurring', 'description'); |
|
1741 | 1741 | |
1742 | 1742 | } |
1743 | 1743 | return $options; |
@@ -1747,38 +1747,38 @@ discard block |
||
1747 | 1747 | /** |
1748 | 1748 | * Returns an array of items for the currently being edited form. |
1749 | 1749 | */ |
1750 | - public function get_form_items( $id = false ) { |
|
1750 | + public function get_form_items($id = false) { |
|
1751 | 1751 | |
1752 | - if ( empty( $id ) ) { |
|
1753 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
1752 | + if (empty($id)) { |
|
1753 | + return wpinv_get_data('sample-payment-form-items'); |
|
1754 | 1754 | } |
1755 | 1755 | |
1756 | - $form_elements = get_post_meta( $id, 'wpinv_form_items', true ); |
|
1756 | + $form_elements = get_post_meta($id, 'wpinv_form_items', true); |
|
1757 | 1757 | |
1758 | - if ( is_array( $form_elements ) ) { |
|
1758 | + if (is_array($form_elements)) { |
|
1759 | 1759 | return $form_elements; |
1760 | 1760 | } |
1761 | 1761 | |
1762 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
1762 | + return wpinv_get_data('sample-payment-form-items'); |
|
1763 | 1763 | |
1764 | 1764 | } |
1765 | 1765 | |
1766 | 1766 | /** |
1767 | 1767 | * Returns an array of elements for the currently being edited form. |
1768 | 1768 | */ |
1769 | - public function get_form_elements( $id = false ) { |
|
1769 | + public function get_form_elements($id = false) { |
|
1770 | 1770 | |
1771 | - if ( empty( $id ) ) { |
|
1772 | - return wpinv_get_data( 'sample-payment-form' ); |
|
1771 | + if (empty($id)) { |
|
1772 | + return wpinv_get_data('sample-payment-form'); |
|
1773 | 1773 | } |
1774 | 1774 | |
1775 | - $form_elements = get_post_meta( $id, 'wpinv_form_elements', true ); |
|
1775 | + $form_elements = get_post_meta($id, 'wpinv_form_elements', true); |
|
1776 | 1776 | |
1777 | - if ( is_array( $form_elements ) ) { |
|
1777 | + if (is_array($form_elements)) { |
|
1778 | 1778 | return $form_elements; |
1779 | 1779 | } |
1780 | 1780 | |
1781 | - return wpinv_get_data( 'sample-payment-form' ); |
|
1781 | + return wpinv_get_data('sample-payment-form'); |
|
1782 | 1782 | } |
1783 | 1783 | |
1784 | 1784 | } |