@@ -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,14 +207,14 @@ discard block |
||
207 | 207 | |
208 | 208 | array( |
209 | 209 | 'type' => 'address', |
210 | - 'name' => __( 'Address', 'invoicing' ), |
|
210 | + 'name' => __('Address', 'invoicing'), |
|
211 | 211 | 'defaults' => array( |
212 | 212 | |
213 | 213 | 'fields' => array( |
214 | 214 | array( |
215 | 215 | 'placeholder' => 'Jon', |
216 | 216 | 'value' => '', |
217 | - 'label' => __( 'First Name', 'invoicing' ), |
|
217 | + 'label' => __('First Name', 'invoicing'), |
|
218 | 218 | 'description' => '', |
219 | 219 | 'required' => false, |
220 | 220 | 'visible' => true, |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | array( |
225 | 225 | 'placeholder' => 'Snow', |
226 | 226 | 'value' => '', |
227 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
227 | + 'label' => __('Last Name', 'invoicing'), |
|
228 | 228 | 'description' => '', |
229 | 229 | 'required' => false, |
230 | 230 | 'visible' => true, |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | array( |
235 | 235 | 'placeholder' => '', |
236 | 236 | 'value' => '', |
237 | - 'label' => __( 'Address', 'invoicing' ), |
|
237 | + 'label' => __('Address', 'invoicing'), |
|
238 | 238 | 'description' => '', |
239 | 239 | 'required' => false, |
240 | 240 | 'visible' => true, |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | array( |
245 | 245 | 'placeholder' => '', |
246 | 246 | 'value' => '', |
247 | - 'label' => __( 'City', 'invoicing' ), |
|
247 | + 'label' => __('City', 'invoicing'), |
|
248 | 248 | 'description' => '', |
249 | 249 | 'required' => false, |
250 | 250 | 'visible' => true, |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | ), |
253 | 253 | |
254 | 254 | array( |
255 | - 'placeholder' => __( 'Select your country' ), |
|
255 | + 'placeholder' => __('Select your country'), |
|
256 | 256 | 'value' => '', |
257 | - 'label' => __( 'Country', 'invoicing' ), |
|
257 | + 'label' => __('Country', 'invoicing'), |
|
258 | 258 | 'description' => '', |
259 | 259 | 'required' => false, |
260 | 260 | 'visible' => true, |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | ), |
263 | 263 | |
264 | 264 | array( |
265 | - 'placeholder' => __( 'Choose a state', 'invoicing' ), |
|
265 | + 'placeholder' => __('Choose a state', 'invoicing'), |
|
266 | 266 | 'value' => '', |
267 | - 'label' => __( 'State / Province', 'invoicing' ), |
|
267 | + 'label' => __('State / Province', 'invoicing'), |
|
268 | 268 | 'description' => '', |
269 | 269 | 'required' => false, |
270 | 270 | 'visible' => true, |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | array( |
275 | 275 | 'placeholder' => '', |
276 | 276 | 'value' => '', |
277 | - 'label' => __( 'ZIP / Postcode', 'invoicing' ), |
|
277 | + 'label' => __('ZIP / Postcode', 'invoicing'), |
|
278 | 278 | 'description' => '', |
279 | 279 | 'required' => false, |
280 | 280 | 'visible' => true, |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | array( |
285 | 285 | 'placeholder' => '', |
286 | 286 | 'value' => '', |
287 | - 'label' => __( 'Phone', 'invoicing' ), |
|
287 | + 'label' => __('Phone', 'invoicing'), |
|
288 | 288 | 'description' => '', |
289 | 289 | 'required' => false, |
290 | 290 | 'visible' => true, |
@@ -296,11 +296,11 @@ discard block |
||
296 | 296 | |
297 | 297 | array( |
298 | 298 | 'type' => 'billing_email', |
299 | - 'name' => __( 'Billing Email', 'invoicing' ), |
|
299 | + 'name' => __('Billing Email', 'invoicing'), |
|
300 | 300 | 'defaults' => array( |
301 | 301 | 'placeholder' => '[email protected]', |
302 | 302 | 'value' => '', |
303 | - 'label' => __( 'Billing Email', 'invoicing' ), |
|
303 | + 'label' => __('Billing Email', 'invoicing'), |
|
304 | 304 | 'description' => '', |
305 | 305 | 'premade' => true, |
306 | 306 | ) |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | array( |
321 | 321 | 'type' => 'items', |
322 | - 'name' => __( 'Items', 'invoicing' ), |
|
322 | + 'name' => __('Items', 'invoicing'), |
|
323 | 323 | 'defaults' => array( |
324 | 324 | 'value' => '', |
325 | 325 | 'items_type' => 'total', |
@@ -330,25 +330,25 @@ discard block |
||
330 | 330 | |
331 | 331 | array( |
332 | 332 | 'type' => 'pay_button', |
333 | - 'name' => __( 'Payment Button', 'invoicing' ), |
|
333 | + 'name' => __('Payment Button', 'invoicing'), |
|
334 | 334 | 'defaults' => array( |
335 | 335 | 'value' => '', |
336 | 336 | 'class' => 'btn-primary', |
337 | - 'label' => __( 'Pay Now »', 'invoicing' ), |
|
338 | - 'description' => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
337 | + 'label' => __('Pay Now »', 'invoicing'), |
|
338 | + 'description' => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
339 | 339 | 'premade' => true, |
340 | 340 | ) |
341 | 341 | ) |
342 | 342 | ); |
343 | 343 | |
344 | - $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements ); |
|
344 | + $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements); |
|
345 | 345 | return $this->elements; |
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
349 | 349 | * Returns the restrict markup. |
350 | 350 | */ |
351 | - public function get_restrict_markup( $field, $field_type ) { |
|
351 | + public function get_restrict_markup($field, $field_type) { |
|
352 | 352 | $restrict = "$field.type=='$field_type'"; |
353 | 353 | return "v-if=\"$restrict\""; |
354 | 354 | } |
@@ -356,15 +356,15 @@ discard block |
||
356 | 356 | /** |
357 | 357 | * Renders the title element template. |
358 | 358 | */ |
359 | - public function render_heading_template( $field ) { |
|
360 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
359 | + public function render_heading_template($field) { |
|
360 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
361 | 361 | echo "<component :is='$field.level' $restrict v-html='$field.text'></component>"; |
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
365 | 365 | * Renders the title element on the frontend. |
366 | 366 | */ |
367 | - public function frontend_render_heading_template( $field ) { |
|
367 | + public function frontend_render_heading_template($field) { |
|
368 | 368 | $tag = $field['level']; |
369 | 369 | echo "<$tag>{$field['text']}</$tag>"; |
370 | 370 | } |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | /** |
373 | 373 | * Renders the edit title element template. |
374 | 374 | */ |
375 | - public function edit_heading_template( $field ) { |
|
376 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
377 | - $label = __( 'Heading', 'invoicing' ); |
|
378 | - $label2 = __( 'Select Heading Level', 'invoicing' ); |
|
375 | + public function edit_heading_template($field) { |
|
376 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
377 | + $label = __('Heading', 'invoicing'); |
|
378 | + $label2 = __('Select Heading Level', 'invoicing'); |
|
379 | 379 | $id = $field . '.id + "_edit"'; |
380 | 380 | $id2 = $field . '.id + "_edit2"'; |
381 | 381 | |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | /** |
408 | 408 | * Renders a paragraph element template. |
409 | 409 | */ |
410 | - public function render_paragraph_template( $field ) { |
|
411 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
410 | + public function render_paragraph_template($field) { |
|
411 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
412 | 412 | $label = "$field.text"; |
413 | 413 | echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>"; |
414 | 414 | } |
@@ -416,16 +416,16 @@ discard block |
||
416 | 416 | /** |
417 | 417 | * Renders the paragraph element on the frontend. |
418 | 418 | */ |
419 | - public function frontend_render_paragraph_template( $field ) { |
|
419 | + public function frontend_render_paragraph_template($field) { |
|
420 | 420 | echo "<p>{$field['text']}</p>"; |
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
424 | 424 | * Renders the edit paragraph element template. |
425 | 425 | */ |
426 | - public function edit_paragraph_template( $field ) { |
|
427 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
428 | - $label = __( 'Enter your text', 'invoicing' ); |
|
426 | + public function edit_paragraph_template($field) { |
|
427 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
428 | + $label = __('Enter your text', 'invoicing'); |
|
429 | 429 | $id = $field . '.id + "_edit"'; |
430 | 430 | echo " |
431 | 431 | <div $restrict> |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | /** |
442 | 442 | * Renders the text element template. |
443 | 443 | */ |
444 | - public function render_text_template( $field ) { |
|
445 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
444 | + public function render_text_template($field) { |
|
445 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
446 | 446 | $label = "$field.label"; |
447 | 447 | echo " |
448 | 448 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -457,23 +457,23 @@ discard block |
||
457 | 457 | /** |
458 | 458 | * Renders the text element on the frontend. |
459 | 459 | */ |
460 | - public function frontend_render_text_template( $field ) { |
|
460 | + public function frontend_render_text_template($field) { |
|
461 | 461 | |
462 | 462 | echo "<div class='form-group'>"; |
463 | 463 | |
464 | 464 | echo aui()->input( |
465 | 465 | array( |
466 | - 'name' => esc_attr( $field['id'] ), |
|
467 | - 'id' => esc_attr( $field['id'] ), |
|
468 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
466 | + 'name' => esc_attr($field['id']), |
|
467 | + 'id' => esc_attr($field['id']), |
|
468 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
469 | 469 | 'required' => (bool) $field['required'], |
470 | - 'label' => wp_kses_post( $field['label'] ), |
|
470 | + 'label' => wp_kses_post($field['label']), |
|
471 | 471 | 'no_wrap' => true, |
472 | 472 | ) |
473 | 473 | ); |
474 | 474 | |
475 | - if ( ! empty( $field['description'] ) ) { |
|
476 | - $description = wp_kses_post( $field['description'] ); |
|
475 | + if (!empty($field['description'])) { |
|
476 | + $description = wp_kses_post($field['description']); |
|
477 | 477 | echo "<small class='form-text text-muted'>$description</small>"; |
478 | 478 | } |
479 | 479 | |
@@ -484,16 +484,16 @@ discard block |
||
484 | 484 | /** |
485 | 485 | * Renders the edit text element template. |
486 | 486 | */ |
487 | - public function edit_text_template( $field ) { |
|
488 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
489 | - $label = __( 'Field Label', 'invoicing' ); |
|
487 | + public function edit_text_template($field) { |
|
488 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
489 | + $label = __('Field Label', 'invoicing'); |
|
490 | 490 | $id = $field . '.id + "_edit"'; |
491 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
491 | + $label2 = __('Placeholder text', 'invoicing'); |
|
492 | 492 | $id2 = $field . '.id + "_edit2"'; |
493 | - $label3 = __( 'Help text', 'invoicing' ); |
|
494 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
493 | + $label3 = __('Help text', 'invoicing'); |
|
494 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
495 | 495 | $id3 = $field . '.id + "_edit3"'; |
496 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
496 | + $label5 = __('Is this field required?', 'invoicing'); |
|
497 | 497 | $id4 = $field . '.id + "_edit4"'; |
498 | 498 | echo " |
499 | 499 | <div $restrict> |
@@ -521,8 +521,8 @@ discard block |
||
521 | 521 | /** |
522 | 522 | * Renders the textarea element template. |
523 | 523 | */ |
524 | - public function render_textarea_template( $field ) { |
|
525 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
524 | + public function render_textarea_template($field) { |
|
525 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
526 | 526 | $label = "$field.label"; |
527 | 527 | echo " |
528 | 528 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -537,24 +537,24 @@ discard block |
||
537 | 537 | /** |
538 | 538 | * Renders the textarea element on the frontend. |
539 | 539 | */ |
540 | - public function frontend_render_textarea_template( $field ) { |
|
540 | + public function frontend_render_textarea_template($field) { |
|
541 | 541 | |
542 | 542 | echo "<div class='form-group'>"; |
543 | 543 | |
544 | 544 | echo aui()->textarea( |
545 | 545 | array( |
546 | - 'name' => esc_attr( $field['id'] ), |
|
547 | - 'id' => esc_attr( $field['id'] ), |
|
548 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
546 | + 'name' => esc_attr($field['id']), |
|
547 | + 'id' => esc_attr($field['id']), |
|
548 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
549 | 549 | 'required' => (bool) $field['required'], |
550 | - 'label' => wp_kses_post( $field['label'] ), |
|
550 | + 'label' => wp_kses_post($field['label']), |
|
551 | 551 | 'no_wrap' => true, |
552 | 552 | 'rows' => 3, |
553 | 553 | ) |
554 | 554 | ); |
555 | 555 | |
556 | - if ( ! empty( $field['description'] ) ) { |
|
557 | - $description = wp_kses_post( $field['description'] ); |
|
556 | + if (!empty($field['description'])) { |
|
557 | + $description = wp_kses_post($field['description']); |
|
558 | 558 | echo "<small class='form-text text-muted'>$description</small>"; |
559 | 559 | } |
560 | 560 | |
@@ -565,16 +565,16 @@ discard block |
||
565 | 565 | /** |
566 | 566 | * Renders the edit textarea element template. |
567 | 567 | */ |
568 | - public function edit_textarea_template( $field ) { |
|
569 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
570 | - $label = __( 'Field Label', 'invoicing' ); |
|
568 | + public function edit_textarea_template($field) { |
|
569 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
570 | + $label = __('Field Label', 'invoicing'); |
|
571 | 571 | $id = $field . '.id + "_edit"'; |
572 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
572 | + $label2 = __('Placeholder text', 'invoicing'); |
|
573 | 573 | $id2 = $field . '.id + "_edit2"'; |
574 | - $label3 = __( 'Help text', 'invoicing' ); |
|
575 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
574 | + $label3 = __('Help text', 'invoicing'); |
|
575 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
576 | 576 | $id3 = $field . '.id + "_edit3"'; |
577 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
577 | + $label5 = __('Is this field required?', 'invoicing'); |
|
578 | 578 | $id4 = $field . '.id + "_edit4"'; |
579 | 579 | echo " |
580 | 580 | <div $restrict> |
@@ -602,8 +602,8 @@ discard block |
||
602 | 602 | /** |
603 | 603 | * Renders the select element template. |
604 | 604 | */ |
605 | - public function render_select_template( $field ) { |
|
606 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
605 | + public function render_select_template($field) { |
|
606 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
607 | 607 | $label = "$field.label"; |
608 | 608 | $placeholder = "$field.placeholder"; |
609 | 609 | $id = $field . '.id'; |
@@ -623,24 +623,24 @@ discard block |
||
623 | 623 | /** |
624 | 624 | * Renders the select element on the frontend. |
625 | 625 | */ |
626 | - public function frontend_render_select_template( $field ) { |
|
626 | + public function frontend_render_select_template($field) { |
|
627 | 627 | |
628 | 628 | echo "<div class='form-group'>"; |
629 | 629 | |
630 | 630 | echo aui()->select( |
631 | 631 | array( |
632 | - 'name' => esc_attr( $field['id'] ), |
|
633 | - 'id' => esc_attr( $field['id'] ), |
|
634 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
632 | + 'name' => esc_attr($field['id']), |
|
633 | + 'id' => esc_attr($field['id']), |
|
634 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
635 | 635 | 'required' => (bool) $field['required'], |
636 | - 'label' => wp_kses_post( $field['label'] ), |
|
636 | + 'label' => wp_kses_post($field['label']), |
|
637 | 637 | 'no_wrap' => true, |
638 | - 'options' => array_combine( $field['options'], $field['options'] ), |
|
638 | + 'options' => array_combine($field['options'], $field['options']), |
|
639 | 639 | ) |
640 | 640 | ); |
641 | 641 | |
642 | - if ( ! empty( $field['description'] ) ) { |
|
643 | - $description = wp_kses_post( $field['description'] ); |
|
642 | + if (!empty($field['description'])) { |
|
643 | + $description = wp_kses_post($field['description']); |
|
644 | 644 | echo "<small class='form-text text-muted'>$description</small>"; |
645 | 645 | } |
646 | 646 | |
@@ -651,18 +651,18 @@ discard block |
||
651 | 651 | /** |
652 | 652 | * Renders the edit select element template. |
653 | 653 | */ |
654 | - public function edit_select_template( $field ) { |
|
655 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
656 | - $label = __( 'Field Label', 'invoicing' ); |
|
654 | + public function edit_select_template($field) { |
|
655 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
656 | + $label = __('Field Label', 'invoicing'); |
|
657 | 657 | $id = $field . '.id + "_edit"'; |
658 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
658 | + $label2 = __('Placeholder text', 'invoicing'); |
|
659 | 659 | $id2 = $field . '.id + "_edit2"'; |
660 | - $label3 = __( 'Help text', 'invoicing' ); |
|
661 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
660 | + $label3 = __('Help text', 'invoicing'); |
|
661 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
662 | 662 | $id3 = $field . '.id + "_edit3"'; |
663 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
663 | + $label5 = __('Is this field required?', 'invoicing'); |
|
664 | 664 | $id4 = $field . '.id + "_edit4"'; |
665 | - $label6 = __( 'Available Options', 'invoicing' ); |
|
665 | + $label6 = __('Available Options', 'invoicing'); |
|
666 | 666 | echo " |
667 | 667 | <div $restrict> |
668 | 668 | <div class='form-group'> |
@@ -700,8 +700,8 @@ discard block |
||
700 | 700 | /** |
701 | 701 | * Renders the checkbox element template. |
702 | 702 | */ |
703 | - public function render_checkbox_template( $field ) { |
|
704 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
703 | + public function render_checkbox_template($field) { |
|
704 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
705 | 705 | $label = "$field.label"; |
706 | 706 | echo " |
707 | 707 | <div class='form-check' $restrict> |
@@ -716,24 +716,24 @@ discard block |
||
716 | 716 | /** |
717 | 717 | * Renders the checkbox element on the frontend. |
718 | 718 | */ |
719 | - public function frontend_render_checkbox_template( $field ) { |
|
719 | + public function frontend_render_checkbox_template($field) { |
|
720 | 720 | |
721 | 721 | echo "<div class='form-group'>"; |
722 | 722 | |
723 | 723 | echo aui()->input( |
724 | 724 | array( |
725 | - 'name' => esc_attr( $field['id'] ), |
|
726 | - 'id' => esc_attr( $field['id'] ), |
|
725 | + 'name' => esc_attr($field['id']), |
|
726 | + 'id' => esc_attr($field['id']), |
|
727 | 727 | 'required' => (bool) $field['required'], |
728 | - 'label' => wp_kses_post( $field['label'] ), |
|
728 | + 'label' => wp_kses_post($field['label']), |
|
729 | 729 | 'no_wrap' => true, |
730 | - 'value' => esc_attr__( 'Yes', 'invoicing' ), |
|
730 | + 'value' => esc_attr__('Yes', 'invoicing'), |
|
731 | 731 | 'type' => 'checkbox', |
732 | 732 | ) |
733 | 733 | ); |
734 | 734 | |
735 | - if ( ! empty( $field['description'] ) ) { |
|
736 | - $description = wp_kses_post( $field['description'] ); |
|
735 | + if (!empty($field['description'])) { |
|
736 | + $description = wp_kses_post($field['description']); |
|
737 | 737 | echo "<small class='form-text text-muted'>$description</small>"; |
738 | 738 | } |
739 | 739 | |
@@ -744,14 +744,14 @@ discard block |
||
744 | 744 | /** |
745 | 745 | * Renders the edit checkbox element template. |
746 | 746 | */ |
747 | - public function edit_checkbox_template( $field ) { |
|
748 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
749 | - $label = __( 'Field Label', 'invoicing' ); |
|
747 | + public function edit_checkbox_template($field) { |
|
748 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
749 | + $label = __('Field Label', 'invoicing'); |
|
750 | 750 | $id = $field . '.id + "_edit"'; |
751 | - $label2 = __( 'Help text', 'invoicing' ); |
|
752 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
751 | + $label2 = __('Help text', 'invoicing'); |
|
752 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
753 | 753 | $id2 = $field . '.id + "_edit2"'; |
754 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
754 | + $label4 = __('Is this field required?', 'invoicing'); |
|
755 | 755 | $id3 = $field . '.id + "_edit3"'; |
756 | 756 | echo " |
757 | 757 | <div $restrict> |
@@ -775,8 +775,8 @@ discard block |
||
775 | 775 | /** |
776 | 776 | * Renders the radio element template. |
777 | 777 | */ |
778 | - public function render_radio_template( $field ) { |
|
779 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
778 | + public function render_radio_template($field) { |
|
779 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
780 | 780 | $label = "$field.label"; |
781 | 781 | $id = $field . '.id'; |
782 | 782 | echo " |
@@ -795,20 +795,20 @@ discard block |
||
795 | 795 | /** |
796 | 796 | * Renders the radio element on the frontend. |
797 | 797 | */ |
798 | - public function frontend_render_radio_template( $field ) { |
|
798 | + public function frontend_render_radio_template($field) { |
|
799 | 799 | |
800 | 800 | echo "<div class='form-group'>"; |
801 | 801 | |
802 | - if ( ! empty( $field['label'] ) ) { |
|
803 | - $label = wp_kses_post( $field['label'] ); |
|
802 | + if (!empty($field['label'])) { |
|
803 | + $label = wp_kses_post($field['label']); |
|
804 | 804 | echo "<legend class='col-form-label'>$label</legend>"; |
805 | 805 | } |
806 | 806 | |
807 | - foreach( $field['options'] as $index => $option ) { |
|
807 | + foreach ($field['options'] as $index => $option) { |
|
808 | 808 | $id = $field['id'] . $index; |
809 | 809 | $name = $field['id']; |
810 | - $value = esc_attr( $option ); |
|
811 | - $label = wp_kses_post( $option ); |
|
810 | + $value = esc_attr($option); |
|
811 | + $label = wp_kses_post($option); |
|
812 | 812 | |
813 | 813 | echo " |
814 | 814 | <div class='form-check'> |
@@ -818,8 +818,8 @@ discard block |
||
818 | 818 | "; |
819 | 819 | } |
820 | 820 | |
821 | - if ( ! empty( $field['description'] ) ) { |
|
822 | - $description = wp_kses_post( $field['description'] ); |
|
821 | + if (!empty($field['description'])) { |
|
822 | + $description = wp_kses_post($field['description']); |
|
823 | 823 | echo "<small class='form-text text-muted'>$description</small>"; |
824 | 824 | } |
825 | 825 | |
@@ -830,16 +830,16 @@ discard block |
||
830 | 830 | /** |
831 | 831 | * Renders the edit radio element template. |
832 | 832 | */ |
833 | - public function edit_radio_template( $field ) { |
|
834 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
835 | - $label = __( 'Field Label', 'invoicing' ); |
|
833 | + public function edit_radio_template($field) { |
|
834 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
835 | + $label = __('Field Label', 'invoicing'); |
|
836 | 836 | $id = $field . '.id + "_edit"'; |
837 | - $label2 = __( 'Help text', 'invoicing' ); |
|
838 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
837 | + $label2 = __('Help text', 'invoicing'); |
|
838 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
839 | 839 | $id2 = $field . '.id + "_edit3"'; |
840 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
840 | + $label4 = __('Is this field required?', 'invoicing'); |
|
841 | 841 | $id3 = $field . '.id + "_edit4"'; |
842 | - $label5 = __( 'Available Options', 'invoicing' ); |
|
842 | + $label5 = __('Available Options', 'invoicing'); |
|
843 | 843 | echo " |
844 | 844 | <div $restrict> |
845 | 845 | <div class='form-group'> |
@@ -873,8 +873,8 @@ discard block |
||
873 | 873 | /** |
874 | 874 | * Renders the address element template. |
875 | 875 | */ |
876 | - public function render_address_template( $field ) { |
|
877 | - $restrict = $this->get_restrict_markup( $field, 'address' ); |
|
876 | + public function render_address_template($field) { |
|
877 | + $restrict = $this->get_restrict_markup($field, 'address'); |
|
878 | 878 | |
879 | 879 | echo " |
880 | 880 | <div class='wpinv-address-wrapper' $restrict> |
@@ -896,55 +896,55 @@ discard block |
||
896 | 896 | /** |
897 | 897 | * Renders the address element on the frontend. |
898 | 898 | */ |
899 | - public function frontend_render_address_template( $field ) { |
|
899 | + public function frontend_render_address_template($field) { |
|
900 | 900 | |
901 | 901 | echo "<div class='wpinv-address-fields'>"; |
902 | 902 | |
903 | - foreach( $field['fields'] as $address_field ) { |
|
903 | + foreach ($field['fields'] as $address_field) { |
|
904 | 904 | |
905 | - if ( empty( $address_field['visible'] ) ) { |
|
905 | + if (empty($address_field['visible'])) { |
|
906 | 906 | continue; |
907 | 907 | } |
908 | 908 | |
909 | - $class = esc_attr( $address_field['name'] ); |
|
909 | + $class = esc_attr($address_field['name']); |
|
910 | 910 | echo "<div class='form-group $class'>"; |
911 | 911 | |
912 | 912 | $label = $address_field['label']; |
913 | 913 | |
914 | - if ( ! empty( $address_field['required'] ) ) { |
|
914 | + if (!empty($address_field['required'])) { |
|
915 | 915 | $label .= "<span class='text-danger'> *</span>"; |
916 | 916 | } |
917 | 917 | |
918 | - if ( 'wpinv_country' == $address_field['name'] ) { |
|
918 | + if ('wpinv_country' == $address_field['name']) { |
|
919 | 919 | |
920 | - echo aui()->select( array( |
|
920 | + echo aui()->select(array( |
|
921 | 921 | 'options' => wpinv_get_country_list(), |
922 | - 'name' => esc_attr( $address_field['name'] ), |
|
923 | - 'id' => esc_attr( $address_field['name'] ), |
|
922 | + 'name' => esc_attr($address_field['name']), |
|
923 | + 'id' => esc_attr($address_field['name']), |
|
924 | 924 | 'value' => wpinv_get_default_country(), |
925 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
925 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
926 | 926 | 'required' => (bool) $address_field['required'], |
927 | 927 | 'no_wrap' => true, |
928 | - 'label' => wp_kses_post( $label ), |
|
928 | + 'label' => wp_kses_post($label), |
|
929 | 929 | 'select2' => false, |
930 | 930 | )); |
931 | 931 | |
932 | - } else if ( 'wpinv_state' == $address_field['name'] ) { |
|
932 | + } else if ('wpinv_state' == $address_field['name']) { |
|
933 | 933 | |
934 | - $states = wpinv_get_country_states( wpinv_get_default_country() ); |
|
934 | + $states = wpinv_get_country_states(wpinv_get_default_country()); |
|
935 | 935 | $state = wpinv_get_default_state(); |
936 | 936 | |
937 | - if ( ! empty( $states ) ) { |
|
937 | + if (!empty($states)) { |
|
938 | 938 | |
939 | - echo aui()->select( array( |
|
939 | + echo aui()->select(array( |
|
940 | 940 | 'options' => $states, |
941 | - 'name' => esc_attr( $address_field['name'] ), |
|
942 | - 'id' => esc_attr( $address_field['name'] ), |
|
941 | + 'name' => esc_attr($address_field['name']), |
|
942 | + 'id' => esc_attr($address_field['name']), |
|
943 | 943 | 'value' => $state, |
944 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
944 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
945 | 945 | 'required' => (bool) $address_field['required'], |
946 | 946 | 'no_wrap' => true, |
947 | - 'label' => wp_kses_post( $label ), |
|
947 | + 'label' => wp_kses_post($label), |
|
948 | 948 | 'select2' => false, |
949 | 949 | )); |
950 | 950 | |
@@ -952,10 +952,10 @@ discard block |
||
952 | 952 | |
953 | 953 | echo aui()->input( |
954 | 954 | array( |
955 | - 'name' => esc_attr( $address_field['name'] ), |
|
956 | - 'id' => esc_attr( $address_field['name'] ), |
|
955 | + 'name' => esc_attr($address_field['name']), |
|
956 | + 'id' => esc_attr($address_field['name']), |
|
957 | 957 | 'required' => (bool) $address_field['required'], |
958 | - 'label' => wp_kses_post( $label ), |
|
958 | + 'label' => wp_kses_post($label), |
|
959 | 959 | 'no_wrap' => true, |
960 | 960 | 'type' => 'text', |
961 | 961 | ) |
@@ -967,12 +967,12 @@ discard block |
||
967 | 967 | |
968 | 968 | echo aui()->input( |
969 | 969 | array( |
970 | - 'name' => esc_attr( $address_field['name'] ), |
|
971 | - 'id' => esc_attr( $address_field['name'] ), |
|
970 | + 'name' => esc_attr($address_field['name']), |
|
971 | + 'id' => esc_attr($address_field['name']), |
|
972 | 972 | 'required' => (bool) $address_field['required'], |
973 | - 'label' => wp_kses_post( $label ), |
|
973 | + 'label' => wp_kses_post($label), |
|
974 | 974 | 'no_wrap' => true, |
975 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
975 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
976 | 976 | 'type' => 'text', |
977 | 977 | ) |
978 | 978 | ); |
@@ -980,8 +980,8 @@ discard block |
||
980 | 980 | } |
981 | 981 | |
982 | 982 | |
983 | - if ( ! empty( $address_field['description'] ) ) { |
|
984 | - $description = wp_kses_post( $address_field['description'] ); |
|
983 | + if (!empty($address_field['description'])) { |
|
984 | + $description = wp_kses_post($address_field['description']); |
|
985 | 985 | echo "<small class='form-text text-muted'>$description</small>"; |
986 | 986 | } |
987 | 987 | |
@@ -996,13 +996,13 @@ discard block |
||
996 | 996 | /** |
997 | 997 | * Renders the edit address element template. |
998 | 998 | */ |
999 | - public function edit_address_template( $field ) { |
|
1000 | - $restrict = $this->get_restrict_markup( $field, 'address' ); |
|
1001 | - $label = __( 'Field Label', 'invoicing' ); |
|
1002 | - $label2 = __( 'Placeholder', 'invoicing' ); |
|
1003 | - $label3 = __( 'Description', 'invoicing' ); |
|
1004 | - $label4 = __( 'Is required', 'invoicing' ); |
|
1005 | - $label5 = __( 'Is visible', 'invoicing' ); |
|
999 | + public function edit_address_template($field) { |
|
1000 | + $restrict = $this->get_restrict_markup($field, 'address'); |
|
1001 | + $label = __('Field Label', 'invoicing'); |
|
1002 | + $label2 = __('Placeholder', 'invoicing'); |
|
1003 | + $label3 = __('Description', 'invoicing'); |
|
1004 | + $label4 = __('Is required', 'invoicing'); |
|
1005 | + $label5 = __('Is visible', 'invoicing'); |
|
1006 | 1006 | $id = $field . '.id + "_edit_label"'; |
1007 | 1007 | $id2 = $field . '.id + "_edit_placeholder"'; |
1008 | 1008 | $id3 = $field . '.id + "_edit_description"'; |
@@ -1070,8 +1070,8 @@ discard block |
||
1070 | 1070 | /** |
1071 | 1071 | * Renders the email element template. |
1072 | 1072 | */ |
1073 | - public function render_email_template( $field ) { |
|
1074 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
1073 | + public function render_email_template($field) { |
|
1074 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
1075 | 1075 | $label = "$field.label"; |
1076 | 1076 | echo " |
1077 | 1077 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1086,8 +1086,8 @@ discard block |
||
1086 | 1086 | /** |
1087 | 1087 | * Renders the billing_email element template. |
1088 | 1088 | */ |
1089 | - public function render_billing_email_template( $field ) { |
|
1090 | - $restrict = $this->get_restrict_markup( $field, 'billing_email' ); |
|
1089 | + public function render_billing_email_template($field) { |
|
1090 | + $restrict = $this->get_restrict_markup($field, 'billing_email'); |
|
1091 | 1091 | $label = "$field.label"; |
1092 | 1092 | echo " |
1093 | 1093 | <div $restrict> |
@@ -1101,24 +1101,24 @@ discard block |
||
1101 | 1101 | /** |
1102 | 1102 | * Renders the email element on the frontend. |
1103 | 1103 | */ |
1104 | - public function frontend_render_email_template( $field ) { |
|
1104 | + public function frontend_render_email_template($field) { |
|
1105 | 1105 | |
1106 | 1106 | echo "<div class='form-group'>"; |
1107 | 1107 | |
1108 | 1108 | echo aui()->input( |
1109 | 1109 | array( |
1110 | - 'name' => esc_attr( $field['id'] ), |
|
1111 | - 'id' => esc_attr( $field['id'] ), |
|
1110 | + 'name' => esc_attr($field['id']), |
|
1111 | + 'id' => esc_attr($field['id']), |
|
1112 | 1112 | 'required' => (bool) $field['required'], |
1113 | - 'label' => wp_kses_post( $field['label'] ), |
|
1113 | + 'label' => wp_kses_post($field['label']), |
|
1114 | 1114 | 'no_wrap' => true, |
1115 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1115 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1116 | 1116 | 'type' => 'email', |
1117 | 1117 | ) |
1118 | 1118 | ); |
1119 | 1119 | |
1120 | - if ( ! empty( $field['description'] ) ) { |
|
1121 | - $description = wp_kses_post( $field['description'] ); |
|
1120 | + if (!empty($field['description'])) { |
|
1121 | + $description = wp_kses_post($field['description']); |
|
1122 | 1122 | echo "<small class='form-text text-muted'>$description</small>"; |
1123 | 1123 | } |
1124 | 1124 | |
@@ -1129,30 +1129,30 @@ discard block |
||
1129 | 1129 | /** |
1130 | 1130 | * Renders the billing email element on the frontend. |
1131 | 1131 | */ |
1132 | - public function frontend_render_billing_email_template( $field ) { |
|
1132 | + public function frontend_render_billing_email_template($field) { |
|
1133 | 1133 | |
1134 | 1134 | echo "<div class='form-group'>"; |
1135 | 1135 | $value = ''; |
1136 | 1136 | |
1137 | - if ( is_user_logged_in() ) { |
|
1137 | + if (is_user_logged_in()) { |
|
1138 | 1138 | $user = wp_get_current_user(); |
1139 | - $value = sanitize_email( $user->user_email ); |
|
1139 | + $value = sanitize_email($user->user_email); |
|
1140 | 1140 | } |
1141 | 1141 | echo aui()->input( |
1142 | 1142 | array( |
1143 | 1143 | 'name' => 'billing_email', |
1144 | 1144 | 'value' => $value, |
1145 | - 'id' => esc_attr( $field['id'] ), |
|
1145 | + 'id' => esc_attr($field['id']), |
|
1146 | 1146 | 'required' => true, |
1147 | - 'label' => wp_kses_post( $field['label'] ), |
|
1147 | + 'label' => wp_kses_post($field['label']), |
|
1148 | 1148 | 'no_wrap' => true, |
1149 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1149 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1150 | 1150 | 'type' => 'email', |
1151 | 1151 | ) |
1152 | 1152 | ); |
1153 | 1153 | |
1154 | - if ( ! empty( $field['description'] ) ) { |
|
1155 | - $description = wp_kses_post( $field['description'] ); |
|
1154 | + if (!empty($field['description'])) { |
|
1155 | + $description = wp_kses_post($field['description']); |
|
1156 | 1156 | echo "<small class='form-text text-muted'>$description</small>"; |
1157 | 1157 | } |
1158 | 1158 | |
@@ -1163,16 +1163,16 @@ discard block |
||
1163 | 1163 | /** |
1164 | 1164 | * Renders the edit email element template. |
1165 | 1165 | */ |
1166 | - public function edit_email_template( $field ) { |
|
1167 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
1168 | - $label = __( 'Field Label', 'invoicing' ); |
|
1166 | + public function edit_email_template($field) { |
|
1167 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
1168 | + $label = __('Field Label', 'invoicing'); |
|
1169 | 1169 | $id = $field . '.id + "_edit"'; |
1170 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1170 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1171 | 1171 | $id2 = $field . '.id + "_edit2"'; |
1172 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1173 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1172 | + $label3 = __('Help text', 'invoicing'); |
|
1173 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1174 | 1174 | $id3 = $field . '.id + "_edit3"'; |
1175 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1175 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1176 | 1176 | $id4 = $field . '.id + "_edit4"'; |
1177 | 1177 | echo " |
1178 | 1178 | <div $restrict> |
@@ -1200,16 +1200,16 @@ discard block |
||
1200 | 1200 | /** |
1201 | 1201 | * Renders the edit billing_email element template. |
1202 | 1202 | */ |
1203 | - public function edit_billing_email_template( $field ) { |
|
1204 | - $restrict = $this->get_restrict_markup( $field, 'billing_email' ); |
|
1205 | - $label = __( 'Field Label', 'invoicing' ); |
|
1203 | + public function edit_billing_email_template($field) { |
|
1204 | + $restrict = $this->get_restrict_markup($field, 'billing_email'); |
|
1205 | + $label = __('Field Label', 'invoicing'); |
|
1206 | 1206 | $id = $field . '.id + "_edit"'; |
1207 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1207 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1208 | 1208 | $id2 = $field . '.id + "_edit2"'; |
1209 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1210 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1209 | + $label3 = __('Help text', 'invoicing'); |
|
1210 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1211 | 1211 | $id3 = $field . '.id + "_edit3"'; |
1212 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1212 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1213 | 1213 | $id4 = $field . '.id + "_edit4"'; |
1214 | 1214 | echo " |
1215 | 1215 | <div $restrict> |
@@ -1233,8 +1233,8 @@ discard block |
||
1233 | 1233 | /** |
1234 | 1234 | * Renders the website element template. |
1235 | 1235 | */ |
1236 | - public function render_website_template( $field ) { |
|
1237 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
1236 | + public function render_website_template($field) { |
|
1237 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
1238 | 1238 | $label = "$field.label"; |
1239 | 1239 | echo " |
1240 | 1240 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1249,24 +1249,24 @@ discard block |
||
1249 | 1249 | /** |
1250 | 1250 | * Renders the website element on the frontend. |
1251 | 1251 | */ |
1252 | - public function frontend_render_website_template( $field ) { |
|
1252 | + public function frontend_render_website_template($field) { |
|
1253 | 1253 | |
1254 | 1254 | echo "<div class='form-group'>"; |
1255 | 1255 | |
1256 | 1256 | echo aui()->input( |
1257 | 1257 | array( |
1258 | - 'name' => esc_attr( $field['id'] ), |
|
1259 | - 'id' => esc_attr( $field['id'] ), |
|
1258 | + 'name' => esc_attr($field['id']), |
|
1259 | + 'id' => esc_attr($field['id']), |
|
1260 | 1260 | 'required' => (bool) $field['required'], |
1261 | - 'label' => wp_kses_post( $field['label'] ), |
|
1261 | + 'label' => wp_kses_post($field['label']), |
|
1262 | 1262 | 'no_wrap' => true, |
1263 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1263 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1264 | 1264 | 'type' => 'url', |
1265 | 1265 | ) |
1266 | 1266 | ); |
1267 | 1267 | |
1268 | - if ( ! empty( $field['description'] ) ) { |
|
1269 | - $description = wp_kses_post( $field['description'] ); |
|
1268 | + if (!empty($field['description'])) { |
|
1269 | + $description = wp_kses_post($field['description']); |
|
1270 | 1270 | echo "<small class='form-text text-muted'>$description</small>"; |
1271 | 1271 | } |
1272 | 1272 | |
@@ -1277,16 +1277,16 @@ discard block |
||
1277 | 1277 | /** |
1278 | 1278 | * Renders the edit website element template. |
1279 | 1279 | */ |
1280 | - public function edit_website_template( $field ) { |
|
1281 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
1282 | - $label = __( 'Field Label', 'invoicing' ); |
|
1280 | + public function edit_website_template($field) { |
|
1281 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
1282 | + $label = __('Field Label', 'invoicing'); |
|
1283 | 1283 | $id = $field . '.id + "_edit"'; |
1284 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1284 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1285 | 1285 | $id2 = $field . '.id + "_edit2"'; |
1286 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1287 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1286 | + $label3 = __('Help text', 'invoicing'); |
|
1287 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1288 | 1288 | $id3 = $field . '.id + "_edit3"'; |
1289 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1289 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1290 | 1290 | $id4 = $field . '.id + "_edit4"'; |
1291 | 1291 | echo " |
1292 | 1292 | <div $restrict> |
@@ -1314,8 +1314,8 @@ discard block |
||
1314 | 1314 | /** |
1315 | 1315 | * Renders the date element template. |
1316 | 1316 | */ |
1317 | - public function render_date_template( $field ) { |
|
1318 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
1317 | + public function render_date_template($field) { |
|
1318 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
1319 | 1319 | $label = "$field.label"; |
1320 | 1320 | echo " |
1321 | 1321 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1330,24 +1330,24 @@ discard block |
||
1330 | 1330 | /** |
1331 | 1331 | * Renders the date element on the frontend. |
1332 | 1332 | */ |
1333 | - public function frontend_render_date_template( $field ) { |
|
1333 | + public function frontend_render_date_template($field) { |
|
1334 | 1334 | |
1335 | 1335 | echo "<div class='form-group'>"; |
1336 | 1336 | |
1337 | 1337 | echo aui()->input( |
1338 | 1338 | array( |
1339 | - 'name' => esc_attr( $field['id'] ), |
|
1340 | - 'id' => esc_attr( $field['id'] ), |
|
1339 | + 'name' => esc_attr($field['id']), |
|
1340 | + 'id' => esc_attr($field['id']), |
|
1341 | 1341 | 'required' => (bool) $field['required'], |
1342 | - 'label' => wp_kses_post( $field['label'] ), |
|
1343 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1342 | + 'label' => wp_kses_post($field['label']), |
|
1343 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1344 | 1344 | 'no_wrap' => true, |
1345 | 1345 | 'type' => 'date', |
1346 | 1346 | ) |
1347 | 1347 | ); |
1348 | 1348 | |
1349 | - if ( ! empty( $field['description'] ) ) { |
|
1350 | - $description = wp_kses_post( $field['description'] ); |
|
1349 | + if (!empty($field['description'])) { |
|
1350 | + $description = wp_kses_post($field['description']); |
|
1351 | 1351 | echo "<small class='form-text text-muted'>$description</small>"; |
1352 | 1352 | } |
1353 | 1353 | |
@@ -1358,16 +1358,16 @@ discard block |
||
1358 | 1358 | /** |
1359 | 1359 | * Renders the edit date element template. |
1360 | 1360 | */ |
1361 | - public function edit_date_template( $field ) { |
|
1362 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
1363 | - $label = __( 'Field Label', 'invoicing' ); |
|
1361 | + public function edit_date_template($field) { |
|
1362 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
1363 | + $label = __('Field Label', 'invoicing'); |
|
1364 | 1364 | $id = $field . '.id + "_edit"'; |
1365 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1365 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1366 | 1366 | $id2 = $field . '.id + "_edit2"'; |
1367 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1368 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1367 | + $label3 = __('Help text', 'invoicing'); |
|
1368 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1369 | 1369 | $id3 = $field . '.id + "_edit3"'; |
1370 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1370 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1371 | 1371 | $id4 = $field . '.id + "_edit4"'; |
1372 | 1372 | echo " |
1373 | 1373 | <div $restrict> |
@@ -1395,8 +1395,8 @@ discard block |
||
1395 | 1395 | /** |
1396 | 1396 | * Renders the time element template. |
1397 | 1397 | */ |
1398 | - public function render_time_template( $field ) { |
|
1399 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
1398 | + public function render_time_template($field) { |
|
1399 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
1400 | 1400 | $label = "$field.label"; |
1401 | 1401 | echo " |
1402 | 1402 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1411,24 +1411,24 @@ discard block |
||
1411 | 1411 | /** |
1412 | 1412 | * Renders the time element on the frontend. |
1413 | 1413 | */ |
1414 | - public function frontend_render_time_template( $field ) { |
|
1414 | + public function frontend_render_time_template($field) { |
|
1415 | 1415 | |
1416 | 1416 | echo "<div class='form-group'>"; |
1417 | 1417 | |
1418 | 1418 | echo aui()->input( |
1419 | 1419 | array( |
1420 | - 'name' => esc_attr( $field['id'] ), |
|
1421 | - 'id' => esc_attr( $field['id'] ), |
|
1420 | + 'name' => esc_attr($field['id']), |
|
1421 | + 'id' => esc_attr($field['id']), |
|
1422 | 1422 | 'required' => (bool) $field['required'], |
1423 | - 'label' => wp_kses_post( $field['label'] ), |
|
1423 | + 'label' => wp_kses_post($field['label']), |
|
1424 | 1424 | 'no_wrap' => true, |
1425 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1425 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1426 | 1426 | 'type' => 'time', |
1427 | 1427 | ) |
1428 | 1428 | ); |
1429 | 1429 | |
1430 | - if ( ! empty( $field['description'] ) ) { |
|
1431 | - $description = wp_kses_post( $field['description'] ); |
|
1430 | + if (!empty($field['description'])) { |
|
1431 | + $description = wp_kses_post($field['description']); |
|
1432 | 1432 | echo "<small class='form-text text-muted'>$description</small>"; |
1433 | 1433 | } |
1434 | 1434 | |
@@ -1439,16 +1439,16 @@ discard block |
||
1439 | 1439 | /** |
1440 | 1440 | * Renders the edit time element template. |
1441 | 1441 | */ |
1442 | - public function edit_time_template( $field ) { |
|
1443 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
1444 | - $label = __( 'Field Label', 'invoicing' ); |
|
1442 | + public function edit_time_template($field) { |
|
1443 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
1444 | + $label = __('Field Label', 'invoicing'); |
|
1445 | 1445 | $id = $field . '.id + "_edit"'; |
1446 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1446 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1447 | 1447 | $id2 = $field . '.id + "_edit2"'; |
1448 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1449 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1448 | + $label3 = __('Help text', 'invoicing'); |
|
1449 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1450 | 1450 | $id3 = $field . '.id + "_edit3"'; |
1451 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1451 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1452 | 1452 | $id4 = $field . '.id + "_edit4"'; |
1453 | 1453 | echo " |
1454 | 1454 | <div $restrict> |
@@ -1476,8 +1476,8 @@ discard block |
||
1476 | 1476 | /** |
1477 | 1477 | * Renders the number element template. |
1478 | 1478 | */ |
1479 | - public function render_number_template( $field ) { |
|
1480 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
1479 | + public function render_number_template($field) { |
|
1480 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
1481 | 1481 | $label = "$field.label"; |
1482 | 1482 | echo " |
1483 | 1483 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1492,24 +1492,24 @@ discard block |
||
1492 | 1492 | /** |
1493 | 1493 | * Renders the number element on the frontend. |
1494 | 1494 | */ |
1495 | - public function frontend_render_number_template( $field ) { |
|
1495 | + public function frontend_render_number_template($field) { |
|
1496 | 1496 | |
1497 | 1497 | echo "<div class='form-group'>"; |
1498 | 1498 | |
1499 | 1499 | echo aui()->input( |
1500 | 1500 | array( |
1501 | - 'name' => esc_attr( $field['id'] ), |
|
1502 | - 'id' => esc_attr( $field['id'] ), |
|
1501 | + 'name' => esc_attr($field['id']), |
|
1502 | + 'id' => esc_attr($field['id']), |
|
1503 | 1503 | 'required' => (bool) $field['required'], |
1504 | - 'label' => wp_kses_post( $field['label'] ), |
|
1505 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1504 | + 'label' => wp_kses_post($field['label']), |
|
1505 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1506 | 1506 | 'no_wrap' => true, |
1507 | 1507 | 'type' => 'number', |
1508 | 1508 | ) |
1509 | 1509 | ); |
1510 | 1510 | |
1511 | - if ( ! empty( $field['description'] ) ) { |
|
1512 | - $description = wp_kses_post( $field['description'] ); |
|
1511 | + if (!empty($field['description'])) { |
|
1512 | + $description = wp_kses_post($field['description']); |
|
1513 | 1513 | echo "<small class='form-text text-muted'>$description</small>"; |
1514 | 1514 | } |
1515 | 1515 | |
@@ -1520,16 +1520,16 @@ discard block |
||
1520 | 1520 | /** |
1521 | 1521 | * Renders the edit number element template. |
1522 | 1522 | */ |
1523 | - public function edit_number_template( $field ) { |
|
1524 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
1525 | - $label = __( 'Field Label', 'invoicing' ); |
|
1523 | + public function edit_number_template($field) { |
|
1524 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
1525 | + $label = __('Field Label', 'invoicing'); |
|
1526 | 1526 | $id = $field . '.id + "_edit"'; |
1527 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1527 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1528 | 1528 | $id2 = $field . '.id + "_edit2"'; |
1529 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1530 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1529 | + $label3 = __('Help text', 'invoicing'); |
|
1530 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1531 | 1531 | $id3 = $field . '.id + "_edit3"'; |
1532 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1532 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1533 | 1533 | $id4 = $field . '.id + "_edit4"'; |
1534 | 1534 | echo " |
1535 | 1535 | <div $restrict> |
@@ -1557,23 +1557,23 @@ discard block |
||
1557 | 1557 | /** |
1558 | 1558 | * Renders the separator element template. |
1559 | 1559 | */ |
1560 | - public function render_separator_template( $field ) { |
|
1561 | - $restrict = $this->get_restrict_markup( $field, 'separator' ); |
|
1560 | + public function render_separator_template($field) { |
|
1561 | + $restrict = $this->get_restrict_markup($field, 'separator'); |
|
1562 | 1562 | echo "<hr class='featurette-divider mt-0 mb-2' $restrict>"; |
1563 | 1563 | } |
1564 | 1564 | |
1565 | 1565 | /** |
1566 | 1566 | * Renders the separator element on the frontend. |
1567 | 1567 | */ |
1568 | - public function frontend_render_separator_template( $field ) { |
|
1568 | + public function frontend_render_separator_template($field) { |
|
1569 | 1569 | echo '<hr class="featurette-divider mt-0 mb-2" />'; |
1570 | 1570 | } |
1571 | 1571 | |
1572 | 1572 | /** |
1573 | 1573 | * Renders the pay button element template. |
1574 | 1574 | */ |
1575 | - public function render_pay_button_template( $field ) { |
|
1576 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
1575 | + public function render_pay_button_template($field) { |
|
1576 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
1577 | 1577 | $label = "$field.label"; |
1578 | 1578 | echo " |
1579 | 1579 | <div $restrict> |
@@ -1586,28 +1586,28 @@ discard block |
||
1586 | 1586 | /** |
1587 | 1587 | * Renders the pay_button element on the frontend. |
1588 | 1588 | */ |
1589 | - public function frontend_render_pay_button_template( $field ) { |
|
1589 | + public function frontend_render_pay_button_template($field) { |
|
1590 | 1590 | |
1591 | 1591 | echo "<div class='mt-4 mb-4'>"; |
1592 | - do_action( 'wpinv_payment_mode_select' ); |
|
1592 | + do_action('wpinv_payment_mode_select'); |
|
1593 | 1593 | echo "</div>"; |
1594 | 1594 | |
1595 | 1595 | echo "<div class='form-group'>"; |
1596 | 1596 | |
1597 | - $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class( $field['class'] ); |
|
1597 | + $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class($field['class']); |
|
1598 | 1598 | echo aui()->input( |
1599 | 1599 | array( |
1600 | - 'name' => esc_attr( $field['id'] ), |
|
1601 | - 'id' => esc_attr( $field['id'] ), |
|
1602 | - 'value' => esc_attr( $field['label'] ), |
|
1600 | + 'name' => esc_attr($field['id']), |
|
1601 | + 'id' => esc_attr($field['id']), |
|
1602 | + 'value' => esc_attr($field['label']), |
|
1603 | 1603 | 'no_wrap' => true, |
1604 | 1604 | 'type' => 'submit', |
1605 | 1605 | 'class' => $class, |
1606 | 1606 | ) |
1607 | 1607 | ); |
1608 | 1608 | |
1609 | - if ( ! empty( $field['description'] ) ) { |
|
1610 | - $description = wp_kses_post( $field['description'] ); |
|
1609 | + if (!empty($field['description'])) { |
|
1610 | + $description = wp_kses_post($field['description']); |
|
1611 | 1611 | echo "<small class='form-text text-muted'>$description</small>"; |
1612 | 1612 | } |
1613 | 1613 | |
@@ -1618,14 +1618,14 @@ discard block |
||
1618 | 1618 | /** |
1619 | 1619 | * Renders the pay button element template. |
1620 | 1620 | */ |
1621 | - public function edit_pay_button_template( $field ) { |
|
1622 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
1623 | - $label = __( 'Button Text', 'invoicing' ); |
|
1621 | + public function edit_pay_button_template($field) { |
|
1622 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
1623 | + $label = __('Button Text', 'invoicing'); |
|
1624 | 1624 | $id = $field . '.id + "_edit"'; |
1625 | - $label2 = __( 'Help text', 'invoicing' ); |
|
1626 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1625 | + $label2 = __('Help text', 'invoicing'); |
|
1626 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1627 | 1627 | $id2 = $field . '.id + "_edit2"'; |
1628 | - $label4 = esc_attr__( 'Button Type', 'invoicing' ); |
|
1628 | + $label4 = esc_attr__('Button Type', 'invoicing'); |
|
1629 | 1629 | $id3 = $field . '.id + "_edit3"'; |
1630 | 1630 | echo " |
1631 | 1631 | <div $restrict> |
@@ -1641,15 +1641,15 @@ discard block |
||
1641 | 1641 | <label :for='$id3'>$label4</label> |
1642 | 1642 | |
1643 | 1643 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
1644 | - <option value='btn-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
1645 | - <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
1646 | - <option value='btn-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
1647 | - <option value='btn-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
1648 | - <option value='btn-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
1649 | - <option value='btn-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
1650 | - <option value='btn-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
1651 | - <option value='btn-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
1652 | - <option value='btn-link'>" . __( 'Link', 'invoicing' ) ."</option> |
|
1644 | + <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option> |
|
1645 | + <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
1646 | + <option value='btn-success'>" . __('Success', 'invoicing') . "</option> |
|
1647 | + <option value='btn-danger'>" . __('Danger', 'invoicing') . "</option> |
|
1648 | + <option value='btn-warning'>" . __('Warning', 'invoicing') . "</option> |
|
1649 | + <option value='btn-info'>" . __('Info', 'invoicing') . "</option> |
|
1650 | + <option value='btn-light'>" . __('Light', 'invoicing') . "</option> |
|
1651 | + <option value='btn-dark'>" . __('Dark', 'invoicing') . "</option> |
|
1652 | + <option value='btn-link'>" . __('Link', 'invoicing') . "</option> |
|
1653 | 1653 | </select> |
1654 | 1654 | </div> |
1655 | 1655 | </div> |
@@ -1660,8 +1660,8 @@ discard block |
||
1660 | 1660 | /** |
1661 | 1661 | * Renders the alert element template. |
1662 | 1662 | */ |
1663 | - public function render_alert_template( $field ) { |
|
1664 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
1663 | + public function render_alert_template($field) { |
|
1664 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
1665 | 1665 | $text = "$field.text"; |
1666 | 1666 | echo " |
1667 | 1667 | <div $restrict class='alert' :class='$field.class' role='alert'> |
@@ -1676,15 +1676,15 @@ discard block |
||
1676 | 1676 | /** |
1677 | 1677 | * Renders the alert element on the frontend. |
1678 | 1678 | */ |
1679 | - public function frontend_render_alert_template( $field ) { |
|
1679 | + public function frontend_render_alert_template($field) { |
|
1680 | 1680 | |
1681 | 1681 | echo "<div class='form-group'>"; |
1682 | 1682 | |
1683 | 1683 | echo aui()->alert( |
1684 | 1684 | array( |
1685 | - 'content' => wp_kses_post( $field['text'] ), |
|
1685 | + 'content' => wp_kses_post($field['text']), |
|
1686 | 1686 | 'dismissible' => $field['dismissible'], |
1687 | - 'type' => str_replace( 'alert-', '', $field['class'] ), |
|
1687 | + 'type' => str_replace('alert-', '', $field['class']), |
|
1688 | 1688 | ) |
1689 | 1689 | ); |
1690 | 1690 | |
@@ -1695,14 +1695,14 @@ discard block |
||
1695 | 1695 | /** |
1696 | 1696 | * Renders the alert element template. |
1697 | 1697 | */ |
1698 | - public function edit_alert_template( $field ) { |
|
1699 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
1700 | - $label = __( 'Alert Text', 'invoicing' ); |
|
1701 | - $label2 = esc_attr__( 'Enter your alert text here', 'invoicing' ); |
|
1698 | + public function edit_alert_template($field) { |
|
1699 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
1700 | + $label = __('Alert Text', 'invoicing'); |
|
1701 | + $label2 = esc_attr__('Enter your alert text here', 'invoicing'); |
|
1702 | 1702 | $id = $field . '.id + "_edit"'; |
1703 | - $label3 = __( 'Is Dismissible?', 'invoicing' ); |
|
1703 | + $label3 = __('Is Dismissible?', 'invoicing'); |
|
1704 | 1704 | $id2 = $field . '.id + "_edit2"'; |
1705 | - $label4 = esc_attr__( 'Alert Type', 'invoicing' ); |
|
1705 | + $label4 = esc_attr__('Alert Type', 'invoicing'); |
|
1706 | 1706 | $id3 = $field . '.id + "_edit3"'; |
1707 | 1707 | echo " |
1708 | 1708 | <div $restrict> |
@@ -1718,14 +1718,14 @@ discard block |
||
1718 | 1718 | <label :for='$id3'>$label4</label> |
1719 | 1719 | |
1720 | 1720 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
1721 | - <option value='alert-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
1722 | - <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
1723 | - <option value='alert-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
1724 | - <option value='alert-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
1725 | - <option value='alert-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
1726 | - <option value='alert-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
1727 | - <option value='alert-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
1728 | - <option value='alert-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
1721 | + <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option> |
|
1722 | + <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
1723 | + <option value='alert-success'>" . __('Success', 'invoicing') . "</option> |
|
1724 | + <option value='alert-danger'>" . __('Danger', 'invoicing') . "</option> |
|
1725 | + <option value='alert-warning'>" . __('Warning', 'invoicing') . "</option> |
|
1726 | + <option value='alert-info'>" . __('Info', 'invoicing') . "</option> |
|
1727 | + <option value='alert-light'>" . __('Light', 'invoicing') . "</option> |
|
1728 | + <option value='alert-dark'>" . __('Dark', 'invoicing') . "</option> |
|
1729 | 1729 | </select> |
1730 | 1730 | </div> |
1731 | 1731 | </div> |
@@ -1736,8 +1736,8 @@ discard block |
||
1736 | 1736 | /** |
1737 | 1737 | * Renders the discount element template. |
1738 | 1738 | */ |
1739 | - public function render_discount_template( $field ) { |
|
1740 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
1739 | + public function render_discount_template($field) { |
|
1740 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
1741 | 1741 | ?> |
1742 | 1742 | |
1743 | 1743 | <div <?php echo $restrict; ?> class="discount_field border rounded p-3"> |
@@ -1754,13 +1754,13 @@ discard block |
||
1754 | 1754 | /** |
1755 | 1755 | * Renders the discount element on the frontend. |
1756 | 1756 | */ |
1757 | - public function frontend_render_discount_template( $field ) { |
|
1757 | + public function frontend_render_discount_template($field) { |
|
1758 | 1758 | |
1759 | - $placeholder = esc_attr( $field['input_label'] ); |
|
1760 | - $label = sanitize_text_field( $field['button_label'] ); |
|
1759 | + $placeholder = esc_attr($field['input_label']); |
|
1760 | + $label = sanitize_text_field($field['button_label']); |
|
1761 | 1761 | $description = ''; |
1762 | 1762 | |
1763 | - if ( ! empty( $field['description'] ) ) { |
|
1763 | + if (!empty($field['description'])) { |
|
1764 | 1764 | $description = "<small class='form-text text-muted'>{$field['description']}</small>"; |
1765 | 1765 | } |
1766 | 1766 | ?> |
@@ -1781,12 +1781,12 @@ discard block |
||
1781 | 1781 | /** |
1782 | 1782 | * Renders the discount element template. |
1783 | 1783 | */ |
1784 | - public function edit_discount_template( $field ) { |
|
1785 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
1786 | - $label = __( 'Discount Input Placeholder', 'invoicing' ); |
|
1787 | - $label2 = __( 'Help Text', 'invoicing' ); |
|
1788 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1789 | - $label4 = __( 'Button Text', 'invoicing' ); |
|
1784 | + public function edit_discount_template($field) { |
|
1785 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
1786 | + $label = __('Discount Input Placeholder', 'invoicing'); |
|
1787 | + $label2 = __('Help Text', 'invoicing'); |
|
1788 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1789 | + $label4 = __('Button Text', 'invoicing'); |
|
1790 | 1790 | $id = $field . '.id + "_edit"'; |
1791 | 1791 | $id2 = $field . '.id + "_edit2"'; |
1792 | 1792 | $id3 = $field . '.id + "_edit3"'; |
@@ -1815,11 +1815,11 @@ discard block |
||
1815 | 1815 | /** |
1816 | 1816 | * Renders the items element template. |
1817 | 1817 | */ |
1818 | - public function render_items_template( $field ) { |
|
1819 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
1820 | - $label = __( 'Item totals will appear here. Click to set items.', 'invoicing' ); |
|
1821 | - $label2 = __( 'Your form allows customers to buy several recurring items. This is not supported and will lead to unexpected behaviour.', 'invoicing' ); |
|
1822 | - $label2 .= ' ' . __( 'To prevent this, limit customers to selecting a single item.', 'invoicing' ); |
|
1818 | + public function render_items_template($field) { |
|
1819 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
1820 | + $label = __('Item totals will appear here. Click to set items.', 'invoicing'); |
|
1821 | + $label2 = __('Your form allows customers to buy several recurring items. This is not supported and will lead to unexpected behaviour.', 'invoicing'); |
|
1822 | + $label2 .= ' ' . __('To prevent this, limit customers to selecting a single item.', 'invoicing'); |
|
1823 | 1823 | echo " |
1824 | 1824 | <div $restrict class='item_totals text-center'> |
1825 | 1825 | <div v-if='canCheckoutSeveralSubscriptions($field)' class='p-4 bg-danger text-light'>$label2</div> |
@@ -1831,12 +1831,12 @@ discard block |
||
1831 | 1831 | /** |
1832 | 1832 | * Renders the items element on the frontend. |
1833 | 1833 | */ |
1834 | - public function frontend_render_items_template( $field, $items ) { |
|
1834 | + public function frontend_render_items_template($field, $items) { |
|
1835 | 1835 | |
1836 | 1836 | echo "<div class='form-group item_totals'>"; |
1837 | 1837 | |
1838 | - $id = esc_attr( $field['id'] ); |
|
1839 | - if ( 'total' == $field[ 'items_type' ] ) { |
|
1838 | + $id = esc_attr($field['id']); |
|
1839 | + if ('total' == $field['items_type']) { |
|
1840 | 1840 | $total = 0; |
1841 | 1841 | $tax = 0; |
1842 | 1842 | $sub_total = 0; |
@@ -1845,16 +1845,16 @@ discard block |
||
1845 | 1845 | <div class="border item_totals_type_total"> |
1846 | 1846 | |
1847 | 1847 | <?php |
1848 | - foreach( $items as $item ) { |
|
1848 | + foreach ($items as $item) { |
|
1849 | 1849 | |
1850 | - $amount = floatval( $item['price'] ); |
|
1850 | + $amount = floatval($item['price']); |
|
1851 | 1851 | |
1852 | - if ( wpinv_use_taxes() ) { |
|
1852 | + if (wpinv_use_taxes()) { |
|
1853 | 1853 | |
1854 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
1854 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
1855 | 1855 | |
1856 | - if ( wpinv_prices_include_tax() ) { |
|
1857 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
1856 | + if (wpinv_prices_include_tax()) { |
|
1857 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
1858 | 1858 | $item_tax = $amount - $pre_tax; |
1859 | 1859 | } else { |
1860 | 1860 | $pre_tax = $amount; |
@@ -1866,27 +1866,27 @@ discard block |
||
1866 | 1866 | $total = $sub_total + $tax; |
1867 | 1867 | |
1868 | 1868 | } else { |
1869 | - $total = $total + $amount; |
|
1869 | + $total = $total + $amount; |
|
1870 | 1870 | } |
1871 | 1871 | |
1872 | 1872 | $class = 'col-8'; |
1873 | 1873 | $class2 = ''; |
1874 | 1874 | |
1875 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
1875 | + if (!empty($item['allow_quantities'])) { |
|
1876 | 1876 | $class = 'col-6 pt-2'; |
1877 | 1877 | $class2 = 'pt-2'; |
1878 | 1878 | } |
1879 | 1879 | |
1880 | - if ( ! empty( $item['custom_price'] ) ) { |
|
1880 | + if (!empty($item['custom_price'])) { |
|
1881 | 1881 | $class .= ' pt-2'; |
1882 | 1882 | } |
1883 | 1883 | |
1884 | 1884 | ?> |
1885 | 1885 | <div class="item_totals_item"> |
1886 | 1886 | <div class='row pl-2 pr-2 pt-2'> |
1887 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
1887 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
1888 | 1888 | |
1889 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
1889 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
1890 | 1890 | |
1891 | 1891 | <div class='col-2'> |
1892 | 1892 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -1894,11 +1894,11 @@ discard block |
||
1894 | 1894 | |
1895 | 1895 | <?php } else { ?> |
1896 | 1896 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
1897 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
1897 | + <?php } if (empty($item['custom_price'])) { ?> |
|
1898 | 1898 | |
1899 | 1899 | <div class='col-4 <?php echo $class2; ?>'> |
1900 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
1901 | - <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
1900 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
1901 | + <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
1902 | 1902 | </div> |
1903 | 1903 | |
1904 | 1904 | <?php } else {?> |
@@ -1906,15 +1906,15 @@ discard block |
||
1906 | 1906 | <div class='col-4'> |
1907 | 1907 | <div class='input-group'> |
1908 | 1908 | |
1909 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
1909 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
1910 | 1910 | <div class='input-group-prepend'> |
1911 | 1911 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
1912 | 1912 | </div> |
1913 | 1913 | <?php } ?> |
1914 | 1914 | |
1915 | - <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
1915 | + <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
1916 | 1916 | |
1917 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
1917 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
1918 | 1918 | <div class='input-group-append'> |
1919 | 1919 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
1920 | 1920 | </div> |
@@ -1925,28 +1925,28 @@ discard block |
||
1925 | 1925 | <?php } ?> |
1926 | 1926 | |
1927 | 1927 | </div> |
1928 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1929 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1928 | + <?php if (!empty($item['description'])) { ?> |
|
1929 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1930 | 1930 | <?php } ?> |
1931 | 1931 | </div> |
1932 | 1932 | <?php } ?> |
1933 | 1933 | |
1934 | 1934 | <div class='mt-4 border-top item_totals_total p-2'> |
1935 | 1935 | |
1936 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
1936 | + <?php if (wpinv_use_taxes()) { ?> |
|
1937 | 1937 | <div class='row'> |
1938 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
1939 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
1938 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
1939 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
1940 | 1940 | </div> |
1941 | 1941 | <div class='row'> |
1942 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
1943 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
1942 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
1943 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
1944 | 1944 | </div> |
1945 | 1945 | <?php } ?> |
1946 | 1946 | |
1947 | 1947 | <div class='row'> |
1948 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
1949 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
1948 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
1949 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
1950 | 1950 | </div> |
1951 | 1951 | |
1952 | 1952 | </div> |
@@ -1954,22 +1954,22 @@ discard block |
||
1954 | 1954 | </div> |
1955 | 1955 | <?php } ?> |
1956 | 1956 | |
1957 | - <?php if ( 'radio' == $field[ 'items_type' ] ) { ?> |
|
1957 | + <?php if ('radio' == $field['items_type']) { ?> |
|
1958 | 1958 | <div class="item_totals_type_radio"> |
1959 | 1959 | |
1960 | 1960 | <?php |
1961 | - foreach( $items as $index => $item ) { |
|
1961 | + foreach ($items as $index => $item) { |
|
1962 | 1962 | |
1963 | - if ( ! empty( $item['required'] ) ) { |
|
1963 | + if (!empty($item['required'])) { |
|
1964 | 1964 | continue; |
1965 | 1965 | } |
1966 | 1966 | ?> |
1967 | 1967 | <div class="form-check"> |
1968 | - <input class='form-check-input wpinv-items-selector' <?php checked( ! isset( $selected_radio_item ) ); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'> |
|
1969 | - <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> |
|
1968 | + <input class='form-check-input wpinv-items-selector' <?php checked(!isset($selected_radio_item)); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'> |
|
1969 | + <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> |
|
1970 | 1970 | </div> |
1971 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1972 | - <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1971 | + <?php if (!empty($item['description'])) { ?> |
|
1972 | + <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1973 | 1973 | <?php } ?> |
1974 | 1974 | <?php } ?> |
1975 | 1975 | |
@@ -1981,32 +1981,32 @@ discard block |
||
1981 | 1981 | $tax = 0; |
1982 | 1982 | $sub_total = 0; |
1983 | 1983 | |
1984 | - foreach ( $items as $item ) { |
|
1984 | + foreach ($items as $item) { |
|
1985 | 1985 | |
1986 | 1986 | $class = 'col-8'; |
1987 | 1987 | $class2 = ''; |
1988 | 1988 | |
1989 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
1989 | + if (!empty($item['allow_quantities'])) { |
|
1990 | 1990 | $class = 'col-6 pt-2'; |
1991 | 1991 | $class2 = 'pt-2'; |
1992 | 1992 | } |
1993 | 1993 | |
1994 | - if ( ! empty( $item['custom_price'] ) ) { |
|
1994 | + if (!empty($item['custom_price'])) { |
|
1995 | 1995 | $class .= ' pt-2'; |
1996 | 1996 | } |
1997 | 1997 | |
1998 | 1998 | $class3 = 'd-none'; |
1999 | 1999 | $name = ''; |
2000 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_radio_item ) ) { |
|
2000 | + if (!empty($item['required']) || !isset($totals_selected_radio_item)) { |
|
2001 | 2001 | |
2002 | - $amount = floatval( $item['price'] ); |
|
2002 | + $amount = floatval($item['price']); |
|
2003 | 2003 | |
2004 | - if ( wpinv_use_taxes() ) { |
|
2004 | + if (wpinv_use_taxes()) { |
|
2005 | 2005 | |
2006 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
2006 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
2007 | 2007 | |
2008 | - if ( wpinv_prices_include_tax() ) { |
|
2009 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
2008 | + if (wpinv_prices_include_tax()) { |
|
2009 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
2010 | 2010 | $item_tax = $amount - $pre_tax; |
2011 | 2011 | } else { |
2012 | 2012 | $pre_tax = $amount; |
@@ -2018,13 +2018,13 @@ discard block |
||
2018 | 2018 | $total = $sub_total + $tax; |
2019 | 2019 | |
2020 | 2020 | } else { |
2021 | - $total = $total + $amount; |
|
2021 | + $total = $total + $amount; |
|
2022 | 2022 | } |
2023 | 2023 | |
2024 | 2024 | $class3 = ''; |
2025 | 2025 | $name = "wpinv-items[{$item['id']}]"; |
2026 | 2026 | |
2027 | - if ( empty( $item['required'] ) ) { |
|
2027 | + if (empty($item['required'])) { |
|
2028 | 2028 | $totals_selected_radio_item = 1; |
2029 | 2029 | } |
2030 | 2030 | |
@@ -2036,9 +2036,9 @@ discard block |
||
2036 | 2036 | |
2037 | 2037 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2038 | 2038 | <div class='row pl-2 pr-2 pt-2'> |
2039 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2039 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2040 | 2040 | |
2041 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2041 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2042 | 2042 | |
2043 | 2043 | <div class='col-2'> |
2044 | 2044 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2046,11 +2046,11 @@ discard block |
||
2046 | 2046 | |
2047 | 2047 | <?php } else { ?> |
2048 | 2048 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2049 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2049 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2050 | 2050 | |
2051 | 2051 | <div class='col-4 <?php echo $class2; ?>'> |
2052 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2053 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2052 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2053 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2054 | 2054 | </div> |
2055 | 2055 | |
2056 | 2056 | <?php } else {?> |
@@ -2058,15 +2058,15 @@ discard block |
||
2058 | 2058 | <div class='col-4'> |
2059 | 2059 | <div class='input-group'> |
2060 | 2060 | |
2061 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2061 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2062 | 2062 | <div class='input-group-prepend'> |
2063 | 2063 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2064 | 2064 | </div> |
2065 | 2065 | <?php } ?> |
2066 | 2066 | |
2067 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
2067 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
2068 | 2068 | |
2069 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2069 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2070 | 2070 | <div class='input-group-append'> |
2071 | 2071 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2072 | 2072 | </div> |
@@ -2077,27 +2077,27 @@ discard block |
||
2077 | 2077 | <?php } ?> |
2078 | 2078 | |
2079 | 2079 | </div> |
2080 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2081 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2080 | + <?php if (!empty($item['description'])) { ?> |
|
2081 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2082 | 2082 | <?php } ?> |
2083 | 2083 | </div> |
2084 | 2084 | <?php } ?> |
2085 | 2085 | |
2086 | 2086 | <div class='mt-4 border-top item_totals_total p-2'> |
2087 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
2087 | + <?php if (wpinv_use_taxes()) { ?> |
|
2088 | 2088 | <div class='row'> |
2089 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
2090 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
2089 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
2090 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
2091 | 2091 | </div> |
2092 | 2092 | <div class='row'> |
2093 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
2094 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
2093 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
2094 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
2095 | 2095 | </div> |
2096 | 2096 | <?php } ?> |
2097 | 2097 | |
2098 | 2098 | <div class='row'> |
2099 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2100 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
2099 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2100 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
2101 | 2101 | </div> |
2102 | 2102 | </div> |
2103 | 2103 | |
@@ -2105,22 +2105,22 @@ discard block |
||
2105 | 2105 | </div> |
2106 | 2106 | <?php } ?> |
2107 | 2107 | |
2108 | - <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?> |
|
2108 | + <?php if ('checkbox' == $field['items_type']) { ?> |
|
2109 | 2109 | |
2110 | 2110 | <div class="item_totals_type_checkbox"> |
2111 | 2111 | |
2112 | 2112 | <?php |
2113 | - foreach ( $items as $index => $item ) { |
|
2113 | + foreach ($items as $index => $item) { |
|
2114 | 2114 | |
2115 | - if ( ! empty( $item['required'] ) ) { |
|
2115 | + if (!empty($item['required'])) { |
|
2116 | 2116 | continue; |
2117 | 2117 | } |
2118 | 2118 | |
2119 | - $title = sanitize_text_field( $item['title'] ); |
|
2120 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
2121 | - $item_id = esc_attr( $id . "_$index" ); |
|
2122 | - $value = esc_attr( $item['id'] ); |
|
2123 | - $checked = checked( ! isset( $selected_checkbox_item ), true, false ); |
|
2119 | + $title = sanitize_text_field($item['title']); |
|
2120 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
2121 | + $item_id = esc_attr($id . "_$index"); |
|
2122 | + $value = esc_attr($item['id']); |
|
2123 | + $checked = checked(!isset($selected_checkbox_item), true, false); |
|
2124 | 2124 | $selected_checkbox_item = 1; |
2125 | 2125 | |
2126 | 2126 | echo " |
@@ -2129,7 +2129,7 @@ discard block |
||
2129 | 2129 | <label for='$item_id' class='custom-control-label'>$title ($price)</label> |
2130 | 2130 | </div>"; |
2131 | 2131 | |
2132 | - if ( ! empty( $item['description'] ) ) { |
|
2132 | + if (!empty($item['description'])) { |
|
2133 | 2133 | echo "<small class='form-text text-muted'>{$item['description']}</small>"; |
2134 | 2134 | } |
2135 | 2135 | } |
@@ -2143,31 +2143,31 @@ discard block |
||
2143 | 2143 | $tax = 0; |
2144 | 2144 | $sub_total = 0; |
2145 | 2145 | |
2146 | - foreach ( $items as $item ) { |
|
2146 | + foreach ($items as $item) { |
|
2147 | 2147 | |
2148 | 2148 | $class = 'col-8'; |
2149 | 2149 | $class2 = ''; |
2150 | 2150 | |
2151 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
2151 | + if (!empty($item['allow_quantities'])) { |
|
2152 | 2152 | $class = 'col-6 pt-2'; |
2153 | 2153 | $class2 = 'pt-2'; |
2154 | 2154 | } |
2155 | 2155 | |
2156 | - if ( ! empty( $item['custom_price'] ) ) { |
|
2156 | + if (!empty($item['custom_price'])) { |
|
2157 | 2157 | $class .= ' pt-2'; |
2158 | 2158 | } |
2159 | 2159 | |
2160 | 2160 | $class3 = 'd-none'; |
2161 | - $name = ''; |
|
2162 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_checkbox_item ) ) { |
|
2161 | + $name = ''; |
|
2162 | + if (!empty($item['required']) || !isset($totals_selected_checkbox_item)) { |
|
2163 | 2163 | |
2164 | - $amount = floatval( $item['price'] ); |
|
2165 | - if ( wpinv_use_taxes() ) { |
|
2164 | + $amount = floatval($item['price']); |
|
2165 | + if (wpinv_use_taxes()) { |
|
2166 | 2166 | |
2167 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
2167 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
2168 | 2168 | |
2169 | - if ( wpinv_prices_include_tax() ) { |
|
2170 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
2169 | + if (wpinv_prices_include_tax()) { |
|
2170 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
2171 | 2171 | $item_tax = $amount - $pre_tax; |
2172 | 2172 | } else { |
2173 | 2173 | $pre_tax = $amount; |
@@ -2179,13 +2179,13 @@ discard block |
||
2179 | 2179 | $total = $sub_total + $tax; |
2180 | 2180 | |
2181 | 2181 | } else { |
2182 | - $total = $total + $amount; |
|
2182 | + $total = $total + $amount; |
|
2183 | 2183 | } |
2184 | 2184 | |
2185 | 2185 | $class3 = ''; |
2186 | - $name = "wpinv-items[{$item['id']}]"; |
|
2186 | + $name = "wpinv-items[{$item['id']}]"; |
|
2187 | 2187 | |
2188 | - if ( empty( $item['required'] ) ) { |
|
2188 | + if (empty($item['required'])) { |
|
2189 | 2189 | $totals_selected_checkbox_item = 1; |
2190 | 2190 | } |
2191 | 2191 | |
@@ -2197,9 +2197,9 @@ discard block |
||
2197 | 2197 | |
2198 | 2198 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2199 | 2199 | <div class='row pl-2 pr-2 pt-2'> |
2200 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2200 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2201 | 2201 | |
2202 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2202 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2203 | 2203 | |
2204 | 2204 | <div class='col-2'> |
2205 | 2205 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2207,11 +2207,11 @@ discard block |
||
2207 | 2207 | |
2208 | 2208 | <?php } else { ?> |
2209 | 2209 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2210 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2210 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2211 | 2211 | |
2212 | 2212 | <div class='col-4 <?php echo $class2; ?>'> |
2213 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2214 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2213 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2214 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2215 | 2215 | </div> |
2216 | 2216 | |
2217 | 2217 | <?php } else {?> |
@@ -2219,15 +2219,15 @@ discard block |
||
2219 | 2219 | <div class='col-4'> |
2220 | 2220 | <div class='input-group'> |
2221 | 2221 | |
2222 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2222 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2223 | 2223 | <div class='input-group-prepend'> |
2224 | 2224 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2225 | 2225 | </div> |
2226 | 2226 | <?php } ?> |
2227 | 2227 | |
2228 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
2228 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
2229 | 2229 | |
2230 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2230 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2231 | 2231 | <div class='input-group-append'> |
2232 | 2232 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2233 | 2233 | </div> |
@@ -2238,35 +2238,35 @@ discard block |
||
2238 | 2238 | <?php } ?> |
2239 | 2239 | |
2240 | 2240 | </div> |
2241 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2242 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2241 | + <?php if (!empty($item['description'])) { ?> |
|
2242 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2243 | 2243 | <?php } ?> |
2244 | 2244 | </div> |
2245 | 2245 | <?php } ?> |
2246 | 2246 | |
2247 | 2247 | <div class='mt-4 border-top item_totals_total p-2'> |
2248 | 2248 | |
2249 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
2249 | + <?php if (wpinv_use_taxes()) { ?> |
|
2250 | 2250 | <div class='row'> |
2251 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
2252 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
2251 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
2252 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
2253 | 2253 | </div> |
2254 | 2254 | <div class='row'> |
2255 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
2256 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
2255 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
2256 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
2257 | 2257 | </div> |
2258 | 2258 | <?php } ?> |
2259 | 2259 | |
2260 | 2260 | <div class='row'> |
2261 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2262 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
2261 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2262 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
2263 | 2263 | </div> |
2264 | 2264 | </div> |
2265 | 2265 | </div> |
2266 | 2266 | </div> |
2267 | 2267 | <?php } ?> |
2268 | 2268 | |
2269 | - <?php if ( 'select' == $field[ 'items_type' ] ) { ?> |
|
2269 | + <?php if ('select' == $field['items_type']) { ?> |
|
2270 | 2270 | |
2271 | 2271 | <div class="item_totals_type_select"> |
2272 | 2272 | |
@@ -2274,17 +2274,17 @@ discard block |
||
2274 | 2274 | |
2275 | 2275 | $options = array(); |
2276 | 2276 | $selected = ''; |
2277 | - foreach ( $items as $index => $item ) { |
|
2277 | + foreach ($items as $index => $item) { |
|
2278 | 2278 | |
2279 | - if ( ! empty( $item['required'] ) ) { |
|
2279 | + if (!empty($item['required'])) { |
|
2280 | 2280 | continue; |
2281 | 2281 | } |
2282 | 2282 | |
2283 | - $title = sanitize_text_field( $item['title'] ); |
|
2284 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
2285 | - $options[ $item['id'] ] = "$title ($price)"; |
|
2283 | + $title = sanitize_text_field($item['title']); |
|
2284 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
2285 | + $options[$item['id']] = "$title ($price)"; |
|
2286 | 2286 | |
2287 | - if ( ! isset( $selected_item ) ) { |
|
2287 | + if (!isset($selected_item)) { |
|
2288 | 2288 | $selected = $item['id']; |
2289 | 2289 | $selected_item = 1; |
2290 | 2290 | } |
@@ -2295,7 +2295,7 @@ discard block |
||
2295 | 2295 | array( |
2296 | 2296 | 'name' => 'payment-form-items', |
2297 | 2297 | 'id' => $id, |
2298 | - 'placeholder' => __( 'Select an item', 'invoicing' ), |
|
2298 | + 'placeholder' => __('Select an item', 'invoicing'), |
|
2299 | 2299 | 'no_wrap' => true, |
2300 | 2300 | 'options' => $options, |
2301 | 2301 | 'class' => 'wpi_select2 wpinv-items-select-selector', |
@@ -2312,31 +2312,31 @@ discard block |
||
2312 | 2312 | $tax = 0; |
2313 | 2313 | $sub_total = 0; |
2314 | 2314 | |
2315 | - foreach ( $items as $item ) { |
|
2315 | + foreach ($items as $item) { |
|
2316 | 2316 | |
2317 | 2317 | $class = 'col-8'; |
2318 | 2318 | $class2 = ''; |
2319 | 2319 | |
2320 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
2320 | + if (!empty($item['allow_quantities'])) { |
|
2321 | 2321 | $class = 'col-6 pt-2'; |
2322 | 2322 | $class2 = 'pt-2'; |
2323 | 2323 | } |
2324 | 2324 | |
2325 | - if ( ! empty( $item['custom_price'] ) ) { |
|
2325 | + if (!empty($item['custom_price'])) { |
|
2326 | 2326 | $class .= ' pt-2'; |
2327 | 2327 | } |
2328 | 2328 | |
2329 | 2329 | $class3 = 'd-none'; |
2330 | - $name = ''; |
|
2331 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) { |
|
2330 | + $name = ''; |
|
2331 | + if (!empty($item['required']) || !isset($totals_selected_select_item)) { |
|
2332 | 2332 | |
2333 | - $amount = floatval( $item['price'] ); |
|
2334 | - if ( wpinv_use_taxes() ) { |
|
2333 | + $amount = floatval($item['price']); |
|
2334 | + if (wpinv_use_taxes()) { |
|
2335 | 2335 | |
2336 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
2336 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
2337 | 2337 | |
2338 | - if ( wpinv_prices_include_tax() ) { |
|
2339 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
2338 | + if (wpinv_prices_include_tax()) { |
|
2339 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
2340 | 2340 | $item_tax = $amount - $pre_tax; |
2341 | 2341 | } else { |
2342 | 2342 | $pre_tax = $amount; |
@@ -2348,13 +2348,13 @@ discard block |
||
2348 | 2348 | $total = $sub_total + $tax; |
2349 | 2349 | |
2350 | 2350 | } else { |
2351 | - $total = $total + $amount; |
|
2351 | + $total = $total + $amount; |
|
2352 | 2352 | } |
2353 | 2353 | |
2354 | 2354 | $class3 = ''; |
2355 | - $name = "wpinv-items[{$item['id']}]"; |
|
2355 | + $name = "wpinv-items[{$item['id']}]"; |
|
2356 | 2356 | |
2357 | - if ( empty( $item['required'] ) ) { |
|
2357 | + if (empty($item['required'])) { |
|
2358 | 2358 | $totals_selected_select_item = 1; |
2359 | 2359 | } |
2360 | 2360 | |
@@ -2366,9 +2366,9 @@ discard block |
||
2366 | 2366 | |
2367 | 2367 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2368 | 2368 | <div class='row pl-2 pr-2 pt-2'> |
2369 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2369 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2370 | 2370 | |
2371 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2371 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2372 | 2372 | |
2373 | 2373 | <div class='col-2'> |
2374 | 2374 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2376,11 +2376,11 @@ discard block |
||
2376 | 2376 | |
2377 | 2377 | <?php } else { ?> |
2378 | 2378 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2379 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2379 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2380 | 2380 | |
2381 | 2381 | <div class='col-4 <?php echo $class2; ?>'> |
2382 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2383 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2382 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2383 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2384 | 2384 | </div> |
2385 | 2385 | |
2386 | 2386 | <?php } else {?> |
@@ -2388,15 +2388,15 @@ discard block |
||
2388 | 2388 | <div class='col-4'> |
2389 | 2389 | <div class='input-group'> |
2390 | 2390 | |
2391 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2391 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2392 | 2392 | <div class='input-group-prepend'> |
2393 | 2393 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2394 | 2394 | </div> |
2395 | 2395 | <?php } ?> |
2396 | 2396 | |
2397 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
2397 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
2398 | 2398 | |
2399 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2399 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2400 | 2400 | <div class='input-group-append'> |
2401 | 2401 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2402 | 2402 | </div> |
@@ -2407,34 +2407,34 @@ discard block |
||
2407 | 2407 | <?php } ?> |
2408 | 2408 | |
2409 | 2409 | </div> |
2410 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2411 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2410 | + <?php if (!empty($item['description'])) { ?> |
|
2411 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2412 | 2412 | <?php } ?> |
2413 | 2413 | </div> |
2414 | 2414 | <?php } ?> |
2415 | 2415 | |
2416 | 2416 | <div class='mt-4 border-top item_totals_total p-2'> |
2417 | 2417 | |
2418 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
2418 | + <?php if (wpinv_use_taxes()) { ?> |
|
2419 | 2419 | <div class='row'> |
2420 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
2421 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
2420 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
2421 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
2422 | 2422 | </div> |
2423 | 2423 | <div class='row'> |
2424 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
2425 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
2424 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
2425 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
2426 | 2426 | </div> |
2427 | 2427 | <?php } ?> |
2428 | 2428 | <div class='row'> |
2429 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2430 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
2429 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2430 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
2431 | 2431 | </div> |
2432 | 2432 | </div> |
2433 | 2433 | |
2434 | 2434 | </div> |
2435 | 2435 | <?php } ?> |
2436 | 2436 | |
2437 | - <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?> |
|
2437 | + <?php if ('multi_select' == $field['items_type']) { ?> |
|
2438 | 2438 | |
2439 | 2439 | <div class="item_totals_type_multi_select"> |
2440 | 2440 | |
@@ -2443,18 +2443,18 @@ discard block |
||
2443 | 2443 | $options = array(); |
2444 | 2444 | $selected = array(); |
2445 | 2445 | |
2446 | - foreach ( $items as $index => $item ) { |
|
2446 | + foreach ($items as $index => $item) { |
|
2447 | 2447 | |
2448 | - if ( ! empty( $item['required'] ) ) { |
|
2448 | + if (!empty($item['required'])) { |
|
2449 | 2449 | continue; |
2450 | 2450 | } |
2451 | 2451 | |
2452 | - $title = sanitize_text_field( $item['title'] ); |
|
2453 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
2454 | - $options[ $item['id'] ] = "$title ($price)"; |
|
2452 | + $title = sanitize_text_field($item['title']); |
|
2453 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
2454 | + $options[$item['id']] = "$title ($price)"; |
|
2455 | 2455 | |
2456 | - if ( ! isset( $selected_item ) ) { |
|
2457 | - $selected = array( $item['id'] ); |
|
2456 | + if (!isset($selected_item)) { |
|
2457 | + $selected = array($item['id']); |
|
2458 | 2458 | $selected_item = 1; |
2459 | 2459 | } |
2460 | 2460 | |
@@ -2481,31 +2481,31 @@ discard block |
||
2481 | 2481 | $tax = 0; |
2482 | 2482 | $sub_total = 0; |
2483 | 2483 | |
2484 | - foreach ( $items as $item ) { |
|
2484 | + foreach ($items as $item) { |
|
2485 | 2485 | |
2486 | 2486 | $class = 'col-8'; |
2487 | 2487 | $class2 = ''; |
2488 | 2488 | |
2489 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
2489 | + if (!empty($item['allow_quantities'])) { |
|
2490 | 2490 | $class = 'col-6 pt-2'; |
2491 | 2491 | $class2 = 'pt-2'; |
2492 | 2492 | } |
2493 | 2493 | |
2494 | - if ( ! empty( $item['custom_price'] ) ) { |
|
2494 | + if (!empty($item['custom_price'])) { |
|
2495 | 2495 | $class .= ' pt-2'; |
2496 | 2496 | } |
2497 | 2497 | |
2498 | 2498 | $class3 = 'd-none'; |
2499 | - $name = ''; |
|
2500 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) { |
|
2499 | + $name = ''; |
|
2500 | + if (!empty($item['required']) || !isset($totals_selected_select_item)) { |
|
2501 | 2501 | |
2502 | - $amount = floatval( $item['price'] ); |
|
2503 | - if ( wpinv_use_taxes() ) { |
|
2502 | + $amount = floatval($item['price']); |
|
2503 | + if (wpinv_use_taxes()) { |
|
2504 | 2504 | |
2505 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
2505 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
2506 | 2506 | |
2507 | - if ( wpinv_prices_include_tax() ) { |
|
2508 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
2507 | + if (wpinv_prices_include_tax()) { |
|
2508 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
2509 | 2509 | $item_tax = $amount - $pre_tax; |
2510 | 2510 | } else { |
2511 | 2511 | $pre_tax = $amount; |
@@ -2517,13 +2517,13 @@ discard block |
||
2517 | 2517 | $total = $sub_total + $tax; |
2518 | 2518 | |
2519 | 2519 | } else { |
2520 | - $total = $total + $amount; |
|
2520 | + $total = $total + $amount; |
|
2521 | 2521 | } |
2522 | 2522 | |
2523 | 2523 | $class3 = ''; |
2524 | - $name = "wpinv-items[{$item['id']}]"; |
|
2524 | + $name = "wpinv-items[{$item['id']}]"; |
|
2525 | 2525 | |
2526 | - if ( empty( $item['required'] ) ) { |
|
2526 | + if (empty($item['required'])) { |
|
2527 | 2527 | $totals_selected_select_item = 1; |
2528 | 2528 | } |
2529 | 2529 | |
@@ -2535,9 +2535,9 @@ discard block |
||
2535 | 2535 | |
2536 | 2536 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2537 | 2537 | <div class='row pl-2 pr-2 pt-2'> |
2538 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2538 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2539 | 2539 | |
2540 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2540 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2541 | 2541 | |
2542 | 2542 | <div class='col-2'> |
2543 | 2543 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2545,11 +2545,11 @@ discard block |
||
2545 | 2545 | |
2546 | 2546 | <?php } else { ?> |
2547 | 2547 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2548 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2548 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2549 | 2549 | |
2550 | 2550 | <div class='col-4 <?php echo $class2; ?>'> |
2551 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2552 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2551 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2552 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2553 | 2553 | </div> |
2554 | 2554 | |
2555 | 2555 | <?php } else {?> |
@@ -2557,15 +2557,15 @@ discard block |
||
2557 | 2557 | <div class='col-4'> |
2558 | 2558 | <div class='input-group'> |
2559 | 2559 | |
2560 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2560 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2561 | 2561 | <div class='input-group-prepend'> |
2562 | 2562 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2563 | 2563 | </div> |
2564 | 2564 | <?php } ?> |
2565 | 2565 | |
2566 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
2566 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
2567 | 2567 | |
2568 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2568 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2569 | 2569 | <div class='input-group-append'> |
2570 | 2570 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2571 | 2571 | </div> |
@@ -2576,35 +2576,35 @@ discard block |
||
2576 | 2576 | <?php } ?> |
2577 | 2577 | |
2578 | 2578 | </div> |
2579 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2580 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2579 | + <?php if (!empty($item['description'])) { ?> |
|
2580 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2581 | 2581 | <?php } ?> |
2582 | 2582 | </div> |
2583 | 2583 | <?php } ?> |
2584 | 2584 | |
2585 | 2585 | <div class='mt-4 border-top item_totals_total p-2'> |
2586 | 2586 | |
2587 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
2587 | + <?php if (wpinv_use_taxes()) { ?> |
|
2588 | 2588 | <div class='row'> |
2589 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
2590 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
2589 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
2590 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
2591 | 2591 | </div> |
2592 | 2592 | <div class='row'> |
2593 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
2594 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
2593 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
2594 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
2595 | 2595 | </div> |
2596 | 2596 | <?php } ?> |
2597 | 2597 | |
2598 | 2598 | <div class='row'> |
2599 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2600 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
2599 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2600 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
2601 | 2601 | </div> |
2602 | 2602 | </div> |
2603 | 2603 | |
2604 | 2604 | </div> |
2605 | 2605 | <?php } ?> |
2606 | - <?php if ( ! empty( $field[ 'description' ] ) ) { ?> |
|
2607 | - <small class='form-text text-muted'><?php echo wp_kses_post( $field[ 'description' ] ); ?></small> |
|
2606 | + <?php if (!empty($field['description'])) { ?> |
|
2607 | + <small class='form-text text-muted'><?php echo wp_kses_post($field['description']); ?></small> |
|
2608 | 2608 | <?php } ?> |
2609 | 2609 | </div> |
2610 | 2610 | <?php |
@@ -2613,20 +2613,20 @@ discard block |
||
2613 | 2613 | /** |
2614 | 2614 | * Renders the items element template. |
2615 | 2615 | */ |
2616 | - public function edit_items_template( $field ) { |
|
2617 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
2618 | - $label = __( 'Let customers...', 'invoicing' ); |
|
2619 | - $label2 = __( 'Available Items', 'invoicing' ); |
|
2620 | - $label3 = esc_attr__( 'Add some help text for this element', 'invoicing' ); |
|
2616 | + public function edit_items_template($field) { |
|
2617 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
2618 | + $label = __('Let customers...', 'invoicing'); |
|
2619 | + $label2 = __('Available Items', 'invoicing'); |
|
2620 | + $label3 = esc_attr__('Add some help text for this element', 'invoicing'); |
|
2621 | 2621 | $id = $field . '.id + "_edit"'; |
2622 | 2622 | $id2 = $field . '.id + "_edit2"'; |
2623 | 2623 | $id3 = $field . '.id + "_edit3"'; |
2624 | 2624 | $id4 = $field . '.id + "_edit4"'; |
2625 | - $label4 = esc_attr__( 'This will be shown to the customer as the recommended price', 'invoicing' ); |
|
2626 | - $label5 = esc_attr__( 'Allow users to pay what they want', 'invoicing' ); |
|
2627 | - $label6 = esc_attr__( 'Enter the minimum price that a user can pay', 'invoicing' ); |
|
2628 | - $label7 = esc_attr__( 'Allow users to buy several quantities', 'invoicing' ); |
|
2629 | - $label8 = esc_attr__( 'This item is required', 'invoicing' ); |
|
2625 | + $label4 = esc_attr__('This will be shown to the customer as the recommended price', 'invoicing'); |
|
2626 | + $label5 = esc_attr__('Allow users to pay what they want', 'invoicing'); |
|
2627 | + $label6 = esc_attr__('Enter the minimum price that a user can pay', 'invoicing'); |
|
2628 | + $label7 = esc_attr__('Allow users to buy several quantities', 'invoicing'); |
|
2629 | + $label8 = esc_attr__('This item is required', 'invoicing'); |
|
2630 | 2630 | echo "<div $restrict> |
2631 | 2631 | |
2632 | 2632 | <label>$label2</label> |
@@ -2696,7 +2696,7 @@ discard block |
||
2696 | 2696 | <div class='form-group mt-2'> |
2697 | 2697 | |
2698 | 2698 | <select class='form-control custom-select' v-model='selected_item' @change='addSelectedItem'> |
2699 | - <option value=''>" . __( 'Add an existing item to the form', 'invoicing' ) ."</option> |
|
2699 | + <option value=''>" . __('Add an existing item to the form', 'invoicing') . "</option> |
|
2700 | 2700 | <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option> |
2701 | 2701 | </select> |
2702 | 2702 | |
@@ -2711,11 +2711,11 @@ discard block |
||
2711 | 2711 | <label :for='$id2'>$label</label> |
2712 | 2712 | |
2713 | 2713 | <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'> |
2714 | - <option value='total' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __( 'Buy all items on the list', 'invoicing' ) ."</option> |
|
2715 | - <option value='radio'>" . __( 'Select a single item from the list', 'invoicing' ) ."</option> |
|
2716 | - <option value='checkbox' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __( 'Select one or more items on the list', 'invoicing' ) ."</option> |
|
2717 | - <option value='select'>" . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option> |
|
2718 | - <option value='multi_select' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option> |
|
2714 | + <option value='total' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __('Buy all items on the list', 'invoicing') . "</option> |
|
2715 | + <option value='radio'>" . __('Select a single item from the list', 'invoicing') . "</option> |
|
2716 | + <option value='checkbox' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __('Select one or more items on the list', 'invoicing') . "</option> |
|
2717 | + <option value='select'>" . __('Select a single item from a dropdown', 'invoicing') . "</option> |
|
2718 | + <option value='multi_select' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option> |
|
2719 | 2719 | </select> |
2720 | 2720 | |
2721 | 2721 | </div> |
@@ -2740,7 +2740,7 @@ discard block |
||
2740 | 2740 | 'orderby' => 'title', |
2741 | 2741 | 'order' => 'ASC', |
2742 | 2742 | 'posts_per_page' => -1, |
2743 | - 'post_status' => array( 'publish' ), |
|
2743 | + 'post_status' => array('publish'), |
|
2744 | 2744 | 'meta_query' => array( |
2745 | 2745 | array( |
2746 | 2746 | 'key' => '_wpinv_type', |
@@ -2750,24 +2750,24 @@ discard block |
||
2750 | 2750 | ) |
2751 | 2751 | ); |
2752 | 2752 | |
2753 | - $items = get_posts( apply_filters( 'wpinv_payment_form_item_dropdown_query_args', $item_args ) ); |
|
2753 | + $items = get_posts(apply_filters('wpinv_payment_form_item_dropdown_query_args', $item_args)); |
|
2754 | 2754 | |
2755 | - if ( empty( $items ) ) { |
|
2755 | + if (empty($items)) { |
|
2756 | 2756 | return array(); |
2757 | 2757 | } |
2758 | 2758 | |
2759 | - $options = array(); |
|
2760 | - foreach ( $items as $item ) { |
|
2761 | - $title = esc_html( $item->post_title ); |
|
2762 | - $title .= wpinv_get_item_suffix( $item->ID, false ); |
|
2763 | - $id = absint( $item->ID ); |
|
2764 | - $price = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) ); |
|
2765 | - $recurring = (bool) get_post_meta( $id, '_wpinv_is_recurring', true ); |
|
2759 | + $options = array(); |
|
2760 | + foreach ($items as $item) { |
|
2761 | + $title = esc_html($item->post_title); |
|
2762 | + $title .= wpinv_get_item_suffix($item->ID, false); |
|
2763 | + $id = absint($item->ID); |
|
2764 | + $price = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true)); |
|
2765 | + $recurring = (bool) get_post_meta($id, '_wpinv_is_recurring', true); |
|
2766 | 2766 | $description = $item->post_excerpt; |
2767 | - $custom_price = (bool) get_post_meta( $id, '_wpinv_dynamic_pricing', true ); |
|
2768 | - $minimum_price = (float) get_post_meta( $id, '_minimum_price', true ); |
|
2767 | + $custom_price = (bool) get_post_meta($id, '_wpinv_dynamic_pricing', true); |
|
2768 | + $minimum_price = (float) get_post_meta($id, '_minimum_price', true); |
|
2769 | 2769 | $allow_quantities = false; |
2770 | - $options[] = compact( 'title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities' ); |
|
2770 | + $options[] = compact('title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities'); |
|
2771 | 2771 | |
2772 | 2772 | } |
2773 | 2773 | return $options; |
@@ -2777,47 +2777,47 @@ discard block |
||
2777 | 2777 | /** |
2778 | 2778 | * Returns an array of items for the currently being edited form. |
2779 | 2779 | */ |
2780 | - public function get_form_items( $id = false ) { |
|
2780 | + public function get_form_items($id = false) { |
|
2781 | 2781 | |
2782 | - if ( empty( $id ) ) { |
|
2783 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
2782 | + if (empty($id)) { |
|
2783 | + return wpinv_get_data('sample-payment-form-items'); |
|
2784 | 2784 | } |
2785 | 2785 | |
2786 | - $form_elements = get_post_meta( $id, 'wpinv_form_items', true ); |
|
2786 | + $form_elements = get_post_meta($id, 'wpinv_form_items', true); |
|
2787 | 2787 | |
2788 | - if ( is_array( $form_elements ) ) { |
|
2788 | + if (is_array($form_elements)) { |
|
2789 | 2789 | return $form_elements; |
2790 | 2790 | } |
2791 | 2791 | |
2792 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
2792 | + return wpinv_get_data('sample-payment-form-items'); |
|
2793 | 2793 | |
2794 | 2794 | } |
2795 | 2795 | |
2796 | 2796 | /** |
2797 | 2797 | * Returns an array of elements for the currently being edited form. |
2798 | 2798 | */ |
2799 | - public function get_form_elements( $id = false ) { |
|
2799 | + public function get_form_elements($id = false) { |
|
2800 | 2800 | |
2801 | - if ( empty( $id ) ) { |
|
2802 | - return wpinv_get_data( 'sample-payment-form' ); |
|
2801 | + if (empty($id)) { |
|
2802 | + return wpinv_get_data('sample-payment-form'); |
|
2803 | 2803 | } |
2804 | 2804 | |
2805 | - $form_elements = get_post_meta( $id, 'wpinv_form_elements', true ); |
|
2805 | + $form_elements = get_post_meta($id, 'wpinv_form_elements', true); |
|
2806 | 2806 | |
2807 | - if ( is_array( $form_elements ) ) { |
|
2807 | + if (is_array($form_elements)) { |
|
2808 | 2808 | return $form_elements; |
2809 | 2809 | } |
2810 | 2810 | |
2811 | - return wpinv_get_data( 'sample-payment-form' ); |
|
2811 | + return wpinv_get_data('sample-payment-form'); |
|
2812 | 2812 | } |
2813 | 2813 | |
2814 | 2814 | /** |
2815 | 2815 | * Sends a redrect response to payment details. |
2816 | 2816 | * |
2817 | 2817 | */ |
2818 | - public function send_redirect_response( $url ) { |
|
2819 | - $url = urlencode( $url ); |
|
2820 | - wp_send_json_success( $url ); |
|
2818 | + public function send_redirect_response($url) { |
|
2819 | + $url = urlencode($url); |
|
2820 | + wp_send_json_success($url); |
|
2821 | 2821 | } |
2822 | 2822 | |
2823 | 2823 | /** |
@@ -2828,12 +2828,12 @@ discard block |
||
2828 | 2828 | |
2829 | 2829 | $errors = wpinv_get_errors(); |
2830 | 2830 | |
2831 | - if ( ! empty( $errors ) ) { |
|
2831 | + if (!empty($errors)) { |
|
2832 | 2832 | wpinv_print_errors(); |
2833 | 2833 | exit; |
2834 | 2834 | } |
2835 | 2835 | |
2836 | - wp_send_json_error( __( 'An error occured while processing your payment. Please try again.', 'invoicing' ) ); |
|
2836 | + wp_send_json_error(__('An error occured while processing your payment. Please try again.', 'invoicing')); |
|
2837 | 2837 | exit; |
2838 | 2838 | |
2839 | 2839 | } |