@@ -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,11 +207,11 @@ discard block |
||
207 | 207 | |
208 | 208 | array( |
209 | 209 | 'type' => 'billing_email', |
210 | - 'name' => __( 'Billing Email', 'invoicing' ), |
|
210 | + 'name' => __('Billing Email', 'invoicing'), |
|
211 | 211 | 'defaults' => array( |
212 | 212 | 'placeholder' => '[email protected]', |
213 | 213 | 'value' => '', |
214 | - 'label' => __( 'Billing Email', 'invoicing' ), |
|
214 | + 'label' => __('Billing Email', 'invoicing'), |
|
215 | 215 | 'description' => '', |
216 | 216 | 'premade' => true, |
217 | 217 | ) |
@@ -219,18 +219,18 @@ discard block |
||
219 | 219 | |
220 | 220 | array( |
221 | 221 | 'type' => 'discount', |
222 | - 'name' => __( 'Discount Input', 'invoicing' ), |
|
222 | + 'name' => __('Discount Input', 'invoicing'), |
|
223 | 223 | 'defaults' => array( |
224 | 224 | 'value' => '', |
225 | - 'input_label' => __( 'Coupon Code', 'invoicing' ), |
|
226 | - 'button_label' => __( 'Apply Coupon', 'invoicing' ), |
|
227 | - 'description' => __( 'Have a discount code? Enter it above.', 'invoicing' ), |
|
225 | + 'input_label' => __('Coupon Code', 'invoicing'), |
|
226 | + 'button_label' => __('Apply Coupon', 'invoicing'), |
|
227 | + 'description' => __('Have a discount code? Enter it above.', 'invoicing'), |
|
228 | 228 | ) |
229 | 229 | ), |
230 | 230 | |
231 | 231 | array( |
232 | 232 | 'type' => 'items', |
233 | - 'name' => __( 'Items', 'invoicing' ), |
|
233 | + 'name' => __('Items', 'invoicing'), |
|
234 | 234 | 'defaults' => array( |
235 | 235 | 'value' => '', |
236 | 236 | 'items_type' => 'total', |
@@ -241,25 +241,25 @@ discard block |
||
241 | 241 | |
242 | 242 | array( |
243 | 243 | 'type' => 'pay_button', |
244 | - 'name' => __( 'Payment Button', 'invoicing' ), |
|
244 | + 'name' => __('Payment Button', 'invoicing'), |
|
245 | 245 | 'defaults' => array( |
246 | 246 | 'value' => '', |
247 | 247 | 'class' => 'btn-primary', |
248 | - 'label' => __( 'Pay Now »', 'invoicing' ), |
|
249 | - 'description' => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
248 | + 'label' => __('Pay Now »', 'invoicing'), |
|
249 | + 'description' => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
250 | 250 | 'premade' => true, |
251 | 251 | ) |
252 | 252 | ) |
253 | 253 | ); |
254 | 254 | |
255 | - $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements ); |
|
255 | + $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements); |
|
256 | 256 | return $this->elements; |
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
260 | 260 | * Returns the restrict markup. |
261 | 261 | */ |
262 | - public function get_restrict_markup( $field, $field_type ) { |
|
262 | + public function get_restrict_markup($field, $field_type) { |
|
263 | 263 | $restrict = "$field.type=='$field_type'"; |
264 | 264 | return "v-if=\"$restrict\""; |
265 | 265 | } |
@@ -267,15 +267,15 @@ discard block |
||
267 | 267 | /** |
268 | 268 | * Renders the title element template. |
269 | 269 | */ |
270 | - public function render_heading_template( $field ) { |
|
271 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
270 | + public function render_heading_template($field) { |
|
271 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
272 | 272 | echo "<component :is='$field.level' $restrict v-html='$field.text'></component>"; |
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
276 | 276 | * Renders the title element on the frontend. |
277 | 277 | */ |
278 | - public function frontend_render_heading_template( $field ) { |
|
278 | + public function frontend_render_heading_template($field) { |
|
279 | 279 | $tag = $field['level']; |
280 | 280 | echo "<$tag>{$field['text']}</$tag>"; |
281 | 281 | } |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | /** |
284 | 284 | * Renders the edit title element template. |
285 | 285 | */ |
286 | - public function edit_heading_template( $field ) { |
|
287 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
288 | - $label = __( 'Heading', 'invoicing' ); |
|
289 | - $label2 = __( 'Select Heading Level', 'invoicing' ); |
|
286 | + public function edit_heading_template($field) { |
|
287 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
288 | + $label = __('Heading', 'invoicing'); |
|
289 | + $label2 = __('Select Heading Level', 'invoicing'); |
|
290 | 290 | $id = $field . '.id + "_edit"'; |
291 | 291 | $id2 = $field . '.id + "_edit2"'; |
292 | 292 | |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | /** |
319 | 319 | * Renders a paragraph element template. |
320 | 320 | */ |
321 | - public function render_paragraph_template( $field ) { |
|
322 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
321 | + public function render_paragraph_template($field) { |
|
322 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
323 | 323 | $label = "$field.text"; |
324 | 324 | echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>"; |
325 | 325 | } |
@@ -327,16 +327,16 @@ discard block |
||
327 | 327 | /** |
328 | 328 | * Renders the paragraph element on the frontend. |
329 | 329 | */ |
330 | - public function frontend_render_paragraph_template( $field ) { |
|
330 | + public function frontend_render_paragraph_template($field) { |
|
331 | 331 | echo "<p>{$field['text']}</p>"; |
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
335 | 335 | * Renders the edit paragraph element template. |
336 | 336 | */ |
337 | - public function edit_paragraph_template( $field ) { |
|
338 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
339 | - $label = __( 'Enter your text', 'invoicing' ); |
|
337 | + public function edit_paragraph_template($field) { |
|
338 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
339 | + $label = __('Enter your text', 'invoicing'); |
|
340 | 340 | $id = $field . '.id + "_edit"'; |
341 | 341 | echo " |
342 | 342 | <div $restrict> |
@@ -352,8 +352,8 @@ discard block |
||
352 | 352 | /** |
353 | 353 | * Renders the text element template. |
354 | 354 | */ |
355 | - public function render_text_template( $field ) { |
|
356 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
355 | + public function render_text_template($field) { |
|
356 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
357 | 357 | $label = "$field.label"; |
358 | 358 | echo " |
359 | 359 | <div $restrict> |
@@ -367,23 +367,23 @@ discard block |
||
367 | 367 | /** |
368 | 368 | * Renders the text element on the frontend. |
369 | 369 | */ |
370 | - public function frontend_render_text_template( $field ) { |
|
370 | + public function frontend_render_text_template($field) { |
|
371 | 371 | |
372 | 372 | echo "<div class='form-group'>"; |
373 | 373 | |
374 | 374 | echo aui()->input( |
375 | 375 | array( |
376 | - 'name' => esc_attr( $field['id'] ), |
|
377 | - 'id' => esc_attr( $field['id'] ), |
|
378 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
376 | + 'name' => esc_attr($field['id']), |
|
377 | + 'id' => esc_attr($field['id']), |
|
378 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
379 | 379 | 'required' => (bool) $field['required'], |
380 | - 'label' => wp_kses_post( $field['label'] ), |
|
380 | + 'label' => wp_kses_post($field['label']), |
|
381 | 381 | 'no_wrap' => true, |
382 | 382 | ) |
383 | 383 | ); |
384 | 384 | |
385 | - if ( ! empty( $field['description'] ) ) { |
|
386 | - $description = wp_kses_post( $field['description'] ); |
|
385 | + if (!empty($field['description'])) { |
|
386 | + $description = wp_kses_post($field['description']); |
|
387 | 387 | echo "<small class='form-text text-muted'>$description</small>"; |
388 | 388 | } |
389 | 389 | |
@@ -394,16 +394,16 @@ discard block |
||
394 | 394 | /** |
395 | 395 | * Renders the edit text element template. |
396 | 396 | */ |
397 | - public function edit_text_template( $field ) { |
|
398 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
399 | - $label = __( 'Field Label', 'invoicing' ); |
|
397 | + public function edit_text_template($field) { |
|
398 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
399 | + $label = __('Field Label', 'invoicing'); |
|
400 | 400 | $id = $field . '.id + "_edit"'; |
401 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
401 | + $label2 = __('Placeholder text', 'invoicing'); |
|
402 | 402 | $id2 = $field . '.id + "_edit2"'; |
403 | - $label3 = __( 'Help text', 'invoicing' ); |
|
404 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
403 | + $label3 = __('Help text', 'invoicing'); |
|
404 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
405 | 405 | $id3 = $field . '.id + "_edit3"'; |
406 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
406 | + $label5 = __('Is this field required?', 'invoicing'); |
|
407 | 407 | $id4 = $field . '.id + "_edit4"'; |
408 | 408 | echo " |
409 | 409 | <div $restrict> |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | /** |
432 | 432 | * Renders the textarea element template. |
433 | 433 | */ |
434 | - public function render_textarea_template( $field ) { |
|
435 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
434 | + public function render_textarea_template($field) { |
|
435 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
436 | 436 | $label = "$field.label"; |
437 | 437 | echo " |
438 | 438 | <div $restrict> |
@@ -446,24 +446,24 @@ discard block |
||
446 | 446 | /** |
447 | 447 | * Renders the textarea element on the frontend. |
448 | 448 | */ |
449 | - public function frontend_render_textarea_template( $field ) { |
|
449 | + public function frontend_render_textarea_template($field) { |
|
450 | 450 | |
451 | 451 | echo "<div class='form-group'>"; |
452 | 452 | |
453 | 453 | echo aui()->textarea( |
454 | 454 | array( |
455 | - 'name' => esc_attr( $field['id'] ), |
|
456 | - 'id' => esc_attr( $field['id'] ), |
|
457 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
455 | + 'name' => esc_attr($field['id']), |
|
456 | + 'id' => esc_attr($field['id']), |
|
457 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
458 | 458 | 'required' => (bool) $field['required'], |
459 | - 'label' => wp_kses_post( $field['label'] ), |
|
459 | + 'label' => wp_kses_post($field['label']), |
|
460 | 460 | 'no_wrap' => true, |
461 | 461 | 'rows' => 3, |
462 | 462 | ) |
463 | 463 | ); |
464 | 464 | |
465 | - if ( ! empty( $field['description'] ) ) { |
|
466 | - $description = wp_kses_post( $field['description'] ); |
|
465 | + if (!empty($field['description'])) { |
|
466 | + $description = wp_kses_post($field['description']); |
|
467 | 467 | echo "<small class='form-text text-muted'>$description</small>"; |
468 | 468 | } |
469 | 469 | |
@@ -474,16 +474,16 @@ discard block |
||
474 | 474 | /** |
475 | 475 | * Renders the edit textarea element template. |
476 | 476 | */ |
477 | - public function edit_textarea_template( $field ) { |
|
478 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
479 | - $label = __( 'Field Label', 'invoicing' ); |
|
477 | + public function edit_textarea_template($field) { |
|
478 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
479 | + $label = __('Field Label', 'invoicing'); |
|
480 | 480 | $id = $field . '.id + "_edit"'; |
481 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
481 | + $label2 = __('Placeholder text', 'invoicing'); |
|
482 | 482 | $id2 = $field . '.id + "_edit2"'; |
483 | - $label3 = __( 'Help text', 'invoicing' ); |
|
484 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
483 | + $label3 = __('Help text', 'invoicing'); |
|
484 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
485 | 485 | $id3 = $field . '.id + "_edit3"'; |
486 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
486 | + $label5 = __('Is this field required?', 'invoicing'); |
|
487 | 487 | $id4 = $field . '.id + "_edit4"'; |
488 | 488 | echo " |
489 | 489 | <div $restrict> |
@@ -511,8 +511,8 @@ discard block |
||
511 | 511 | /** |
512 | 512 | * Renders the select element template. |
513 | 513 | */ |
514 | - public function render_select_template( $field ) { |
|
515 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
514 | + public function render_select_template($field) { |
|
515 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
516 | 516 | $label = "$field.label"; |
517 | 517 | $placeholder = "$field.placeholder"; |
518 | 518 | $id = $field . '.id'; |
@@ -531,24 +531,24 @@ discard block |
||
531 | 531 | /** |
532 | 532 | * Renders the select element on the frontend. |
533 | 533 | */ |
534 | - public function frontend_render_select_template( $field ) { |
|
534 | + public function frontend_render_select_template($field) { |
|
535 | 535 | |
536 | 536 | echo "<div class='form-group'>"; |
537 | 537 | |
538 | 538 | echo aui()->select( |
539 | 539 | array( |
540 | - 'name' => esc_attr( $field['id'] ), |
|
541 | - 'id' => esc_attr( $field['id'] ), |
|
542 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
540 | + 'name' => esc_attr($field['id']), |
|
541 | + 'id' => esc_attr($field['id']), |
|
542 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
543 | 543 | 'required' => (bool) $field['required'], |
544 | - 'label' => wp_kses_post( $field['label'] ), |
|
544 | + 'label' => wp_kses_post($field['label']), |
|
545 | 545 | 'no_wrap' => true, |
546 | 546 | 'options' => $field['options'], |
547 | 547 | ) |
548 | 548 | ); |
549 | 549 | |
550 | - if ( ! empty( $field['description'] ) ) { |
|
551 | - $description = wp_kses_post( $field['description'] ); |
|
550 | + if (!empty($field['description'])) { |
|
551 | + $description = wp_kses_post($field['description']); |
|
552 | 552 | echo "<small class='form-text text-muted'>$description</small>"; |
553 | 553 | } |
554 | 554 | |
@@ -559,18 +559,18 @@ discard block |
||
559 | 559 | /** |
560 | 560 | * Renders the edit select element template. |
561 | 561 | */ |
562 | - public function edit_select_template( $field ) { |
|
563 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
564 | - $label = __( 'Field Label', 'invoicing' ); |
|
562 | + public function edit_select_template($field) { |
|
563 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
564 | + $label = __('Field Label', 'invoicing'); |
|
565 | 565 | $id = $field . '.id + "_edit"'; |
566 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
566 | + $label2 = __('Placeholder text', 'invoicing'); |
|
567 | 567 | $id2 = $field . '.id + "_edit2"'; |
568 | - $label3 = __( 'Help text', 'invoicing' ); |
|
569 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
568 | + $label3 = __('Help text', 'invoicing'); |
|
569 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
570 | 570 | $id3 = $field . '.id + "_edit3"'; |
571 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
571 | + $label5 = __('Is this field required?', 'invoicing'); |
|
572 | 572 | $id4 = $field . '.id + "_edit4"'; |
573 | - $label6 = __( 'Available Options', 'invoicing' ); |
|
573 | + $label6 = __('Available Options', 'invoicing'); |
|
574 | 574 | echo " |
575 | 575 | <div $restrict> |
576 | 576 | <div class='form-group'> |
@@ -608,8 +608,8 @@ discard block |
||
608 | 608 | /** |
609 | 609 | * Renders the checkbox element template. |
610 | 610 | */ |
611 | - public function render_checkbox_template( $field ) { |
|
612 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
611 | + public function render_checkbox_template($field) { |
|
612 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
613 | 613 | $label = "$field.label"; |
614 | 614 | echo " |
615 | 615 | <div class='form-check' $restrict> |
@@ -623,23 +623,23 @@ discard block |
||
623 | 623 | /** |
624 | 624 | * Renders the checkbox element on the frontend. |
625 | 625 | */ |
626 | - public function frontend_render_checkbox_template( $field ) { |
|
626 | + public function frontend_render_checkbox_template($field) { |
|
627 | 627 | |
628 | 628 | echo "<div class='form-group'>"; |
629 | 629 | |
630 | 630 | echo aui()->input( |
631 | 631 | array( |
632 | - 'name' => esc_attr( $field['id'] ), |
|
633 | - 'id' => esc_attr( $field['id'] ), |
|
632 | + 'name' => esc_attr($field['id']), |
|
633 | + 'id' => esc_attr($field['id']), |
|
634 | 634 | 'required' => (bool) $field['required'], |
635 | - 'label' => wp_kses_post( $field['label'] ), |
|
635 | + 'label' => wp_kses_post($field['label']), |
|
636 | 636 | 'no_wrap' => true, |
637 | 637 | 'type' => 'checkbox', |
638 | 638 | ) |
639 | 639 | ); |
640 | 640 | |
641 | - if ( ! empty( $field['description'] ) ) { |
|
642 | - $description = wp_kses_post( $field['description'] ); |
|
641 | + if (!empty($field['description'])) { |
|
642 | + $description = wp_kses_post($field['description']); |
|
643 | 643 | echo "<small class='form-text text-muted'>$description</small>"; |
644 | 644 | } |
645 | 645 | |
@@ -650,14 +650,14 @@ discard block |
||
650 | 650 | /** |
651 | 651 | * Renders the edit checkbox element template. |
652 | 652 | */ |
653 | - public function edit_checkbox_template( $field ) { |
|
654 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
655 | - $label = __( 'Field Label', 'invoicing' ); |
|
653 | + public function edit_checkbox_template($field) { |
|
654 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
655 | + $label = __('Field Label', 'invoicing'); |
|
656 | 656 | $id = $field . '.id + "_edit"'; |
657 | - $label2 = __( 'Help text', 'invoicing' ); |
|
658 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
657 | + $label2 = __('Help text', 'invoicing'); |
|
658 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
659 | 659 | $id2 = $field . '.id + "_edit2"'; |
660 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
660 | + $label4 = __('Is this field required?', 'invoicing'); |
|
661 | 661 | $id3 = $field . '.id + "_edit3"'; |
662 | 662 | echo " |
663 | 663 | <div $restrict> |
@@ -681,8 +681,8 @@ discard block |
||
681 | 681 | /** |
682 | 682 | * Renders the radio element template. |
683 | 683 | */ |
684 | - public function render_radio_template( $field ) { |
|
685 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
684 | + public function render_radio_template($field) { |
|
685 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
686 | 686 | $label = "$field.label"; |
687 | 687 | $id = $field . '.id'; |
688 | 688 | echo " |
@@ -700,19 +700,19 @@ discard block |
||
700 | 700 | /** |
701 | 701 | * Renders the radio element on the frontend. |
702 | 702 | */ |
703 | - public function frontend_render_radio_template( $field ) { |
|
703 | + public function frontend_render_radio_template($field) { |
|
704 | 704 | |
705 | 705 | echo "<div class='form-group'>"; |
706 | 706 | |
707 | - if ( ! empty( $field['label'] ) ) { |
|
708 | - $label = wp_kses_post( $field['label'] ); |
|
707 | + if (!empty($field['label'])) { |
|
708 | + $label = wp_kses_post($field['label']); |
|
709 | 709 | echo "<legend class='col-form-label'>$label</legend>"; |
710 | 710 | } |
711 | 711 | |
712 | - foreach( $field['options'] as $index => $option ) { |
|
712 | + foreach ($field['options'] as $index => $option) { |
|
713 | 713 | $id = $field['id'] . $index; |
714 | - $value = esc_attr( $option ); |
|
715 | - $label = wp_kses_post( $option ); |
|
714 | + $value = esc_attr($option); |
|
715 | + $label = wp_kses_post($option); |
|
716 | 716 | |
717 | 717 | echo " |
718 | 718 | <div class='form-check'> |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | "; |
723 | 723 | } |
724 | 724 | |
725 | - if ( ! empty( $field['description'] ) ) { |
|
726 | - $description = wp_kses_post( $field['description'] ); |
|
725 | + if (!empty($field['description'])) { |
|
726 | + $description = wp_kses_post($field['description']); |
|
727 | 727 | echo "<small class='form-text text-muted'>$description</small>"; |
728 | 728 | } |
729 | 729 | |
@@ -734,16 +734,16 @@ discard block |
||
734 | 734 | /** |
735 | 735 | * Renders the edit radio element template. |
736 | 736 | */ |
737 | - public function edit_radio_template( $field ) { |
|
738 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
739 | - $label = __( 'Field Label', 'invoicing' ); |
|
737 | + public function edit_radio_template($field) { |
|
738 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
739 | + $label = __('Field Label', 'invoicing'); |
|
740 | 740 | $id = $field . '.id + "_edit"'; |
741 | - $label2 = __( 'Help text', 'invoicing' ); |
|
742 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
741 | + $label2 = __('Help text', 'invoicing'); |
|
742 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
743 | 743 | $id2 = $field . '.id + "_edit3"'; |
744 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
744 | + $label4 = __('Is this field required?', 'invoicing'); |
|
745 | 745 | $id3 = $field . '.id + "_edit4"'; |
746 | - $label5 = __( 'Available Options', 'invoicing' ); |
|
746 | + $label5 = __('Available Options', 'invoicing'); |
|
747 | 747 | echo " |
748 | 748 | <div $restrict> |
749 | 749 | <div class='form-group'> |
@@ -777,8 +777,8 @@ discard block |
||
777 | 777 | /** |
778 | 778 | * Renders the email element template. |
779 | 779 | */ |
780 | - public function render_email_template( $field ) { |
|
781 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
780 | + public function render_email_template($field) { |
|
781 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
782 | 782 | $label = "$field.label"; |
783 | 783 | echo " |
784 | 784 | <div $restrict> |
@@ -792,8 +792,8 @@ discard block |
||
792 | 792 | /** |
793 | 793 | * Renders the billing_email element template. |
794 | 794 | */ |
795 | - public function render_billing_email_template( $field ) { |
|
796 | - $restrict = $this->get_restrict_markup( $field, 'billing_email' ); |
|
795 | + public function render_billing_email_template($field) { |
|
796 | + $restrict = $this->get_restrict_markup($field, 'billing_email'); |
|
797 | 797 | $label = "$field.label"; |
798 | 798 | echo " |
799 | 799 | <div $restrict> |
@@ -807,24 +807,24 @@ discard block |
||
807 | 807 | /** |
808 | 808 | * Renders the email element on the frontend. |
809 | 809 | */ |
810 | - public function frontend_render_email_template( $field ) { |
|
810 | + public function frontend_render_email_template($field) { |
|
811 | 811 | |
812 | 812 | echo "<div class='form-group'>"; |
813 | 813 | |
814 | 814 | echo aui()->input( |
815 | 815 | array( |
816 | - 'name' => esc_attr( $field['id'] ), |
|
817 | - 'id' => esc_attr( $field['id'] ), |
|
816 | + 'name' => esc_attr($field['id']), |
|
817 | + 'id' => esc_attr($field['id']), |
|
818 | 818 | 'required' => (bool) $field['required'], |
819 | - 'label' => wp_kses_post( $field['label'] ), |
|
819 | + 'label' => wp_kses_post($field['label']), |
|
820 | 820 | 'no_wrap' => true, |
821 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
821 | + 'placeholder' => esc_attr($field['placeholder']), |
|
822 | 822 | 'type' => 'email', |
823 | 823 | ) |
824 | 824 | ); |
825 | 825 | |
826 | - if ( ! empty( $field['description'] ) ) { |
|
827 | - $description = wp_kses_post( $field['description'] ); |
|
826 | + if (!empty($field['description'])) { |
|
827 | + $description = wp_kses_post($field['description']); |
|
828 | 828 | echo "<small class='form-text text-muted'>$description</small>"; |
829 | 829 | } |
830 | 830 | |
@@ -835,24 +835,24 @@ discard block |
||
835 | 835 | /** |
836 | 836 | * Renders the billing email element on the frontend. |
837 | 837 | */ |
838 | - public function frontend_render_billing_email_template( $field ) { |
|
838 | + public function frontend_render_billing_email_template($field) { |
|
839 | 839 | |
840 | 840 | echo "<div class='form-group'>"; |
841 | 841 | |
842 | 842 | echo aui()->input( |
843 | 843 | array( |
844 | 844 | 'name' => 'billing_email', |
845 | - 'id' => esc_attr( $field['id'] ), |
|
845 | + 'id' => esc_attr($field['id']), |
|
846 | 846 | 'required' => true, |
847 | - 'label' => wp_kses_post( $field['label'] ), |
|
847 | + 'label' => wp_kses_post($field['label']), |
|
848 | 848 | 'no_wrap' => true, |
849 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
849 | + 'placeholder' => esc_attr($field['placeholder']), |
|
850 | 850 | 'type' => 'email', |
851 | 851 | ) |
852 | 852 | ); |
853 | 853 | |
854 | - if ( ! empty( $field['description'] ) ) { |
|
855 | - $description = wp_kses_post( $field['description'] ); |
|
854 | + if (!empty($field['description'])) { |
|
855 | + $description = wp_kses_post($field['description']); |
|
856 | 856 | echo "<small class='form-text text-muted'>$description</small>"; |
857 | 857 | } |
858 | 858 | |
@@ -863,16 +863,16 @@ discard block |
||
863 | 863 | /** |
864 | 864 | * Renders the edit email element template. |
865 | 865 | */ |
866 | - public function edit_email_template( $field ) { |
|
867 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
868 | - $label = __( 'Field Label', 'invoicing' ); |
|
866 | + public function edit_email_template($field) { |
|
867 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
868 | + $label = __('Field Label', 'invoicing'); |
|
869 | 869 | $id = $field . '.id + "_edit"'; |
870 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
870 | + $label2 = __('Placeholder text', 'invoicing'); |
|
871 | 871 | $id2 = $field . '.id + "_edit2"'; |
872 | - $label3 = __( 'Help text', 'invoicing' ); |
|
873 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
872 | + $label3 = __('Help text', 'invoicing'); |
|
873 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
874 | 874 | $id3 = $field . '.id + "_edit3"'; |
875 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
875 | + $label5 = __('Is this field required?', 'invoicing'); |
|
876 | 876 | $id4 = $field . '.id + "_edit4"'; |
877 | 877 | echo " |
878 | 878 | <div $restrict> |
@@ -900,16 +900,16 @@ discard block |
||
900 | 900 | /** |
901 | 901 | * Renders the edit billing_email element template. |
902 | 902 | */ |
903 | - public function edit_billing_email_template( $field ) { |
|
904 | - $restrict = $this->get_restrict_markup( $field, 'billing_email' ); |
|
905 | - $label = __( 'Field Label', 'invoicing' ); |
|
903 | + public function edit_billing_email_template($field) { |
|
904 | + $restrict = $this->get_restrict_markup($field, 'billing_email'); |
|
905 | + $label = __('Field Label', 'invoicing'); |
|
906 | 906 | $id = $field . '.id + "_edit"'; |
907 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
907 | + $label2 = __('Placeholder text', 'invoicing'); |
|
908 | 908 | $id2 = $field . '.id + "_edit2"'; |
909 | - $label3 = __( 'Help text', 'invoicing' ); |
|
910 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
909 | + $label3 = __('Help text', 'invoicing'); |
|
910 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
911 | 911 | $id3 = $field . '.id + "_edit3"'; |
912 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
912 | + $label5 = __('Is this field required?', 'invoicing'); |
|
913 | 913 | $id4 = $field . '.id + "_edit4"'; |
914 | 914 | echo " |
915 | 915 | <div $restrict> |
@@ -933,8 +933,8 @@ discard block |
||
933 | 933 | /** |
934 | 934 | * Renders the website element template. |
935 | 935 | */ |
936 | - public function render_website_template( $field ) { |
|
937 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
936 | + public function render_website_template($field) { |
|
937 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
938 | 938 | $label = "$field.label"; |
939 | 939 | echo " |
940 | 940 | <div $restrict> |
@@ -948,24 +948,24 @@ discard block |
||
948 | 948 | /** |
949 | 949 | * Renders the website element on the frontend. |
950 | 950 | */ |
951 | - public function frontend_render_website_template( $field ) { |
|
951 | + public function frontend_render_website_template($field) { |
|
952 | 952 | |
953 | 953 | echo "<div class='form-group'>"; |
954 | 954 | |
955 | 955 | echo aui()->input( |
956 | 956 | array( |
957 | - 'name' => esc_attr( $field['id'] ), |
|
958 | - 'id' => esc_attr( $field['id'] ), |
|
957 | + 'name' => esc_attr($field['id']), |
|
958 | + 'id' => esc_attr($field['id']), |
|
959 | 959 | 'required' => (bool) $field['required'], |
960 | - 'label' => wp_kses_post( $field['label'] ), |
|
960 | + 'label' => wp_kses_post($field['label']), |
|
961 | 961 | 'no_wrap' => true, |
962 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
962 | + 'placeholder' => esc_attr($field['placeholder']), |
|
963 | 963 | 'type' => 'url', |
964 | 964 | ) |
965 | 965 | ); |
966 | 966 | |
967 | - if ( ! empty( $field['description'] ) ) { |
|
968 | - $description = wp_kses_post( $field['description'] ); |
|
967 | + if (!empty($field['description'])) { |
|
968 | + $description = wp_kses_post($field['description']); |
|
969 | 969 | echo "<small class='form-text text-muted'>$description</small>"; |
970 | 970 | } |
971 | 971 | |
@@ -976,16 +976,16 @@ discard block |
||
976 | 976 | /** |
977 | 977 | * Renders the edit website element template. |
978 | 978 | */ |
979 | - public function edit_website_template( $field ) { |
|
980 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
981 | - $label = __( 'Field Label', 'invoicing' ); |
|
979 | + public function edit_website_template($field) { |
|
980 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
981 | + $label = __('Field Label', 'invoicing'); |
|
982 | 982 | $id = $field . '.id + "_edit"'; |
983 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
983 | + $label2 = __('Placeholder text', 'invoicing'); |
|
984 | 984 | $id2 = $field . '.id + "_edit2"'; |
985 | - $label3 = __( 'Help text', 'invoicing' ); |
|
986 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
985 | + $label3 = __('Help text', 'invoicing'); |
|
986 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
987 | 987 | $id3 = $field . '.id + "_edit3"'; |
988 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
988 | + $label5 = __('Is this field required?', 'invoicing'); |
|
989 | 989 | $id4 = $field . '.id + "_edit4"'; |
990 | 990 | echo " |
991 | 991 | <div $restrict> |
@@ -1013,8 +1013,8 @@ discard block |
||
1013 | 1013 | /** |
1014 | 1014 | * Renders the date element template. |
1015 | 1015 | */ |
1016 | - public function render_date_template( $field ) { |
|
1017 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
1016 | + public function render_date_template($field) { |
|
1017 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
1018 | 1018 | $label = "$field.label"; |
1019 | 1019 | echo " |
1020 | 1020 | <div $restrict> |
@@ -1028,24 +1028,24 @@ discard block |
||
1028 | 1028 | /** |
1029 | 1029 | * Renders the date element on the frontend. |
1030 | 1030 | */ |
1031 | - public function frontend_render_date_template( $field ) { |
|
1031 | + public function frontend_render_date_template($field) { |
|
1032 | 1032 | |
1033 | 1033 | echo "<div class='form-group'>"; |
1034 | 1034 | |
1035 | 1035 | echo aui()->input( |
1036 | 1036 | array( |
1037 | - 'name' => esc_attr( $field['id'] ), |
|
1038 | - 'id' => esc_attr( $field['id'] ), |
|
1037 | + 'name' => esc_attr($field['id']), |
|
1038 | + 'id' => esc_attr($field['id']), |
|
1039 | 1039 | 'required' => (bool) $field['required'], |
1040 | - 'label' => wp_kses_post( $field['label'] ), |
|
1041 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1040 | + 'label' => wp_kses_post($field['label']), |
|
1041 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1042 | 1042 | 'no_wrap' => true, |
1043 | 1043 | 'type' => 'date', |
1044 | 1044 | ) |
1045 | 1045 | ); |
1046 | 1046 | |
1047 | - if ( ! empty( $field['description'] ) ) { |
|
1048 | - $description = wp_kses_post( $field['description'] ); |
|
1047 | + if (!empty($field['description'])) { |
|
1048 | + $description = wp_kses_post($field['description']); |
|
1049 | 1049 | echo "<small class='form-text text-muted'>$description</small>"; |
1050 | 1050 | } |
1051 | 1051 | |
@@ -1056,16 +1056,16 @@ discard block |
||
1056 | 1056 | /** |
1057 | 1057 | * Renders the edit date element template. |
1058 | 1058 | */ |
1059 | - public function edit_date_template( $field ) { |
|
1060 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
1061 | - $label = __( 'Field Label', 'invoicing' ); |
|
1059 | + public function edit_date_template($field) { |
|
1060 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
1061 | + $label = __('Field Label', 'invoicing'); |
|
1062 | 1062 | $id = $field . '.id + "_edit"'; |
1063 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1063 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1064 | 1064 | $id2 = $field . '.id + "_edit2"'; |
1065 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1066 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1065 | + $label3 = __('Help text', 'invoicing'); |
|
1066 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1067 | 1067 | $id3 = $field . '.id + "_edit3"'; |
1068 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1068 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1069 | 1069 | $id4 = $field . '.id + "_edit4"'; |
1070 | 1070 | echo " |
1071 | 1071 | <div $restrict> |
@@ -1093,8 +1093,8 @@ discard block |
||
1093 | 1093 | /** |
1094 | 1094 | * Renders the time element template. |
1095 | 1095 | */ |
1096 | - public function render_time_template( $field ) { |
|
1097 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
1096 | + public function render_time_template($field) { |
|
1097 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
1098 | 1098 | $label = "$field.label"; |
1099 | 1099 | echo " |
1100 | 1100 | <div $restrict> |
@@ -1108,24 +1108,24 @@ discard block |
||
1108 | 1108 | /** |
1109 | 1109 | * Renders the time element on the frontend. |
1110 | 1110 | */ |
1111 | - public function frontend_render_time_template( $field ) { |
|
1111 | + public function frontend_render_time_template($field) { |
|
1112 | 1112 | |
1113 | 1113 | echo "<div class='form-group'>"; |
1114 | 1114 | |
1115 | 1115 | echo aui()->input( |
1116 | 1116 | array( |
1117 | - 'name' => esc_attr( $field['id'] ), |
|
1118 | - 'id' => esc_attr( $field['id'] ), |
|
1117 | + 'name' => esc_attr($field['id']), |
|
1118 | + 'id' => esc_attr($field['id']), |
|
1119 | 1119 | 'required' => (bool) $field['required'], |
1120 | - 'label' => wp_kses_post( $field['label'] ), |
|
1120 | + 'label' => wp_kses_post($field['label']), |
|
1121 | 1121 | 'no_wrap' => true, |
1122 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1122 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1123 | 1123 | 'type' => 'time', |
1124 | 1124 | ) |
1125 | 1125 | ); |
1126 | 1126 | |
1127 | - if ( ! empty( $field['description'] ) ) { |
|
1128 | - $description = wp_kses_post( $field['description'] ); |
|
1127 | + if (!empty($field['description'])) { |
|
1128 | + $description = wp_kses_post($field['description']); |
|
1129 | 1129 | echo "<small class='form-text text-muted'>$description</small>"; |
1130 | 1130 | } |
1131 | 1131 | |
@@ -1136,16 +1136,16 @@ discard block |
||
1136 | 1136 | /** |
1137 | 1137 | * Renders the edit time element template. |
1138 | 1138 | */ |
1139 | - public function edit_time_template( $field ) { |
|
1140 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
1141 | - $label = __( 'Field Label', 'invoicing' ); |
|
1139 | + public function edit_time_template($field) { |
|
1140 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
1141 | + $label = __('Field Label', 'invoicing'); |
|
1142 | 1142 | $id = $field . '.id + "_edit"'; |
1143 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1143 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1144 | 1144 | $id2 = $field . '.id + "_edit2"'; |
1145 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1146 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1145 | + $label3 = __('Help text', 'invoicing'); |
|
1146 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1147 | 1147 | $id3 = $field . '.id + "_edit3"'; |
1148 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1148 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1149 | 1149 | $id4 = $field . '.id + "_edit4"'; |
1150 | 1150 | echo " |
1151 | 1151 | <div $restrict> |
@@ -1173,8 +1173,8 @@ discard block |
||
1173 | 1173 | /** |
1174 | 1174 | * Renders the number element template. |
1175 | 1175 | */ |
1176 | - public function render_number_template( $field ) { |
|
1177 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
1176 | + public function render_number_template($field) { |
|
1177 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
1178 | 1178 | $label = "$field.label"; |
1179 | 1179 | echo " |
1180 | 1180 | <div $restrict> |
@@ -1188,24 +1188,24 @@ discard block |
||
1188 | 1188 | /** |
1189 | 1189 | * Renders the number element on the frontend. |
1190 | 1190 | */ |
1191 | - public function frontend_render_number_template( $field ) { |
|
1191 | + public function frontend_render_number_template($field) { |
|
1192 | 1192 | |
1193 | 1193 | echo "<div class='form-group'>"; |
1194 | 1194 | |
1195 | 1195 | echo aui()->input( |
1196 | 1196 | array( |
1197 | - 'name' => esc_attr( $field['id'] ), |
|
1198 | - 'id' => esc_attr( $field['id'] ), |
|
1197 | + 'name' => esc_attr($field['id']), |
|
1198 | + 'id' => esc_attr($field['id']), |
|
1199 | 1199 | 'required' => (bool) $field['required'], |
1200 | - 'label' => wp_kses_post( $field['label'] ), |
|
1201 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1200 | + 'label' => wp_kses_post($field['label']), |
|
1201 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1202 | 1202 | 'no_wrap' => true, |
1203 | 1203 | 'type' => 'number', |
1204 | 1204 | ) |
1205 | 1205 | ); |
1206 | 1206 | |
1207 | - if ( ! empty( $field['description'] ) ) { |
|
1208 | - $description = wp_kses_post( $field['description'] ); |
|
1207 | + if (!empty($field['description'])) { |
|
1208 | + $description = wp_kses_post($field['description']); |
|
1209 | 1209 | echo "<small class='form-text text-muted'>$description</small>"; |
1210 | 1210 | } |
1211 | 1211 | |
@@ -1216,16 +1216,16 @@ discard block |
||
1216 | 1216 | /** |
1217 | 1217 | * Renders the edit number element template. |
1218 | 1218 | */ |
1219 | - public function edit_number_template( $field ) { |
|
1220 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
1221 | - $label = __( 'Field Label', 'invoicing' ); |
|
1219 | + public function edit_number_template($field) { |
|
1220 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
1221 | + $label = __('Field Label', 'invoicing'); |
|
1222 | 1222 | $id = $field . '.id + "_edit"'; |
1223 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1223 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1224 | 1224 | $id2 = $field . '.id + "_edit2"'; |
1225 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1226 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1225 | + $label3 = __('Help text', 'invoicing'); |
|
1226 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1227 | 1227 | $id3 = $field . '.id + "_edit3"'; |
1228 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1228 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1229 | 1229 | $id4 = $field . '.id + "_edit4"'; |
1230 | 1230 | echo " |
1231 | 1231 | <div $restrict> |
@@ -1253,23 +1253,23 @@ discard block |
||
1253 | 1253 | /** |
1254 | 1254 | * Renders the separator element template. |
1255 | 1255 | */ |
1256 | - public function render_separator_template( $field ) { |
|
1257 | - $restrict = $this->get_restrict_markup( $field, 'separator' ); |
|
1256 | + public function render_separator_template($field) { |
|
1257 | + $restrict = $this->get_restrict_markup($field, 'separator'); |
|
1258 | 1258 | echo "<hr class='featurette-divider mt-0 mb-2' $restrict>"; |
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | /** |
1262 | 1262 | * Renders the separator element on the frontend. |
1263 | 1263 | */ |
1264 | - public function frontend_render_separator_template( $field ) { |
|
1264 | + public function frontend_render_separator_template($field) { |
|
1265 | 1265 | echo '<hr class="featurette-divider mt-0 mb-2" />'; |
1266 | 1266 | } |
1267 | 1267 | |
1268 | 1268 | /** |
1269 | 1269 | * Renders the pay button element template. |
1270 | 1270 | */ |
1271 | - public function render_pay_button_template( $field ) { |
|
1272 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
1271 | + public function render_pay_button_template($field) { |
|
1272 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
1273 | 1273 | $label = "$field.label"; |
1274 | 1274 | echo " |
1275 | 1275 | <div $restrict> |
@@ -1282,24 +1282,24 @@ discard block |
||
1282 | 1282 | /** |
1283 | 1283 | * Renders the pay_button element on the frontend. |
1284 | 1284 | */ |
1285 | - public function frontend_render_pay_button_template( $field ) { |
|
1285 | + public function frontend_render_pay_button_template($field) { |
|
1286 | 1286 | |
1287 | 1287 | echo "<div class='form-group'>"; |
1288 | 1288 | |
1289 | - $class = 'btn btn-block submit-button ' . sanitize_html_class( $field['class'] ); |
|
1289 | + $class = 'btn btn-block submit-button ' . sanitize_html_class($field['class']); |
|
1290 | 1290 | echo aui()->button( |
1291 | 1291 | array( |
1292 | - 'name' => esc_attr( $field['id'] ), |
|
1293 | - 'id' => esc_attr( $field['id'] ), |
|
1294 | - 'content' => wp_kses_post( $field['label'] ), |
|
1292 | + 'name' => esc_attr($field['id']), |
|
1293 | + 'id' => esc_attr($field['id']), |
|
1294 | + 'content' => wp_kses_post($field['label']), |
|
1295 | 1295 | 'no_wrap' => true, |
1296 | 1296 | 'type' => 'button', |
1297 | 1297 | 'class' => $class, |
1298 | 1298 | ) |
1299 | 1299 | ); |
1300 | 1300 | |
1301 | - if ( ! empty( $field['description'] ) ) { |
|
1302 | - $description = wp_kses_post( $field['description'] ); |
|
1301 | + if (!empty($field['description'])) { |
|
1302 | + $description = wp_kses_post($field['description']); |
|
1303 | 1303 | echo "<small class='form-text text-muted'>$description</small>"; |
1304 | 1304 | } |
1305 | 1305 | |
@@ -1310,14 +1310,14 @@ discard block |
||
1310 | 1310 | /** |
1311 | 1311 | * Renders the pay button element template. |
1312 | 1312 | */ |
1313 | - public function edit_pay_button_template( $field ) { |
|
1314 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
1315 | - $label = __( 'Button Text', 'invoicing' ); |
|
1313 | + public function edit_pay_button_template($field) { |
|
1314 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
1315 | + $label = __('Button Text', 'invoicing'); |
|
1316 | 1316 | $id = $field . '.id + "_edit"'; |
1317 | - $label2 = __( 'Help text', 'invoicing' ); |
|
1318 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1317 | + $label2 = __('Help text', 'invoicing'); |
|
1318 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1319 | 1319 | $id2 = $field . '.id + "_edit2"'; |
1320 | - $label4 = esc_attr__( 'Button Type', 'invoicing' ); |
|
1320 | + $label4 = esc_attr__('Button Type', 'invoicing'); |
|
1321 | 1321 | $id3 = $field . '.id + "_edit3"'; |
1322 | 1322 | echo " |
1323 | 1323 | <div $restrict> |
@@ -1333,15 +1333,15 @@ discard block |
||
1333 | 1333 | <label :for='$id3'>$label4</label> |
1334 | 1334 | |
1335 | 1335 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
1336 | - <option value='btn-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
1337 | - <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
1338 | - <option value='btn-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
1339 | - <option value='btn-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
1340 | - <option value='btn-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
1341 | - <option value='btn-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
1342 | - <option value='btn-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
1343 | - <option value='btn-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
1344 | - <option value='btn-link'>" . __( 'Link', 'invoicing' ) ."</option> |
|
1336 | + <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option> |
|
1337 | + <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
1338 | + <option value='btn-success'>" . __('Success', 'invoicing') . "</option> |
|
1339 | + <option value='btn-danger'>" . __('Danger', 'invoicing') . "</option> |
|
1340 | + <option value='btn-warning'>" . __('Warning', 'invoicing') . "</option> |
|
1341 | + <option value='btn-info'>" . __('Info', 'invoicing') . "</option> |
|
1342 | + <option value='btn-light'>" . __('Light', 'invoicing') . "</option> |
|
1343 | + <option value='btn-dark'>" . __('Dark', 'invoicing') . "</option> |
|
1344 | + <option value='btn-link'>" . __('Link', 'invoicing') . "</option> |
|
1345 | 1345 | </select> |
1346 | 1346 | </div> |
1347 | 1347 | </div> |
@@ -1352,8 +1352,8 @@ discard block |
||
1352 | 1352 | /** |
1353 | 1353 | * Renders the alert element template. |
1354 | 1354 | */ |
1355 | - public function render_alert_template( $field ) { |
|
1356 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
1355 | + public function render_alert_template($field) { |
|
1356 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
1357 | 1357 | $text = "$field.text"; |
1358 | 1358 | echo " |
1359 | 1359 | <div $restrict class='alert' :class='$field.class' role='alert'> |
@@ -1368,15 +1368,15 @@ discard block |
||
1368 | 1368 | /** |
1369 | 1369 | * Renders the alert element on the frontend. |
1370 | 1370 | */ |
1371 | - public function frontend_render_alert_template( $field ) { |
|
1371 | + public function frontend_render_alert_template($field) { |
|
1372 | 1372 | |
1373 | 1373 | echo "<div class='form-group'>"; |
1374 | 1374 | |
1375 | 1375 | echo aui()->alert( |
1376 | 1376 | array( |
1377 | - 'content' => wp_kses_post( $field['text'] ), |
|
1377 | + 'content' => wp_kses_post($field['text']), |
|
1378 | 1378 | 'dismissible' => $field['dismissible'], |
1379 | - 'type' => str_replace( 'alert-', '', $field['class'] ), |
|
1379 | + 'type' => str_replace('alert-', '', $field['class']), |
|
1380 | 1380 | ) |
1381 | 1381 | ); |
1382 | 1382 | |
@@ -1387,14 +1387,14 @@ discard block |
||
1387 | 1387 | /** |
1388 | 1388 | * Renders the alert element template. |
1389 | 1389 | */ |
1390 | - public function edit_alert_template( $field ) { |
|
1391 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
1392 | - $label = __( 'Alert Text', 'invoicing' ); |
|
1393 | - $label2 = esc_attr__( 'Enter your alert text here', 'invoicing' ); |
|
1390 | + public function edit_alert_template($field) { |
|
1391 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
1392 | + $label = __('Alert Text', 'invoicing'); |
|
1393 | + $label2 = esc_attr__('Enter your alert text here', 'invoicing'); |
|
1394 | 1394 | $id = $field . '.id + "_edit"'; |
1395 | - $label3 = __( 'Is Dismissible?', 'invoicing' ); |
|
1395 | + $label3 = __('Is Dismissible?', 'invoicing'); |
|
1396 | 1396 | $id2 = $field . '.id + "_edit2"'; |
1397 | - $label4 = esc_attr__( 'Alert Type', 'invoicing' ); |
|
1397 | + $label4 = esc_attr__('Alert Type', 'invoicing'); |
|
1398 | 1398 | $id3 = $field . '.id + "_edit3"'; |
1399 | 1399 | echo " |
1400 | 1400 | <div $restrict> |
@@ -1410,14 +1410,14 @@ discard block |
||
1410 | 1410 | <label :for='$id3'>$label4</label> |
1411 | 1411 | |
1412 | 1412 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
1413 | - <option value='alert-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
1414 | - <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
1415 | - <option value='alert-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
1416 | - <option value='alert-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
1417 | - <option value='alert-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
1418 | - <option value='alert-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
1419 | - <option value='alert-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
1420 | - <option value='alert-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
1413 | + <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option> |
|
1414 | + <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
1415 | + <option value='alert-success'>" . __('Success', 'invoicing') . "</option> |
|
1416 | + <option value='alert-danger'>" . __('Danger', 'invoicing') . "</option> |
|
1417 | + <option value='alert-warning'>" . __('Warning', 'invoicing') . "</option> |
|
1418 | + <option value='alert-info'>" . __('Info', 'invoicing') . "</option> |
|
1419 | + <option value='alert-light'>" . __('Light', 'invoicing') . "</option> |
|
1420 | + <option value='alert-dark'>" . __('Dark', 'invoicing') . "</option> |
|
1421 | 1421 | </select> |
1422 | 1422 | </div> |
1423 | 1423 | </div> |
@@ -1428,8 +1428,8 @@ discard block |
||
1428 | 1428 | /** |
1429 | 1429 | * Renders the discount element template. |
1430 | 1430 | */ |
1431 | - public function render_discount_template( $field ) { |
|
1432 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
1431 | + public function render_discount_template($field) { |
|
1432 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
1433 | 1433 | ?> |
1434 | 1434 | |
1435 | 1435 | <div <?php echo $restrict; ?> class="discount_field border rounded p-3"> |
@@ -1446,13 +1446,13 @@ discard block |
||
1446 | 1446 | /** |
1447 | 1447 | * Renders the discount element on the frontend. |
1448 | 1448 | */ |
1449 | - public function frontend_render_discount_template( $field ) { |
|
1449 | + public function frontend_render_discount_template($field) { |
|
1450 | 1450 | |
1451 | - $placeholder = esc_attr( $field['input_label'] ); |
|
1452 | - $label = sanitize_text_field( $field['button_label'] ); |
|
1451 | + $placeholder = esc_attr($field['input_label']); |
|
1452 | + $label = sanitize_text_field($field['button_label']); |
|
1453 | 1453 | $description = ''; |
1454 | 1454 | |
1455 | - if ( ! empty( $field['description'] ) ) { |
|
1455 | + if (!empty($field['description'])) { |
|
1456 | 1456 | $description = "<small class='form-text text-muted'>{$field['description']}</small>"; |
1457 | 1457 | } |
1458 | 1458 | ?> |
@@ -1473,12 +1473,12 @@ discard block |
||
1473 | 1473 | /** |
1474 | 1474 | * Renders the discount element template. |
1475 | 1475 | */ |
1476 | - public function edit_discount_template( $field ) { |
|
1477 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
1478 | - $label = __( 'Discount Input Placeholder', 'invoicing' ); |
|
1479 | - $label2 = __( 'Help Text', 'invoicing' ); |
|
1480 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1481 | - $label4 = __( 'Button Text', 'invoicing' ); |
|
1476 | + public function edit_discount_template($field) { |
|
1477 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
1478 | + $label = __('Discount Input Placeholder', 'invoicing'); |
|
1479 | + $label2 = __('Help Text', 'invoicing'); |
|
1480 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1481 | + $label4 = __('Button Text', 'invoicing'); |
|
1482 | 1482 | $id = $field . '.id + "_edit"'; |
1483 | 1483 | $id2 = $field . '.id + "_edit2"'; |
1484 | 1484 | $id3 = $field . '.id + "_edit3"'; |
@@ -1507,8 +1507,8 @@ discard block |
||
1507 | 1507 | /** |
1508 | 1508 | * Renders the items element template. |
1509 | 1509 | */ |
1510 | - public function render_items_template( $field ) { |
|
1511 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
1510 | + public function render_items_template($field) { |
|
1511 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
1512 | 1512 | echo " |
1513 | 1513 | <div $restrict class='item_totals'> |
1514 | 1514 | |
@@ -1553,7 +1553,7 @@ discard block |
||
1553 | 1553 | <div v-if='$field.items_type == \"select\"'> |
1554 | 1554 | |
1555 | 1555 | <select class='form-control custom-select'> |
1556 | - <option value='' disabled selected='selected'>" . __( 'Select an option', 'invoicing' ) ."</option> |
|
1556 | + <option value='' disabled selected='selected'>" . __('Select an option', 'invoicing') . "</option> |
|
1557 | 1557 | <option v-for='(item, index) in form_items' :value='index'>{{item.title}} {{formatPrice(item.price)}}</option> |
1558 | 1558 | </select> |
1559 | 1559 | </div> |
@@ -1574,66 +1574,66 @@ discard block |
||
1574 | 1574 | /** |
1575 | 1575 | * Renders the items element on the frontend. |
1576 | 1576 | */ |
1577 | - public function frontend_render_items_template( $field, $items ) { |
|
1577 | + public function frontend_render_items_template($field, $items) { |
|
1578 | 1578 | |
1579 | 1579 | echo "<div class='form-group item_totals'>"; |
1580 | 1580 | |
1581 | - $id = esc_attr( $field['id'] ); |
|
1582 | - if ( 'total' == $field[ 'items_type' ] ) { |
|
1581 | + $id = esc_attr($field['id']); |
|
1582 | + if ('total' == $field['items_type']) { |
|
1583 | 1583 | $total = 0; |
1584 | 1584 | |
1585 | 1585 | ?> |
1586 | 1586 | <div class="border item_totals_type_total"> |
1587 | 1587 | |
1588 | 1588 | <?php |
1589 | - foreach( $items as $item ) { |
|
1590 | - $total = $total + floatval( $item['price'] ); |
|
1589 | + foreach ($items as $item) { |
|
1590 | + $total = $total + floatval($item['price']); |
|
1591 | 1591 | ?> |
1592 | 1592 | <div class="item_totals_item"> |
1593 | 1593 | <div class='row pl-2 pr-2 pt-2'> |
1594 | - <div class='col-8'><?php echo esc_html( $item['title'] ) ?></div> |
|
1595 | - <div class='col-4'><?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?></div> |
|
1594 | + <div class='col-8'><?php echo esc_html($item['title']) ?></div> |
|
1595 | + <div class='col-4'><?php echo wpinv_price(wpinv_format_amount($item['price'])) ?></div> |
|
1596 | 1596 | </div> |
1597 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1598 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1597 | + <?php if (!empty($item['description'])) { ?> |
|
1598 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1599 | 1599 | <?php } ?> |
1600 | 1600 | </div> |
1601 | 1601 | <?php } ?> |
1602 | 1602 | |
1603 | 1603 | <div class='mt-4 border-top item_totals_total'> |
1604 | 1604 | <div class='row p-2'> |
1605 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
1606 | - <div class='col-4'><strong><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
1605 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
1606 | + <div class='col-4'><strong><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
1607 | 1607 | </div> |
1608 | 1608 | </div> |
1609 | 1609 | |
1610 | 1610 | </div> |
1611 | 1611 | <?php } ?> |
1612 | 1612 | |
1613 | - <?php if ( 'radio' == $field[ 'items_type' ] ) { ?> |
|
1613 | + <?php if ('radio' == $field['items_type']) { ?> |
|
1614 | 1614 | <div class="item_totals_type_radio"> |
1615 | 1615 | |
1616 | - <?php foreach( $items as $index => $item ) { ?> |
|
1616 | + <?php foreach ($items as $index => $item) { ?> |
|
1617 | 1617 | <div class="form-check"> |
1618 | 1618 | <input class='form-check-input' type='radio' name='<?php echo $id; ?>' id='<?php echo $id . $index; ?>'> |
1619 | - <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> |
|
1619 | + <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> |
|
1620 | 1620 | </div> |
1621 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1622 | - <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1621 | + <?php if (!empty($item['description'])) { ?> |
|
1622 | + <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1623 | 1623 | <?php } ?> |
1624 | 1624 | <?php } ?> |
1625 | 1625 | |
1626 | 1626 | </div> |
1627 | 1627 | <?php } ?> |
1628 | 1628 | |
1629 | - <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?> |
|
1629 | + <?php if ('checkbox' == $field['items_type']) { ?> |
|
1630 | 1630 | |
1631 | 1631 | <div class="item_totals_type_checkbox"> |
1632 | 1632 | |
1633 | 1633 | <?php |
1634 | - foreach ( $items as $index => $item ) { |
|
1635 | - $title = sanitize_text_field( $item['title'] ); |
|
1636 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
1634 | + foreach ($items as $index => $item) { |
|
1635 | + $title = sanitize_text_field($item['title']); |
|
1636 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
1637 | 1637 | echo aui()->input( |
1638 | 1638 | array( |
1639 | 1639 | 'name' => $id, |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | ) |
1645 | 1645 | ); |
1646 | 1646 | |
1647 | - if ( ! empty( $item['description'] ) ) { |
|
1647 | + if (!empty($item['description'])) { |
|
1648 | 1648 | echo "<small class='form-text text-muted'>{$item['description']}</small>"; |
1649 | 1649 | } |
1650 | 1650 | } |
@@ -1653,7 +1653,7 @@ discard block |
||
1653 | 1653 | </div> |
1654 | 1654 | <?php } ?> |
1655 | 1655 | |
1656 | - <?php if ( 'select' == $field[ 'items_type' ] ) { ?> |
|
1656 | + <?php if ('select' == $field['items_type']) { ?> |
|
1657 | 1657 | |
1658 | 1658 | <div class="item_totals_type_select"> |
1659 | 1659 | |
@@ -1661,17 +1661,17 @@ discard block |
||
1661 | 1661 | |
1662 | 1662 | $options = array(); |
1663 | 1663 | |
1664 | - foreach ( $items as $index => $item ) { |
|
1665 | - $title = sanitize_text_field( $item['title'] ); |
|
1666 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
1667 | - $options[ $item['id'] ] = "$title ($price)"; |
|
1664 | + foreach ($items as $index => $item) { |
|
1665 | + $title = sanitize_text_field($item['title']); |
|
1666 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
1667 | + $options[$item['id']] = "$title ($price)"; |
|
1668 | 1668 | } |
1669 | 1669 | |
1670 | 1670 | echo aui()->select( |
1671 | 1671 | array( |
1672 | 1672 | 'name' => $id, |
1673 | 1673 | 'id' => $id, |
1674 | - 'placeholder' => __( 'Select an item', 'invoicing' ), |
|
1674 | + 'placeholder' => __('Select an item', 'invoicing'), |
|
1675 | 1675 | 'no_wrap' => true, |
1676 | 1676 | 'options' => $options, |
1677 | 1677 | ) |
@@ -1681,7 +1681,7 @@ discard block |
||
1681 | 1681 | </div> |
1682 | 1682 | <?php } ?> |
1683 | 1683 | |
1684 | - <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?> |
|
1684 | + <?php if ('multi_select' == $field['items_type']) { ?> |
|
1685 | 1685 | |
1686 | 1686 | <div class="item_totals_type_multi_select"> |
1687 | 1687 | |
@@ -1689,17 +1689,17 @@ discard block |
||
1689 | 1689 | |
1690 | 1690 | $options = array(); |
1691 | 1691 | |
1692 | - foreach ( $items as $index => $item ) { |
|
1693 | - $title = sanitize_text_field( $item['title'] ); |
|
1694 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
1695 | - $options[ $item['id'] ] = "$title ($price)"; |
|
1692 | + foreach ($items as $index => $item) { |
|
1693 | + $title = sanitize_text_field($item['title']); |
|
1694 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
1695 | + $options[$item['id']] = "$title ($price)"; |
|
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | echo aui()->select( |
1699 | 1699 | array( |
1700 | 1700 | 'name' => $id, |
1701 | 1701 | 'id' => $id, |
1702 | - 'placeholder' => __( 'Select one or more items', 'invoicing' ), |
|
1702 | + 'placeholder' => __('Select one or more items', 'invoicing'), |
|
1703 | 1703 | 'no_wrap' => true, |
1704 | 1704 | 'options' => $options, |
1705 | 1705 | 'multiple' => true, |
@@ -1717,11 +1717,11 @@ discard block |
||
1717 | 1717 | /** |
1718 | 1718 | * Renders the items element template. |
1719 | 1719 | */ |
1720 | - public function edit_items_template( $field ) { |
|
1721 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
1722 | - $label = __( 'Let customers...', 'invoicing' ); |
|
1723 | - $label2 = __( 'Available Items', 'invoicing' ); |
|
1724 | - $label3 = esc_attr__( 'Add some help text for this element', 'invoicing' ); |
|
1720 | + public function edit_items_template($field) { |
|
1721 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
1722 | + $label = __('Let customers...', 'invoicing'); |
|
1723 | + $label2 = __('Available Items', 'invoicing'); |
|
1724 | + $label3 = esc_attr__('Add some help text for this element', 'invoicing'); |
|
1725 | 1725 | $id = $field . '.id + "_edit"'; |
1726 | 1726 | $id2 = $field . '.id + "_edit2"'; |
1727 | 1727 | $id3 = $field . '.id + "_edit3"'; |
@@ -1771,7 +1771,7 @@ discard block |
||
1771 | 1771 | <div class='form-group mt-2'> |
1772 | 1772 | |
1773 | 1773 | <select class='form-control custom-select' v-model='selected_item'> |
1774 | - <option value=''>" . __( 'Add an item to the form', 'invoicing' ) ."</option> |
|
1774 | + <option value=''>" . __('Add an item to the form', 'invoicing') . "</option> |
|
1775 | 1775 | <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option> |
1776 | 1776 | </select> |
1777 | 1777 | |
@@ -1786,11 +1786,11 @@ discard block |
||
1786 | 1786 | <label :for='$id2'>$label</label> |
1787 | 1787 | |
1788 | 1788 | <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'> |
1789 | - <option value='total'>" . __( 'Buy all items on the list', 'invoicing' ) ."</option> |
|
1790 | - <option value='radio'>" . __( 'Select a single item from the list', 'invoicing' ) ."</option> |
|
1791 | - <option value='checkbox'>" . __( 'Select one or more items on the list', 'invoicing' ) ."</option> |
|
1792 | - <option value='select'>" . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option> |
|
1793 | - <option value='multi_select'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option> |
|
1789 | + <option value='total'>" . __('Buy all items on the list', 'invoicing') . "</option> |
|
1790 | + <option value='radio'>" . __('Select a single item from the list', 'invoicing') . "</option> |
|
1791 | + <option value='checkbox'>" . __('Select one or more items on the list', 'invoicing') . "</option> |
|
1792 | + <option value='select'>" . __('Select a single item from a dropdown', 'invoicing') . "</option> |
|
1793 | + <option value='multi_select'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option> |
|
1794 | 1794 | </select> |
1795 | 1795 | |
1796 | 1796 | </div> |
@@ -1815,24 +1815,24 @@ discard block |
||
1815 | 1815 | 'orderby' => 'title', |
1816 | 1816 | 'order' => 'ASC', |
1817 | 1817 | 'posts_per_page' => -1, |
1818 | - 'post_status' => array( 'publish' ), |
|
1818 | + 'post_status' => array('publish'), |
|
1819 | 1819 | ); |
1820 | 1820 | |
1821 | - $items = get_posts( apply_filters( 'wpinv_item_dropdown_query_args', $item_args ) ); |
|
1821 | + $items = get_posts(apply_filters('wpinv_item_dropdown_query_args', $item_args)); |
|
1822 | 1822 | |
1823 | - if ( empty( $items ) ) { |
|
1823 | + if (empty($items)) { |
|
1824 | 1824 | return array(); |
1825 | 1825 | } |
1826 | 1826 | |
1827 | - $options = array(); |
|
1828 | - foreach ( $items as $item ) { |
|
1829 | - $title = esc_html( $item->post_title ); |
|
1830 | - $title .= wpinv_get_item_suffix( $item->ID, false ); |
|
1831 | - $id = absint( $item->ID ); |
|
1832 | - $price = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) ); |
|
1833 | - $recurring = (bool) get_post_meta( $id, '_wpinv_is_recurring', true ); |
|
1827 | + $options = array(); |
|
1828 | + foreach ($items as $item) { |
|
1829 | + $title = esc_html($item->post_title); |
|
1830 | + $title .= wpinv_get_item_suffix($item->ID, false); |
|
1831 | + $id = absint($item->ID); |
|
1832 | + $price = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true)); |
|
1833 | + $recurring = (bool) get_post_meta($id, '_wpinv_is_recurring', true); |
|
1834 | 1834 | $description = $item->post_excerpt; |
1835 | - $options[] = compact( 'title', 'id', 'price', 'recurring', 'description' ); |
|
1835 | + $options[] = compact('title', 'id', 'price', 'recurring', 'description'); |
|
1836 | 1836 | |
1837 | 1837 | } |
1838 | 1838 | return $options; |
@@ -1842,38 +1842,38 @@ discard block |
||
1842 | 1842 | /** |
1843 | 1843 | * Returns an array of items for the currently being edited form. |
1844 | 1844 | */ |
1845 | - public function get_form_items( $id = false ) { |
|
1845 | + public function get_form_items($id = false) { |
|
1846 | 1846 | |
1847 | - if ( empty( $id ) ) { |
|
1848 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
1847 | + if (empty($id)) { |
|
1848 | + return wpinv_get_data('sample-payment-form-items'); |
|
1849 | 1849 | } |
1850 | 1850 | |
1851 | - $form_elements = get_post_meta( $id, 'wpinv_form_items', true ); |
|
1851 | + $form_elements = get_post_meta($id, 'wpinv_form_items', true); |
|
1852 | 1852 | |
1853 | - if ( is_array( $form_elements ) ) { |
|
1853 | + if (is_array($form_elements)) { |
|
1854 | 1854 | return $form_elements; |
1855 | 1855 | } |
1856 | 1856 | |
1857 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
1857 | + return wpinv_get_data('sample-payment-form-items'); |
|
1858 | 1858 | |
1859 | 1859 | } |
1860 | 1860 | |
1861 | 1861 | /** |
1862 | 1862 | * Returns an array of elements for the currently being edited form. |
1863 | 1863 | */ |
1864 | - public function get_form_elements( $id = false ) { |
|
1864 | + public function get_form_elements($id = false) { |
|
1865 | 1865 | |
1866 | - if ( empty( $id ) ) { |
|
1867 | - return wpinv_get_data( 'sample-payment-form' ); |
|
1866 | + if (empty($id)) { |
|
1867 | + return wpinv_get_data('sample-payment-form'); |
|
1868 | 1868 | } |
1869 | 1869 | |
1870 | - $form_elements = get_post_meta( $id, 'wpinv_form_elements', true ); |
|
1870 | + $form_elements = get_post_meta($id, 'wpinv_form_elements', true); |
|
1871 | 1871 | |
1872 | - if ( is_array( $form_elements ) ) { |
|
1872 | + if (is_array($form_elements)) { |
|
1873 | 1873 | return $form_elements; |
1874 | 1874 | } |
1875 | 1875 | |
1876 | - return wpinv_get_data( 'sample-payment-form' ); |
|
1876 | + return wpinv_get_data('sample-payment-form'); |
|
1877 | 1877 | } |
1878 | 1878 | |
1879 | 1879 | } |