@@ -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,21 +1815,21 @@ 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' ); |
|
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 | 1821 | echo "<div $restrict class='item_totals p-4 bg-warning text-center'>$label</div>"; |
1822 | 1822 | } |
1823 | 1823 | |
1824 | 1824 | /** |
1825 | 1825 | * Renders the items element on the frontend. |
1826 | 1826 | */ |
1827 | - public function frontend_render_items_template( $field, $items ) { |
|
1827 | + public function frontend_render_items_template($field, $items) { |
|
1828 | 1828 | |
1829 | 1829 | echo "<div class='form-group item_totals'>"; |
1830 | 1830 | |
1831 | - $id = esc_attr( $field['id'] ); |
|
1832 | - if ( 'total' == $field[ 'items_type' ] ) { |
|
1831 | + $id = esc_attr($field['id']); |
|
1832 | + if ('total' == $field['items_type']) { |
|
1833 | 1833 | $total = 0; |
1834 | 1834 | $tax = 0; |
1835 | 1835 | $sub_total = 0; |
@@ -1838,16 +1838,16 @@ discard block |
||
1838 | 1838 | <div class="border item_totals_type_total"> |
1839 | 1839 | |
1840 | 1840 | <?php |
1841 | - foreach( $items as $item ) { |
|
1841 | + foreach ($items as $item) { |
|
1842 | 1842 | |
1843 | - $amount = floatval( $item['price'] ); |
|
1843 | + $amount = floatval($item['price']); |
|
1844 | 1844 | |
1845 | - if ( wpinv_use_taxes() ) { |
|
1845 | + if (wpinv_use_taxes()) { |
|
1846 | 1846 | |
1847 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
1847 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
1848 | 1848 | |
1849 | - if ( wpinv_prices_include_tax() ) { |
|
1850 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
1849 | + if (wpinv_prices_include_tax()) { |
|
1850 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
1851 | 1851 | $item_tax = $amount - $pre_tax; |
1852 | 1852 | } else { |
1853 | 1853 | $pre_tax = $amount; |
@@ -1859,27 +1859,27 @@ discard block |
||
1859 | 1859 | $total = $sub_total + $tax; |
1860 | 1860 | |
1861 | 1861 | } else { |
1862 | - $total = $total + $amount; |
|
1862 | + $total = $total + $amount; |
|
1863 | 1863 | } |
1864 | 1864 | |
1865 | 1865 | $class = 'col-8'; |
1866 | 1866 | $class2 = ''; |
1867 | 1867 | |
1868 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
1868 | + if (!empty($item['allow_quantities'])) { |
|
1869 | 1869 | $class = 'col-6 pt-2'; |
1870 | 1870 | $class2 = 'pt-2'; |
1871 | 1871 | } |
1872 | 1872 | |
1873 | - if ( ! empty( $item['custom_price'] ) ) { |
|
1873 | + if (!empty($item['custom_price'])) { |
|
1874 | 1874 | $class .= ' pt-2'; |
1875 | 1875 | } |
1876 | 1876 | |
1877 | 1877 | ?> |
1878 | 1878 | <div class="item_totals_item"> |
1879 | 1879 | <div class='row pl-2 pr-2 pt-2'> |
1880 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
1880 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
1881 | 1881 | |
1882 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
1882 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
1883 | 1883 | |
1884 | 1884 | <div class='col-2'> |
1885 | 1885 | <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> |
@@ -1887,11 +1887,11 @@ discard block |
||
1887 | 1887 | |
1888 | 1888 | <?php } else { ?> |
1889 | 1889 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
1890 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
1890 | + <?php } if (empty($item['custom_price'])) { ?> |
|
1891 | 1891 | |
1892 | 1892 | <div class='col-4 <?php echo $class2; ?>'> |
1893 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
1894 | - <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
1893 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
1894 | + <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
1895 | 1895 | </div> |
1896 | 1896 | |
1897 | 1897 | <?php } else {?> |
@@ -1899,15 +1899,15 @@ discard block |
||
1899 | 1899 | <div class='col-4'> |
1900 | 1900 | <div class='input-group'> |
1901 | 1901 | |
1902 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
1902 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
1903 | 1903 | <div class='input-group-prepend'> |
1904 | 1904 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
1905 | 1905 | </div> |
1906 | 1906 | <?php } ?> |
1907 | 1907 | |
1908 | - <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'] ); ?>'> |
|
1908 | + <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']); ?>'> |
|
1909 | 1909 | |
1910 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
1910 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
1911 | 1911 | <div class='input-group-append'> |
1912 | 1912 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
1913 | 1913 | </div> |
@@ -1918,28 +1918,28 @@ discard block |
||
1918 | 1918 | <?php } ?> |
1919 | 1919 | |
1920 | 1920 | </div> |
1921 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1922 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1921 | + <?php if (!empty($item['description'])) { ?> |
|
1922 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1923 | 1923 | <?php } ?> |
1924 | 1924 | </div> |
1925 | 1925 | <?php } ?> |
1926 | 1926 | |
1927 | 1927 | <div class='mt-4 border-top item_totals_total p-2'> |
1928 | 1928 | |
1929 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
1929 | + <?php if (wpinv_use_taxes()) { ?> |
|
1930 | 1930 | <div class='row'> |
1931 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
1932 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
1931 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
1932 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
1933 | 1933 | </div> |
1934 | 1934 | <div class='row'> |
1935 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
1936 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
1935 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
1936 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
1937 | 1937 | </div> |
1938 | 1938 | <?php } ?> |
1939 | 1939 | |
1940 | 1940 | <div class='row'> |
1941 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
1942 | - <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> |
|
1941 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
1942 | + <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> |
|
1943 | 1943 | </div> |
1944 | 1944 | |
1945 | 1945 | </div> |
@@ -1947,22 +1947,22 @@ discard block |
||
1947 | 1947 | </div> |
1948 | 1948 | <?php } ?> |
1949 | 1949 | |
1950 | - <?php if ( 'radio' == $field[ 'items_type' ] ) { ?> |
|
1950 | + <?php if ('radio' == $field['items_type']) { ?> |
|
1951 | 1951 | <div class="item_totals_type_radio"> |
1952 | 1952 | |
1953 | 1953 | <?php |
1954 | - foreach( $items as $index => $item ) { |
|
1954 | + foreach ($items as $index => $item) { |
|
1955 | 1955 | |
1956 | - if ( ! empty( $item['required'] ) ) { |
|
1956 | + if (!empty($item['required'])) { |
|
1957 | 1957 | continue; |
1958 | 1958 | } |
1959 | 1959 | ?> |
1960 | 1960 | <div class="form-check"> |
1961 | - <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'> |
|
1962 | - <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> |
|
1961 | + <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'> |
|
1962 | + <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> |
|
1963 | 1963 | </div> |
1964 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1965 | - <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1964 | + <?php if (!empty($item['description'])) { ?> |
|
1965 | + <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1966 | 1966 | <?php } ?> |
1967 | 1967 | <?php } ?> |
1968 | 1968 | |
@@ -1974,32 +1974,32 @@ discard block |
||
1974 | 1974 | $tax = 0; |
1975 | 1975 | $sub_total = 0; |
1976 | 1976 | |
1977 | - foreach ( $items as $item ) { |
|
1977 | + foreach ($items as $item) { |
|
1978 | 1978 | |
1979 | 1979 | $class = 'col-8'; |
1980 | 1980 | $class2 = ''; |
1981 | 1981 | |
1982 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
1982 | + if (!empty($item['allow_quantities'])) { |
|
1983 | 1983 | $class = 'col-6 pt-2'; |
1984 | 1984 | $class2 = 'pt-2'; |
1985 | 1985 | } |
1986 | 1986 | |
1987 | - if ( ! empty( $item['custom_price'] ) ) { |
|
1987 | + if (!empty($item['custom_price'])) { |
|
1988 | 1988 | $class .= ' pt-2'; |
1989 | 1989 | } |
1990 | 1990 | |
1991 | 1991 | $class3 = 'd-none'; |
1992 | 1992 | $name = ''; |
1993 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_radio_item ) ) { |
|
1993 | + if (!empty($item['required']) || !isset($totals_selected_radio_item)) { |
|
1994 | 1994 | |
1995 | - $amount = floatval( $item['price'] ); |
|
1995 | + $amount = floatval($item['price']); |
|
1996 | 1996 | |
1997 | - if ( wpinv_use_taxes() ) { |
|
1997 | + if (wpinv_use_taxes()) { |
|
1998 | 1998 | |
1999 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
1999 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
2000 | 2000 | |
2001 | - if ( wpinv_prices_include_tax() ) { |
|
2002 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
2001 | + if (wpinv_prices_include_tax()) { |
|
2002 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
2003 | 2003 | $item_tax = $amount - $pre_tax; |
2004 | 2004 | } else { |
2005 | 2005 | $pre_tax = $amount; |
@@ -2011,13 +2011,13 @@ discard block |
||
2011 | 2011 | $total = $sub_total + $tax; |
2012 | 2012 | |
2013 | 2013 | } else { |
2014 | - $total = $total + $amount; |
|
2014 | + $total = $total + $amount; |
|
2015 | 2015 | } |
2016 | 2016 | |
2017 | 2017 | $class3 = ''; |
2018 | 2018 | $name = "wpinv-items[{$item['id']}]"; |
2019 | 2019 | |
2020 | - if ( empty( $item['required'] ) ) { |
|
2020 | + if (empty($item['required'])) { |
|
2021 | 2021 | $totals_selected_radio_item = 1; |
2022 | 2022 | } |
2023 | 2023 | |
@@ -2029,9 +2029,9 @@ discard block |
||
2029 | 2029 | |
2030 | 2030 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2031 | 2031 | <div class='row pl-2 pr-2 pt-2'> |
2032 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2032 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2033 | 2033 | |
2034 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2034 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2035 | 2035 | |
2036 | 2036 | <div class='col-2'> |
2037 | 2037 | <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> |
@@ -2039,11 +2039,11 @@ discard block |
||
2039 | 2039 | |
2040 | 2040 | <?php } else { ?> |
2041 | 2041 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2042 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2042 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2043 | 2043 | |
2044 | 2044 | <div class='col-4 <?php echo $class2; ?>'> |
2045 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2046 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2045 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2046 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2047 | 2047 | </div> |
2048 | 2048 | |
2049 | 2049 | <?php } else {?> |
@@ -2051,15 +2051,15 @@ discard block |
||
2051 | 2051 | <div class='col-4'> |
2052 | 2052 | <div class='input-group'> |
2053 | 2053 | |
2054 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2054 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2055 | 2055 | <div class='input-group-prepend'> |
2056 | 2056 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2057 | 2057 | </div> |
2058 | 2058 | <?php } ?> |
2059 | 2059 | |
2060 | - <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'] ); ?>'> |
|
2060 | + <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']); ?>'> |
|
2061 | 2061 | |
2062 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2062 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2063 | 2063 | <div class='input-group-append'> |
2064 | 2064 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2065 | 2065 | </div> |
@@ -2070,27 +2070,27 @@ discard block |
||
2070 | 2070 | <?php } ?> |
2071 | 2071 | |
2072 | 2072 | </div> |
2073 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2074 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2073 | + <?php if (!empty($item['description'])) { ?> |
|
2074 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2075 | 2075 | <?php } ?> |
2076 | 2076 | </div> |
2077 | 2077 | <?php } ?> |
2078 | 2078 | |
2079 | 2079 | <div class='mt-4 border-top item_totals_total p-2'> |
2080 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
2080 | + <?php if (wpinv_use_taxes()) { ?> |
|
2081 | 2081 | <div class='row'> |
2082 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
2083 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
2082 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
2083 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
2084 | 2084 | </div> |
2085 | 2085 | <div class='row'> |
2086 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
2087 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
2086 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
2087 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
2088 | 2088 | </div> |
2089 | 2089 | <?php } ?> |
2090 | 2090 | |
2091 | 2091 | <div class='row'> |
2092 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2093 | - <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> |
|
2092 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2093 | + <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> |
|
2094 | 2094 | </div> |
2095 | 2095 | </div> |
2096 | 2096 | |
@@ -2098,22 +2098,22 @@ discard block |
||
2098 | 2098 | </div> |
2099 | 2099 | <?php } ?> |
2100 | 2100 | |
2101 | - <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?> |
|
2101 | + <?php if ('checkbox' == $field['items_type']) { ?> |
|
2102 | 2102 | |
2103 | 2103 | <div class="item_totals_type_checkbox"> |
2104 | 2104 | |
2105 | 2105 | <?php |
2106 | - foreach ( $items as $index => $item ) { |
|
2106 | + foreach ($items as $index => $item) { |
|
2107 | 2107 | |
2108 | - if ( ! empty( $item['required'] ) ) { |
|
2108 | + if (!empty($item['required'])) { |
|
2109 | 2109 | continue; |
2110 | 2110 | } |
2111 | 2111 | |
2112 | - $title = sanitize_text_field( $item['title'] ); |
|
2113 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
2114 | - $item_id = esc_attr( $id . "_$index" ); |
|
2115 | - $value = esc_attr( $item['id'] ); |
|
2116 | - $checked = checked( ! isset( $selected_checkbox_item ), true, false ); |
|
2112 | + $title = sanitize_text_field($item['title']); |
|
2113 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
2114 | + $item_id = esc_attr($id . "_$index"); |
|
2115 | + $value = esc_attr($item['id']); |
|
2116 | + $checked = checked(!isset($selected_checkbox_item), true, false); |
|
2117 | 2117 | $selected_checkbox_item = 1; |
2118 | 2118 | |
2119 | 2119 | echo " |
@@ -2122,7 +2122,7 @@ discard block |
||
2122 | 2122 | <label for='$item_id' class='custom-control-label'>$title ($price)</label> |
2123 | 2123 | </div>"; |
2124 | 2124 | |
2125 | - if ( ! empty( $item['description'] ) ) { |
|
2125 | + if (!empty($item['description'])) { |
|
2126 | 2126 | echo "<small class='form-text text-muted'>{$item['description']}</small>"; |
2127 | 2127 | } |
2128 | 2128 | } |
@@ -2136,31 +2136,31 @@ discard block |
||
2136 | 2136 | $tax = 0; |
2137 | 2137 | $sub_total = 0; |
2138 | 2138 | |
2139 | - foreach ( $items as $item ) { |
|
2139 | + foreach ($items as $item) { |
|
2140 | 2140 | |
2141 | 2141 | $class = 'col-8'; |
2142 | 2142 | $class2 = ''; |
2143 | 2143 | |
2144 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
2144 | + if (!empty($item['allow_quantities'])) { |
|
2145 | 2145 | $class = 'col-6 pt-2'; |
2146 | 2146 | $class2 = 'pt-2'; |
2147 | 2147 | } |
2148 | 2148 | |
2149 | - if ( ! empty( $item['custom_price'] ) ) { |
|
2149 | + if (!empty($item['custom_price'])) { |
|
2150 | 2150 | $class .= ' pt-2'; |
2151 | 2151 | } |
2152 | 2152 | |
2153 | 2153 | $class3 = 'd-none'; |
2154 | - $name = ''; |
|
2155 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_checkbox_item ) ) { |
|
2154 | + $name = ''; |
|
2155 | + if (!empty($item['required']) || !isset($totals_selected_checkbox_item)) { |
|
2156 | 2156 | |
2157 | - $amount = floatval( $item['price'] ); |
|
2158 | - if ( wpinv_use_taxes() ) { |
|
2157 | + $amount = floatval($item['price']); |
|
2158 | + if (wpinv_use_taxes()) { |
|
2159 | 2159 | |
2160 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
2160 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
2161 | 2161 | |
2162 | - if ( wpinv_prices_include_tax() ) { |
|
2163 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
2162 | + if (wpinv_prices_include_tax()) { |
|
2163 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
2164 | 2164 | $item_tax = $amount - $pre_tax; |
2165 | 2165 | } else { |
2166 | 2166 | $pre_tax = $amount; |
@@ -2172,13 +2172,13 @@ discard block |
||
2172 | 2172 | $total = $sub_total + $tax; |
2173 | 2173 | |
2174 | 2174 | } else { |
2175 | - $total = $total + $amount; |
|
2175 | + $total = $total + $amount; |
|
2176 | 2176 | } |
2177 | 2177 | |
2178 | 2178 | $class3 = ''; |
2179 | - $name = "wpinv-items[{$item['id']}]"; |
|
2179 | + $name = "wpinv-items[{$item['id']}]"; |
|
2180 | 2180 | |
2181 | - if ( empty( $item['required'] ) ) { |
|
2181 | + if (empty($item['required'])) { |
|
2182 | 2182 | $totals_selected_checkbox_item = 1; |
2183 | 2183 | } |
2184 | 2184 | |
@@ -2190,9 +2190,9 @@ discard block |
||
2190 | 2190 | |
2191 | 2191 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2192 | 2192 | <div class='row pl-2 pr-2 pt-2'> |
2193 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2193 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2194 | 2194 | |
2195 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2195 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2196 | 2196 | |
2197 | 2197 | <div class='col-2'> |
2198 | 2198 | <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> |
@@ -2200,11 +2200,11 @@ discard block |
||
2200 | 2200 | |
2201 | 2201 | <?php } else { ?> |
2202 | 2202 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2203 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2203 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2204 | 2204 | |
2205 | 2205 | <div class='col-4 <?php echo $class2; ?>'> |
2206 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2207 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2206 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2207 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2208 | 2208 | </div> |
2209 | 2209 | |
2210 | 2210 | <?php } else {?> |
@@ -2212,15 +2212,15 @@ discard block |
||
2212 | 2212 | <div class='col-4'> |
2213 | 2213 | <div class='input-group'> |
2214 | 2214 | |
2215 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2215 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2216 | 2216 | <div class='input-group-prepend'> |
2217 | 2217 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2218 | 2218 | </div> |
2219 | 2219 | <?php } ?> |
2220 | 2220 | |
2221 | - <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'] ); ?>'> |
|
2221 | + <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']); ?>'> |
|
2222 | 2222 | |
2223 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2223 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2224 | 2224 | <div class='input-group-append'> |
2225 | 2225 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2226 | 2226 | </div> |
@@ -2231,35 +2231,35 @@ discard block |
||
2231 | 2231 | <?php } ?> |
2232 | 2232 | |
2233 | 2233 | </div> |
2234 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2235 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2234 | + <?php if (!empty($item['description'])) { ?> |
|
2235 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2236 | 2236 | <?php } ?> |
2237 | 2237 | </div> |
2238 | 2238 | <?php } ?> |
2239 | 2239 | |
2240 | 2240 | <div class='mt-4 border-top item_totals_total p-2'> |
2241 | 2241 | |
2242 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
2242 | + <?php if (wpinv_use_taxes()) { ?> |
|
2243 | 2243 | <div class='row'> |
2244 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
2245 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
2244 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
2245 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
2246 | 2246 | </div> |
2247 | 2247 | <div class='row'> |
2248 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
2249 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
2248 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
2249 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
2250 | 2250 | </div> |
2251 | 2251 | <?php } ?> |
2252 | 2252 | |
2253 | 2253 | <div class='row'> |
2254 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2255 | - <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> |
|
2254 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2255 | + <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> |
|
2256 | 2256 | </div> |
2257 | 2257 | </div> |
2258 | 2258 | </div> |
2259 | 2259 | </div> |
2260 | 2260 | <?php } ?> |
2261 | 2261 | |
2262 | - <?php if ( 'select' == $field[ 'items_type' ] ) { ?> |
|
2262 | + <?php if ('select' == $field['items_type']) { ?> |
|
2263 | 2263 | |
2264 | 2264 | <div class="item_totals_type_select"> |
2265 | 2265 | |
@@ -2267,17 +2267,17 @@ discard block |
||
2267 | 2267 | |
2268 | 2268 | $options = array(); |
2269 | 2269 | $selected = ''; |
2270 | - foreach ( $items as $index => $item ) { |
|
2270 | + foreach ($items as $index => $item) { |
|
2271 | 2271 | |
2272 | - if ( ! empty( $item['required'] ) ) { |
|
2272 | + if (!empty($item['required'])) { |
|
2273 | 2273 | continue; |
2274 | 2274 | } |
2275 | 2275 | |
2276 | - $title = sanitize_text_field( $item['title'] ); |
|
2277 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
2278 | - $options[ $item['id'] ] = "$title ($price)"; |
|
2276 | + $title = sanitize_text_field($item['title']); |
|
2277 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
2278 | + $options[$item['id']] = "$title ($price)"; |
|
2279 | 2279 | |
2280 | - if ( ! isset( $selected_item ) ) { |
|
2280 | + if (!isset($selected_item)) { |
|
2281 | 2281 | $selected = $item['id']; |
2282 | 2282 | $selected_item = 1; |
2283 | 2283 | } |
@@ -2288,7 +2288,7 @@ discard block |
||
2288 | 2288 | array( |
2289 | 2289 | 'name' => 'payment-form-items', |
2290 | 2290 | 'id' => $id, |
2291 | - 'placeholder' => __( 'Select an item', 'invoicing' ), |
|
2291 | + 'placeholder' => __('Select an item', 'invoicing'), |
|
2292 | 2292 | 'no_wrap' => true, |
2293 | 2293 | 'options' => $options, |
2294 | 2294 | 'class' => 'wpi_select2 wpinv-items-select-selector', |
@@ -2305,31 +2305,31 @@ discard block |
||
2305 | 2305 | $tax = 0; |
2306 | 2306 | $sub_total = 0; |
2307 | 2307 | |
2308 | - foreach ( $items as $item ) { |
|
2308 | + foreach ($items as $item) { |
|
2309 | 2309 | |
2310 | 2310 | $class = 'col-8'; |
2311 | 2311 | $class2 = ''; |
2312 | 2312 | |
2313 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
2313 | + if (!empty($item['allow_quantities'])) { |
|
2314 | 2314 | $class = 'col-6 pt-2'; |
2315 | 2315 | $class2 = 'pt-2'; |
2316 | 2316 | } |
2317 | 2317 | |
2318 | - if ( ! empty( $item['custom_price'] ) ) { |
|
2318 | + if (!empty($item['custom_price'])) { |
|
2319 | 2319 | $class .= ' pt-2'; |
2320 | 2320 | } |
2321 | 2321 | |
2322 | 2322 | $class3 = 'd-none'; |
2323 | - $name = ''; |
|
2324 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) { |
|
2323 | + $name = ''; |
|
2324 | + if (!empty($item['required']) || !isset($totals_selected_select_item)) { |
|
2325 | 2325 | |
2326 | - $amount = floatval( $item['price'] ); |
|
2327 | - if ( wpinv_use_taxes() ) { |
|
2326 | + $amount = floatval($item['price']); |
|
2327 | + if (wpinv_use_taxes()) { |
|
2328 | 2328 | |
2329 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
2329 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
2330 | 2330 | |
2331 | - if ( wpinv_prices_include_tax() ) { |
|
2332 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
2331 | + if (wpinv_prices_include_tax()) { |
|
2332 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
2333 | 2333 | $item_tax = $amount - $pre_tax; |
2334 | 2334 | } else { |
2335 | 2335 | $pre_tax = $amount; |
@@ -2341,13 +2341,13 @@ discard block |
||
2341 | 2341 | $total = $sub_total + $tax; |
2342 | 2342 | |
2343 | 2343 | } else { |
2344 | - $total = $total + $amount; |
|
2344 | + $total = $total + $amount; |
|
2345 | 2345 | } |
2346 | 2346 | |
2347 | 2347 | $class3 = ''; |
2348 | - $name = "wpinv-items[{$item['id']}]"; |
|
2348 | + $name = "wpinv-items[{$item['id']}]"; |
|
2349 | 2349 | |
2350 | - if ( empty( $item['required'] ) ) { |
|
2350 | + if (empty($item['required'])) { |
|
2351 | 2351 | $totals_selected_select_item = 1; |
2352 | 2352 | } |
2353 | 2353 | |
@@ -2359,9 +2359,9 @@ discard block |
||
2359 | 2359 | |
2360 | 2360 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2361 | 2361 | <div class='row pl-2 pr-2 pt-2'> |
2362 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2362 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2363 | 2363 | |
2364 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2364 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2365 | 2365 | |
2366 | 2366 | <div class='col-2'> |
2367 | 2367 | <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> |
@@ -2369,11 +2369,11 @@ discard block |
||
2369 | 2369 | |
2370 | 2370 | <?php } else { ?> |
2371 | 2371 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2372 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2372 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2373 | 2373 | |
2374 | 2374 | <div class='col-4 <?php echo $class2; ?>'> |
2375 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2376 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2375 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2376 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2377 | 2377 | </div> |
2378 | 2378 | |
2379 | 2379 | <?php } else {?> |
@@ -2381,15 +2381,15 @@ discard block |
||
2381 | 2381 | <div class='col-4'> |
2382 | 2382 | <div class='input-group'> |
2383 | 2383 | |
2384 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2384 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2385 | 2385 | <div class='input-group-prepend'> |
2386 | 2386 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2387 | 2387 | </div> |
2388 | 2388 | <?php } ?> |
2389 | 2389 | |
2390 | - <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'] ); ?>'> |
|
2390 | + <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']); ?>'> |
|
2391 | 2391 | |
2392 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2392 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2393 | 2393 | <div class='input-group-append'> |
2394 | 2394 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2395 | 2395 | </div> |
@@ -2400,34 +2400,34 @@ discard block |
||
2400 | 2400 | <?php } ?> |
2401 | 2401 | |
2402 | 2402 | </div> |
2403 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2404 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2403 | + <?php if (!empty($item['description'])) { ?> |
|
2404 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2405 | 2405 | <?php } ?> |
2406 | 2406 | </div> |
2407 | 2407 | <?php } ?> |
2408 | 2408 | |
2409 | 2409 | <div class='mt-4 border-top item_totals_total p-2'> |
2410 | 2410 | |
2411 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
2411 | + <?php if (wpinv_use_taxes()) { ?> |
|
2412 | 2412 | <div class='row'> |
2413 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
2414 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
2413 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
2414 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
2415 | 2415 | </div> |
2416 | 2416 | <div class='row'> |
2417 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
2418 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
2417 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
2418 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
2419 | 2419 | </div> |
2420 | 2420 | <?php } ?> |
2421 | 2421 | <div class='row'> |
2422 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2423 | - <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> |
|
2422 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2423 | + <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> |
|
2424 | 2424 | </div> |
2425 | 2425 | </div> |
2426 | 2426 | |
2427 | 2427 | </div> |
2428 | 2428 | <?php } ?> |
2429 | 2429 | |
2430 | - <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?> |
|
2430 | + <?php if ('multi_select' == $field['items_type']) { ?> |
|
2431 | 2431 | |
2432 | 2432 | <div class="item_totals_type_multi_select"> |
2433 | 2433 | |
@@ -2436,18 +2436,18 @@ discard block |
||
2436 | 2436 | $options = array(); |
2437 | 2437 | $selected = array(); |
2438 | 2438 | |
2439 | - foreach ( $items as $index => $item ) { |
|
2439 | + foreach ($items as $index => $item) { |
|
2440 | 2440 | |
2441 | - if ( ! empty( $item['required'] ) ) { |
|
2441 | + if (!empty($item['required'])) { |
|
2442 | 2442 | continue; |
2443 | 2443 | } |
2444 | 2444 | |
2445 | - $title = sanitize_text_field( $item['title'] ); |
|
2446 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
2447 | - $options[ $item['id'] ] = "$title ($price)"; |
|
2445 | + $title = sanitize_text_field($item['title']); |
|
2446 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
2447 | + $options[$item['id']] = "$title ($price)"; |
|
2448 | 2448 | |
2449 | - if ( ! isset( $selected_item ) ) { |
|
2450 | - $selected = array( $item['id'] ); |
|
2449 | + if (!isset($selected_item)) { |
|
2450 | + $selected = array($item['id']); |
|
2451 | 2451 | $selected_item = 1; |
2452 | 2452 | } |
2453 | 2453 | |
@@ -2474,31 +2474,31 @@ discard block |
||
2474 | 2474 | $tax = 0; |
2475 | 2475 | $sub_total = 0; |
2476 | 2476 | |
2477 | - foreach ( $items as $item ) { |
|
2477 | + foreach ($items as $item) { |
|
2478 | 2478 | |
2479 | 2479 | $class = 'col-8'; |
2480 | 2480 | $class2 = ''; |
2481 | 2481 | |
2482 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
2482 | + if (!empty($item['allow_quantities'])) { |
|
2483 | 2483 | $class = 'col-6 pt-2'; |
2484 | 2484 | $class2 = 'pt-2'; |
2485 | 2485 | } |
2486 | 2486 | |
2487 | - if ( ! empty( $item['custom_price'] ) ) { |
|
2487 | + if (!empty($item['custom_price'])) { |
|
2488 | 2488 | $class .= ' pt-2'; |
2489 | 2489 | } |
2490 | 2490 | |
2491 | 2491 | $class3 = 'd-none'; |
2492 | - $name = ''; |
|
2493 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) { |
|
2492 | + $name = ''; |
|
2493 | + if (!empty($item['required']) || !isset($totals_selected_select_item)) { |
|
2494 | 2494 | |
2495 | - $amount = floatval( $item['price'] ); |
|
2496 | - if ( wpinv_use_taxes() ) { |
|
2495 | + $amount = floatval($item['price']); |
|
2496 | + if (wpinv_use_taxes()) { |
|
2497 | 2497 | |
2498 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
2498 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
2499 | 2499 | |
2500 | - if ( wpinv_prices_include_tax() ) { |
|
2501 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
2500 | + if (wpinv_prices_include_tax()) { |
|
2501 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
2502 | 2502 | $item_tax = $amount - $pre_tax; |
2503 | 2503 | } else { |
2504 | 2504 | $pre_tax = $amount; |
@@ -2510,13 +2510,13 @@ discard block |
||
2510 | 2510 | $total = $sub_total + $tax; |
2511 | 2511 | |
2512 | 2512 | } else { |
2513 | - $total = $total + $amount; |
|
2513 | + $total = $total + $amount; |
|
2514 | 2514 | } |
2515 | 2515 | |
2516 | 2516 | $class3 = ''; |
2517 | - $name = "wpinv-items[{$item['id']}]"; |
|
2517 | + $name = "wpinv-items[{$item['id']}]"; |
|
2518 | 2518 | |
2519 | - if ( empty( $item['required'] ) ) { |
|
2519 | + if (empty($item['required'])) { |
|
2520 | 2520 | $totals_selected_select_item = 1; |
2521 | 2521 | } |
2522 | 2522 | |
@@ -2528,9 +2528,9 @@ discard block |
||
2528 | 2528 | |
2529 | 2529 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2530 | 2530 | <div class='row pl-2 pr-2 pt-2'> |
2531 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2531 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2532 | 2532 | |
2533 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2533 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2534 | 2534 | |
2535 | 2535 | <div class='col-2'> |
2536 | 2536 | <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> |
@@ -2538,11 +2538,11 @@ discard block |
||
2538 | 2538 | |
2539 | 2539 | <?php } else { ?> |
2540 | 2540 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2541 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2541 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2542 | 2542 | |
2543 | 2543 | <div class='col-4 <?php echo $class2; ?>'> |
2544 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2545 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2544 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2545 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2546 | 2546 | </div> |
2547 | 2547 | |
2548 | 2548 | <?php } else {?> |
@@ -2550,15 +2550,15 @@ discard block |
||
2550 | 2550 | <div class='col-4'> |
2551 | 2551 | <div class='input-group'> |
2552 | 2552 | |
2553 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2553 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2554 | 2554 | <div class='input-group-prepend'> |
2555 | 2555 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2556 | 2556 | </div> |
2557 | 2557 | <?php } ?> |
2558 | 2558 | |
2559 | - <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'] ); ?>'> |
|
2559 | + <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']); ?>'> |
|
2560 | 2560 | |
2561 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2561 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2562 | 2562 | <div class='input-group-append'> |
2563 | 2563 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2564 | 2564 | </div> |
@@ -2569,35 +2569,35 @@ discard block |
||
2569 | 2569 | <?php } ?> |
2570 | 2570 | |
2571 | 2571 | </div> |
2572 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2573 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2572 | + <?php if (!empty($item['description'])) { ?> |
|
2573 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2574 | 2574 | <?php } ?> |
2575 | 2575 | </div> |
2576 | 2576 | <?php } ?> |
2577 | 2577 | |
2578 | 2578 | <div class='mt-4 border-top item_totals_total p-2'> |
2579 | 2579 | |
2580 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
2580 | + <?php if (wpinv_use_taxes()) { ?> |
|
2581 | 2581 | <div class='row'> |
2582 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
2583 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
2582 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
2583 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
2584 | 2584 | </div> |
2585 | 2585 | <div class='row'> |
2586 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
2587 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
2586 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
2587 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
2588 | 2588 | </div> |
2589 | 2589 | <?php } ?> |
2590 | 2590 | |
2591 | 2591 | <div class='row'> |
2592 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2593 | - <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> |
|
2592 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2593 | + <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> |
|
2594 | 2594 | </div> |
2595 | 2595 | </div> |
2596 | 2596 | |
2597 | 2597 | </div> |
2598 | 2598 | <?php } ?> |
2599 | - <?php if ( ! empty( $field[ 'description' ] ) ) { ?> |
|
2600 | - <small class='form-text text-muted'><?php echo wp_kses_post( $field[ 'description' ] ); ?></small> |
|
2599 | + <?php if (!empty($field['description'])) { ?> |
|
2600 | + <small class='form-text text-muted'><?php echo wp_kses_post($field['description']); ?></small> |
|
2601 | 2601 | <?php } ?> |
2602 | 2602 | </div> |
2603 | 2603 | <?php |
@@ -2606,20 +2606,20 @@ discard block |
||
2606 | 2606 | /** |
2607 | 2607 | * Renders the items element template. |
2608 | 2608 | */ |
2609 | - public function edit_items_template( $field ) { |
|
2610 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
2611 | - $label = __( 'Let customers...', 'invoicing' ); |
|
2612 | - $label2 = __( 'Available Items', 'invoicing' ); |
|
2613 | - $label3 = esc_attr__( 'Add some help text for this element', 'invoicing' ); |
|
2609 | + public function edit_items_template($field) { |
|
2610 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
2611 | + $label = __('Let customers...', 'invoicing'); |
|
2612 | + $label2 = __('Available Items', 'invoicing'); |
|
2613 | + $label3 = esc_attr__('Add some help text for this element', 'invoicing'); |
|
2614 | 2614 | $id = $field . '.id + "_edit"'; |
2615 | 2615 | $id2 = $field . '.id + "_edit2"'; |
2616 | 2616 | $id3 = $field . '.id + "_edit3"'; |
2617 | 2617 | $id4 = $field . '.id + "_edit4"'; |
2618 | - $label4 = esc_attr__( 'This will be shown to the customer as the recommended price', 'invoicing' ); |
|
2619 | - $label5 = esc_attr__( 'Allow users to pay what they want', 'invoicing' ); |
|
2620 | - $label6 = esc_attr__( 'Enter the minimum price that a user can pay', 'invoicing' ); |
|
2621 | - $label7 = esc_attr__( 'Allow users to buy several quantities', 'invoicing' ); |
|
2622 | - $label8 = esc_attr__( 'This item is required', 'invoicing' ); |
|
2618 | + $label4 = esc_attr__('This will be shown to the customer as the recommended price', 'invoicing'); |
|
2619 | + $label5 = esc_attr__('Allow users to pay what they want', 'invoicing'); |
|
2620 | + $label6 = esc_attr__('Enter the minimum price that a user can pay', 'invoicing'); |
|
2621 | + $label7 = esc_attr__('Allow users to buy several quantities', 'invoicing'); |
|
2622 | + $label8 = esc_attr__('This item is required', 'invoicing'); |
|
2623 | 2623 | echo "<div $restrict> |
2624 | 2624 | |
2625 | 2625 | <label>$label2</label> |
@@ -2689,7 +2689,7 @@ discard block |
||
2689 | 2689 | <div class='form-group mt-2'> |
2690 | 2690 | |
2691 | 2691 | <select class='form-control custom-select' v-model='selected_item' @change='addSelectedItem'> |
2692 | - <option value=''>" . __( 'Add an existing item to the form', 'invoicing' ) ."</option> |
|
2692 | + <option value=''>" . __('Add an existing item to the form', 'invoicing') . "</option> |
|
2693 | 2693 | <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option> |
2694 | 2694 | </select> |
2695 | 2695 | |
@@ -2704,11 +2704,11 @@ discard block |
||
2704 | 2704 | <label :for='$id2'>$label</label> |
2705 | 2705 | |
2706 | 2706 | <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'> |
2707 | - <option value='total'>" . __( 'Buy all items on the list', 'invoicing' ) ."</option> |
|
2708 | - <option value='radio'>" . __( 'Select a single item from the list', 'invoicing' ) ."</option> |
|
2709 | - <option value='checkbox'>" . __( 'Select one or more items on the list', 'invoicing' ) ."</option> |
|
2710 | - <option value='select'>" . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option> |
|
2711 | - <option value='multi_select'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option> |
|
2707 | + <option value='total'>" . __('Buy all items on the list', 'invoicing') . "</option> |
|
2708 | + <option value='radio'>" . __('Select a single item from the list', 'invoicing') . "</option> |
|
2709 | + <option value='checkbox'>" . __('Select one or more items on the list', 'invoicing') . "</option> |
|
2710 | + <option value='select'>" . __('Select a single item from a dropdown', 'invoicing') . "</option> |
|
2711 | + <option value='multi_select'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option> |
|
2712 | 2712 | </select> |
2713 | 2713 | |
2714 | 2714 | </div> |
@@ -2733,7 +2733,7 @@ discard block |
||
2733 | 2733 | 'orderby' => 'title', |
2734 | 2734 | 'order' => 'ASC', |
2735 | 2735 | 'posts_per_page' => -1, |
2736 | - 'post_status' => array( 'publish' ), |
|
2736 | + 'post_status' => array('publish'), |
|
2737 | 2737 | 'meta_query' => array( |
2738 | 2738 | array( |
2739 | 2739 | 'key' => '_wpinv_type', |
@@ -2743,24 +2743,24 @@ discard block |
||
2743 | 2743 | ) |
2744 | 2744 | ); |
2745 | 2745 | |
2746 | - $items = get_posts( apply_filters( 'wpinv_payment_form_item_dropdown_query_args', $item_args ) ); |
|
2746 | + $items = get_posts(apply_filters('wpinv_payment_form_item_dropdown_query_args', $item_args)); |
|
2747 | 2747 | |
2748 | - if ( empty( $items ) ) { |
|
2748 | + if (empty($items)) { |
|
2749 | 2749 | return array(); |
2750 | 2750 | } |
2751 | 2751 | |
2752 | - $options = array(); |
|
2753 | - foreach ( $items as $item ) { |
|
2754 | - $title = esc_html( $item->post_title ); |
|
2755 | - $title .= wpinv_get_item_suffix( $item->ID, false ); |
|
2756 | - $id = absint( $item->ID ); |
|
2757 | - $price = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) ); |
|
2758 | - $recurring = (bool) get_post_meta( $id, '_wpinv_is_recurring', true ); |
|
2752 | + $options = array(); |
|
2753 | + foreach ($items as $item) { |
|
2754 | + $title = esc_html($item->post_title); |
|
2755 | + $title .= wpinv_get_item_suffix($item->ID, false); |
|
2756 | + $id = absint($item->ID); |
|
2757 | + $price = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true)); |
|
2758 | + $recurring = (bool) get_post_meta($id, '_wpinv_is_recurring', true); |
|
2759 | 2759 | $description = $item->post_excerpt; |
2760 | - $custom_price = (bool) get_post_meta( $id, '_wpinv_dynamic_pricing', true ); |
|
2761 | - $minimum_price = (float) get_post_meta( $id, '_minimum_price', true ); |
|
2760 | + $custom_price = (bool) get_post_meta($id, '_wpinv_dynamic_pricing', true); |
|
2761 | + $minimum_price = (float) get_post_meta($id, '_minimum_price', true); |
|
2762 | 2762 | $allow_quantities = false; |
2763 | - $options[] = compact( 'title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities' ); |
|
2763 | + $options[] = compact('title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities'); |
|
2764 | 2764 | |
2765 | 2765 | } |
2766 | 2766 | return $options; |
@@ -2770,47 +2770,47 @@ discard block |
||
2770 | 2770 | /** |
2771 | 2771 | * Returns an array of items for the currently being edited form. |
2772 | 2772 | */ |
2773 | - public function get_form_items( $id = false ) { |
|
2773 | + public function get_form_items($id = false) { |
|
2774 | 2774 | |
2775 | - if ( empty( $id ) ) { |
|
2776 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
2775 | + if (empty($id)) { |
|
2776 | + return wpinv_get_data('sample-payment-form-items'); |
|
2777 | 2777 | } |
2778 | 2778 | |
2779 | - $form_elements = get_post_meta( $id, 'wpinv_form_items', true ); |
|
2779 | + $form_elements = get_post_meta($id, 'wpinv_form_items', true); |
|
2780 | 2780 | |
2781 | - if ( is_array( $form_elements ) ) { |
|
2781 | + if (is_array($form_elements)) { |
|
2782 | 2782 | return $form_elements; |
2783 | 2783 | } |
2784 | 2784 | |
2785 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
2785 | + return wpinv_get_data('sample-payment-form-items'); |
|
2786 | 2786 | |
2787 | 2787 | } |
2788 | 2788 | |
2789 | 2789 | /** |
2790 | 2790 | * Returns an array of elements for the currently being edited form. |
2791 | 2791 | */ |
2792 | - public function get_form_elements( $id = false ) { |
|
2792 | + public function get_form_elements($id = false) { |
|
2793 | 2793 | |
2794 | - if ( empty( $id ) ) { |
|
2795 | - return wpinv_get_data( 'sample-payment-form' ); |
|
2794 | + if (empty($id)) { |
|
2795 | + return wpinv_get_data('sample-payment-form'); |
|
2796 | 2796 | } |
2797 | 2797 | |
2798 | - $form_elements = get_post_meta( $id, 'wpinv_form_elements', true ); |
|
2798 | + $form_elements = get_post_meta($id, 'wpinv_form_elements', true); |
|
2799 | 2799 | |
2800 | - if ( is_array( $form_elements ) ) { |
|
2800 | + if (is_array($form_elements)) { |
|
2801 | 2801 | return $form_elements; |
2802 | 2802 | } |
2803 | 2803 | |
2804 | - return wpinv_get_data( 'sample-payment-form' ); |
|
2804 | + return wpinv_get_data('sample-payment-form'); |
|
2805 | 2805 | } |
2806 | 2806 | |
2807 | 2807 | /** |
2808 | 2808 | * Sends a redrect response to payment details. |
2809 | 2809 | * |
2810 | 2810 | */ |
2811 | - public function send_redirect_response( $url ) { |
|
2812 | - $url = urlencode( $url ); |
|
2813 | - wp_send_json_success( $url ); |
|
2811 | + public function send_redirect_response($url) { |
|
2812 | + $url = urlencode($url); |
|
2813 | + wp_send_json_success($url); |
|
2814 | 2814 | } |
2815 | 2815 | |
2816 | 2816 | /** |
@@ -2821,12 +2821,12 @@ discard block |
||
2821 | 2821 | |
2822 | 2822 | $errors = wpinv_get_errors(); |
2823 | 2823 | |
2824 | - if ( ! empty( $errors ) ) { |
|
2824 | + if (!empty($errors)) { |
|
2825 | 2825 | wpinv_print_errors(); |
2826 | 2826 | exit; |
2827 | 2827 | } |
2828 | 2828 | |
2829 | - wp_send_json_error( __( 'An error occured while processing your payment. Please try again.', 'invoicing' ) ); |
|
2829 | + wp_send_json_error(__('An error occured while processing your payment. Please try again.', 'invoicing')); |
|
2830 | 2830 | exit; |
2831 | 2831 | |
2832 | 2832 | } |