@@ -7,49 +7,49 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span> |
|
23 | + <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span> |
|
24 | 24 | <input v-model='active_form_element.placeholder' class='form-control' type="text"/> |
25 | 25 | </label> |
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <div class='form-group'> |
29 | 29 | <label class="d-block"> |
30 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
31 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
32 | - <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small> |
|
30 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
31 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
32 | + <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small> |
|
33 | 33 | </label> |
34 | 34 | </div> |
35 | 35 | |
36 | 36 | <div class='form-group form-check'> |
37 | 37 | <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' /> |
38 | - <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label> |
|
38 | + <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label> |
|
39 | 39 | </div> |
40 | 40 | |
41 | 41 | <div class='form-group form-check'> |
42 | 42 | <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' /> |
43 | - <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label> |
|
43 | + <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label> |
|
44 | 44 | </div> |
45 | 45 | |
46 | 46 | <hr class='featurette-divider mt-4'> |
47 | 47 | |
48 | 48 | <div class='form-group'> |
49 | 49 | <label class="d-block"> |
50 | - <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span> |
|
50 | + <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span> |
|
51 | 51 | <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" /> |
52 | - <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span> |
|
52 | + <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span> |
|
53 | 53 | </label> |
54 | 54 | </div> |
55 | 55 |
@@ -7,31 +7,31 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
24 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
25 | - <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small> |
|
23 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
24 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
25 | + <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small> |
|
26 | 26 | </label> |
27 | 27 | </div> |
28 | 28 | |
29 | 29 | <div class='form-group form-check'> |
30 | 30 | <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' /> |
31 | - <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label> |
|
31 | + <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label> |
|
32 | 32 | </div> |
33 | 33 | |
34 | 34 | <div class='form-group form-check'> |
35 | 35 | <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' /> |
36 | - <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label> |
|
36 | + <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label> |
|
37 | 37 | </div> |
@@ -7,42 +7,42 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
24 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
25 | - <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small> |
|
23 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
24 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
25 | + <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small> |
|
26 | 26 | </label> |
27 | 27 | </div> |
28 | 28 | |
29 | 29 | <div class='form-group form-check'> |
30 | 30 | <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' /> |
31 | - <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label> |
|
31 | + <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label> |
|
32 | 32 | </div> |
33 | 33 | |
34 | 34 | <div class='form-group form-check'> |
35 | 35 | <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' /> |
36 | - <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label> |
|
36 | + <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label> |
|
37 | 37 | </div> |
38 | 38 | |
39 | 39 | <hr class='featurette-divider mt-4'> |
40 | 40 | |
41 | 41 | <div class='form-group'> |
42 | 42 | <label class="d-block"> |
43 | - <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span> |
|
43 | + <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span> |
|
44 | 44 | <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" /> |
45 | - <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span> |
|
45 | + <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span> |
|
46 | 46 | </label> |
47 | 47 | </div> |
48 | 48 |
@@ -7,54 +7,54 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span> |
|
23 | + <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span> |
|
24 | 24 | <input v-model='active_form_element.placeholder' class='form-control' type="text"/> |
25 | 25 | </label> |
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <div class='form-group'> |
29 | 29 | <label class="d-block"> |
30 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
31 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
32 | - <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small> |
|
30 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
31 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
32 | + <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small> |
|
33 | 33 | </label> |
34 | 34 | </div> |
35 | 35 | |
36 | 36 | <div class='form-group form-check'> |
37 | 37 | <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' /> |
38 | - <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label> |
|
38 | + <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label> |
|
39 | 39 | </div> |
40 | 40 | |
41 | 41 | <div class='form-group form-check'> |
42 | 42 | <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' /> |
43 | - <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label> |
|
43 | + <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label> |
|
44 | 44 | </div> |
45 | 45 | |
46 | 46 | <div class='form-group form-check'> |
47 | 47 | <input :id="active_form_element.id + '_edit_default_current'" v-model='active_form_element.default_current_post' type='checkbox' class='form-check-input' /> |
48 | - <label class='form-check-label' :for="active_form_element.id + '_edit_default_current'"><?php esc_html_e( 'Default to the current page\'s URL?', 'invoicing' ); ?></label> |
|
48 | + <label class='form-check-label' :for="active_form_element.id + '_edit_default_current'"><?php esc_html_e('Default to the current page\'s URL?', 'invoicing'); ?></label> |
|
49 | 49 | </div> |
50 | 50 | |
51 | 51 | <hr class='featurette-divider mt-4'> |
52 | 52 | |
53 | 53 | <div class='form-group'> |
54 | 54 | <label class="d-block"> |
55 | - <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span> |
|
55 | + <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span> |
|
56 | 56 | <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" /> |
57 | - <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span> |
|
57 | + <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span> |
|
58 | 58 | </label> |
59 | 59 | </div> |
60 | 60 |
@@ -7,48 +7,48 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
24 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
25 | - <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small> |
|
23 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
24 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
25 | + <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small> |
|
26 | 26 | </label> |
27 | 27 | </div> |
28 | 28 | |
29 | 29 | <div class='form-group form-check'> |
30 | 30 | <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' /> |
31 | - <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label> |
|
31 | + <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label> |
|
32 | 32 | </div> |
33 | 33 | |
34 | 34 | <div class='form-group form-check'> |
35 | 35 | <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' /> |
36 | - <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label> |
|
36 | + <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label> |
|
37 | 37 | </div> |
38 | 38 | |
39 | 39 | <hr class='featurette-divider mt-4'> |
40 | 40 | |
41 | 41 | <div class='form-group'> |
42 | 42 | <label class="d-block"> |
43 | - <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span> |
|
43 | + <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span> |
|
44 | 44 | <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" /> |
45 | - <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span> |
|
45 | + <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span> |
|
46 | 46 | </label> |
47 | 47 | </div> |
48 | 48 | |
49 | 49 | <hr class='featurette-divider mt-4'> |
50 | 50 | |
51 | -<h5><?php esc_html_e( 'Available Options', 'invoicing' ); ?></h5> |
|
51 | +<h5><?php esc_html_e('Available Options', 'invoicing'); ?></h5> |
|
52 | 52 | |
53 | 53 | <div class='form-group input-group' v-for='(option, index) in active_form_element.options'> |
54 | 54 | <input type='text' class='form-control' v-model='active_form_element.options[index]'> |
@@ -58,5 +58,5 @@ discard block |
||
58 | 58 | </div> |
59 | 59 | |
60 | 60 | <div class='form-group'> |
61 | - <button class='button button-secondary' type='button' @click.prevent='active_form_element.options.push("")'><?php esc_html_e( 'Add Option', 'invoicing' ); ?></button> |
|
61 | + <button class='button button-secondary' type='button' @click.prevent='active_form_element.options.push("")'><?php esc_html_e('Add Option', 'invoicing'); ?></button> |
|
62 | 62 | </div> |
@@ -7,55 +7,55 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span> |
|
23 | + <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span> |
|
24 | 24 | <input v-model='active_form_element.placeholder' class='form-control' type="text"/> |
25 | 25 | </label> |
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <div class='form-group'> |
29 | 29 | <label class="d-block"> |
30 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
31 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
32 | - <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small> |
|
30 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
31 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
32 | + <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small> |
|
33 | 33 | </label> |
34 | 34 | </div> |
35 | 35 | |
36 | 36 | <div class='form-group form-check'> |
37 | 37 | <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' /> |
38 | - <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label> |
|
38 | + <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label> |
|
39 | 39 | </div> |
40 | 40 | |
41 | 41 | <div class='form-group form-check'> |
42 | 42 | <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' /> |
43 | - <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label> |
|
43 | + <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label> |
|
44 | 44 | </div> |
45 | 45 | |
46 | 46 | <hr class='featurette-divider mt-4'> |
47 | 47 | |
48 | 48 | <div class='form-group'> |
49 | 49 | <label class="d-block"> |
50 | - <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span> |
|
50 | + <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span> |
|
51 | 51 | <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" /> |
52 | - <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span> |
|
52 | + <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span> |
|
53 | 53 | </label> |
54 | 54 | </div> |
55 | 55 | |
56 | 56 | <hr class='featurette-divider mt-4'> |
57 | 57 | |
58 | -<h5><?php esc_html_e( 'Available Options', 'invoicing' ); ?></h5> |
|
58 | +<h5><?php esc_html_e('Available Options', 'invoicing'); ?></h5> |
|
59 | 59 | |
60 | 60 | <div class='form-group input-group' v-for='(option, index) in active_form_element.options'> |
61 | 61 | <input type='text' class='form-control' v-model='active_form_element.options[index]'> |
@@ -65,5 +65,5 @@ discard block |
||
65 | 65 | </div> |
66 | 66 | |
67 | 67 | <div class='form-group'> |
68 | - <button class='button button-secondary' type='button' @click.prevent='active_form_element.options.push("")'><?php esc_html_e( 'Add Option', 'invoicing' ); ?></button> |
|
68 | + <button class='button button-secondary' type='button' @click.prevent='active_form_element.options.push("")'><?php esc_html_e('Add Option', 'invoicing'); ?></button> |
|
69 | 69 | </div> |
@@ -12,180 +12,180 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class GetPaid_Checkout { |
14 | 14 | |
15 | - /** |
|
16 | - * @var GetPaid_Payment_Form_Submission |
|
17 | - */ |
|
18 | - protected $payment_form_submission; |
|
19 | - |
|
20 | - /** |
|
21 | - * Class constructor. |
|
22 | - * |
|
23 | - * @param GetPaid_Payment_Form_Submission $submission |
|
24 | - */ |
|
25 | - public function __construct( $submission ) { |
|
26 | - $this->payment_form_submission = $submission; |
|
27 | - } |
|
28 | - |
|
29 | - /** |
|
30 | - * Processes the checkout. |
|
31 | - * |
|
32 | - */ |
|
33 | - public function process_checkout() { |
|
34 | - |
|
35 | - // Validate the submission. |
|
36 | - $this->validate_submission(); |
|
37 | - |
|
38 | - // Prepare the invoice. |
|
39 | - $items = $this->get_submission_items(); |
|
40 | - $invoice = $this->get_submission_invoice(); |
|
41 | - $invoice = $this->process_submission_invoice( $invoice, $items ); |
|
42 | - $prepared = $this->prepare_submission_data_for_saving(); |
|
43 | - |
|
44 | - $this->prepare_billing_info( $invoice ); |
|
45 | - |
|
46 | - $shipping = $this->prepare_shipping_info( $invoice ); |
|
47 | - |
|
48 | - // Save the invoice. |
|
49 | - $invoice->set_is_viewed( true ); |
|
50 | - $invoice->recalculate_total(); |
|
15 | + /** |
|
16 | + * @var GetPaid_Payment_Form_Submission |
|
17 | + */ |
|
18 | + protected $payment_form_submission; |
|
19 | + |
|
20 | + /** |
|
21 | + * Class constructor. |
|
22 | + * |
|
23 | + * @param GetPaid_Payment_Form_Submission $submission |
|
24 | + */ |
|
25 | + public function __construct( $submission ) { |
|
26 | + $this->payment_form_submission = $submission; |
|
27 | + } |
|
28 | + |
|
29 | + /** |
|
30 | + * Processes the checkout. |
|
31 | + * |
|
32 | + */ |
|
33 | + public function process_checkout() { |
|
34 | + |
|
35 | + // Validate the submission. |
|
36 | + $this->validate_submission(); |
|
37 | + |
|
38 | + // Prepare the invoice. |
|
39 | + $items = $this->get_submission_items(); |
|
40 | + $invoice = $this->get_submission_invoice(); |
|
41 | + $invoice = $this->process_submission_invoice( $invoice, $items ); |
|
42 | + $prepared = $this->prepare_submission_data_for_saving(); |
|
43 | + |
|
44 | + $this->prepare_billing_info( $invoice ); |
|
45 | + |
|
46 | + $shipping = $this->prepare_shipping_info( $invoice ); |
|
47 | + |
|
48 | + // Save the invoice. |
|
49 | + $invoice->set_is_viewed( true ); |
|
50 | + $invoice->recalculate_total(); |
|
51 | 51 | $invoice->save(); |
52 | 52 | |
53 | - do_action( 'getpaid_checkout_invoice_updated', $invoice ); |
|
53 | + do_action( 'getpaid_checkout_invoice_updated', $invoice ); |
|
54 | 54 | |
55 | - // Send to the gateway. |
|
56 | - $this->post_process_submission( $invoice, $prepared, $shipping ); |
|
57 | - } |
|
55 | + // Send to the gateway. |
|
56 | + $this->post_process_submission( $invoice, $prepared, $shipping ); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Validates the submission. |
|
61 | - * |
|
62 | - */ |
|
63 | - protected function validate_submission() { |
|
59 | + /** |
|
60 | + * Validates the submission. |
|
61 | + * |
|
62 | + */ |
|
63 | + protected function validate_submission() { |
|
64 | 64 | |
65 | - $submission = $this->payment_form_submission; |
|
66 | - $data = $submission->get_data(); |
|
65 | + $submission = $this->payment_form_submission; |
|
66 | + $data = $submission->get_data(); |
|
67 | 67 | |
68 | - // Do we have an error? |
|
68 | + // Do we have an error? |
|
69 | 69 | if ( ! empty( $submission->last_error ) ) { |
70 | - wp_send_json_error( $submission->last_error ); |
|
70 | + wp_send_json_error( $submission->last_error ); |
|
71 | 71 | } |
72 | 72 | |
73 | - // We need a billing email. |
|
73 | + // We need a billing email. |
|
74 | 74 | if ( ! $submission->has_billing_email() ) { |
75 | 75 | wp_send_json_error( __( 'Provide a valid billing email.', 'invoicing' ) ); |
76 | - } |
|
76 | + } |
|
77 | 77 | |
78 | - // Non-recurring gateways should not be allowed to process recurring invoices. |
|
79 | - if ( $submission->should_collect_payment_details() && $submission->has_recurring && ! wpinv_gateway_support_subscription( $data['wpi-gateway'] ) ) { |
|
80 | - wp_send_json_error( __( 'The selected payment gateway does not support subscription payments.', 'invoicing' ) ); |
|
81 | - } |
|
78 | + // Non-recurring gateways should not be allowed to process recurring invoices. |
|
79 | + if ( $submission->should_collect_payment_details() && $submission->has_recurring && ! wpinv_gateway_support_subscription( $data['wpi-gateway'] ) ) { |
|
80 | + wp_send_json_error( __( 'The selected payment gateway does not support subscription payments.', 'invoicing' ) ); |
|
81 | + } |
|
82 | 82 | |
83 | - // Ensure the gateway is active. |
|
84 | - if ( $submission->should_collect_payment_details() && ! wpinv_is_gateway_active( $data['wpi-gateway'] ) ) { |
|
85 | - wpinv_set_error( 'invalid_gateway', __( 'The selected payment gateway is not active', 'invoicing' ) ); |
|
86 | - } |
|
83 | + // Ensure the gateway is active. |
|
84 | + if ( $submission->should_collect_payment_details() && ! wpinv_is_gateway_active( $data['wpi-gateway'] ) ) { |
|
85 | + wpinv_set_error( 'invalid_gateway', __( 'The selected payment gateway is not active', 'invoicing' ) ); |
|
86 | + } |
|
87 | 87 | |
88 | - // Clear any existing errors. |
|
89 | - wpinv_clear_errors(); |
|
88 | + // Clear any existing errors. |
|
89 | + wpinv_clear_errors(); |
|
90 | 90 | |
91 | - // Allow themes and plugins to hook to errors |
|
92 | - do_action( 'getpaid_checkout_error_checks', $submission ); |
|
91 | + // Allow themes and plugins to hook to errors |
|
92 | + do_action( 'getpaid_checkout_error_checks', $submission ); |
|
93 | 93 | |
94 | - // Do we have any errors? |
|
94 | + // Do we have any errors? |
|
95 | 95 | if ( wpinv_get_errors() ) { |
96 | 96 | wp_send_json_error( getpaid_get_errors_html() ); |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Retrieves submission items. |
|
103 | - * |
|
104 | - * @return GetPaid_Form_Item[] |
|
105 | - */ |
|
106 | - protected function get_submission_items() { |
|
101 | + /** |
|
102 | + * Retrieves submission items. |
|
103 | + * |
|
104 | + * @return GetPaid_Form_Item[] |
|
105 | + */ |
|
106 | + protected function get_submission_items() { |
|
107 | 107 | |
108 | - $items = $this->payment_form_submission->get_items(); |
|
108 | + $items = $this->payment_form_submission->get_items(); |
|
109 | 109 | |
110 | 110 | // Ensure that we have items. |
111 | 111 | if ( empty( $items ) && ! $this->payment_form_submission->has_fees() ) { |
112 | 112 | wp_send_json_error( __( 'Please provide at least one item or amount.', 'invoicing' ) ); |
113 | - } |
|
114 | - |
|
115 | - return $items; |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * Retrieves submission invoice. |
|
120 | - * |
|
121 | - * @return WPInv_Invoice |
|
122 | - */ |
|
123 | - protected function get_submission_invoice() { |
|
124 | - $submission = $this->payment_form_submission; |
|
125 | - |
|
126 | - if ( ! $submission->has_invoice() ) { |
|
127 | - $invoice = new WPInv_Invoice(); |
|
128 | - $invoice->set_created_via( 'payment_form' ); |
|
129 | - return $invoice; |
|
130 | 113 | } |
131 | 114 | |
132 | - $invoice = $submission->get_invoice(); |
|
115 | + return $items; |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * Retrieves submission invoice. |
|
120 | + * |
|
121 | + * @return WPInv_Invoice |
|
122 | + */ |
|
123 | + protected function get_submission_invoice() { |
|
124 | + $submission = $this->payment_form_submission; |
|
125 | + |
|
126 | + if ( ! $submission->has_invoice() ) { |
|
127 | + $invoice = new WPInv_Invoice(); |
|
128 | + $invoice->set_created_via( 'payment_form' ); |
|
129 | + return $invoice; |
|
130 | + } |
|
131 | + |
|
132 | + $invoice = $submission->get_invoice(); |
|
133 | 133 | |
134 | - // Make sure that it is neither paid or refunded. |
|
135 | - if ( $invoice->is_paid() || $invoice->is_refunded() ) { |
|
136 | - wp_send_json_error( __( 'This invoice has already been paid for.', 'invoicing' ) ); |
|
137 | - } |
|
134 | + // Make sure that it is neither paid or refunded. |
|
135 | + if ( $invoice->is_paid() || $invoice->is_refunded() ) { |
|
136 | + wp_send_json_error( __( 'This invoice has already been paid for.', 'invoicing' ) ); |
|
137 | + } |
|
138 | 138 | |
139 | - return $invoice; |
|
140 | - } |
|
139 | + return $invoice; |
|
140 | + } |
|
141 | 141 | |
142 | - /** |
|
143 | - * Processes the submission invoice. |
|
144 | - * |
|
145 | - * @param WPInv_Invoice $invoice |
|
146 | - * @param GetPaid_Form_Item[] $items |
|
147 | - * @return WPInv_Invoice |
|
148 | - */ |
|
149 | - protected function process_submission_invoice( $invoice, $items ) { |
|
142 | + /** |
|
143 | + * Processes the submission invoice. |
|
144 | + * |
|
145 | + * @param WPInv_Invoice $invoice |
|
146 | + * @param GetPaid_Form_Item[] $items |
|
147 | + * @return WPInv_Invoice |
|
148 | + */ |
|
149 | + protected function process_submission_invoice( $invoice, $items ) { |
|
150 | 150 | |
151 | - $submission = $this->payment_form_submission; |
|
152 | - $data = $submission->get_data(); |
|
151 | + $submission = $this->payment_form_submission; |
|
152 | + $data = $submission->get_data(); |
|
153 | 153 | |
154 | - // Set-up the invoice details. |
|
155 | - $invoice->set_email( sanitize_email( $submission->get_billing_email() ) ); |
|
156 | - $invoice->set_user_id( $this->get_submission_customer() ); |
|
157 | - $invoice->set_payment_form( absint( $submission->get_payment_form()->get_id() ) ); |
|
154 | + // Set-up the invoice details. |
|
155 | + $invoice->set_email( sanitize_email( $submission->get_billing_email() ) ); |
|
156 | + $invoice->set_user_id( $this->get_submission_customer() ); |
|
157 | + $invoice->set_payment_form( absint( $submission->get_payment_form()->get_id() ) ); |
|
158 | 158 | $invoice->set_items( $items ); |
159 | 159 | $invoice->set_fees( $submission->get_fees() ); |
160 | 160 | $invoice->set_taxes( $submission->get_taxes() ); |
161 | - $invoice->set_discounts( $submission->get_discounts() ); |
|
162 | - $invoice->set_gateway( $data['wpi-gateway'] ); |
|
161 | + $invoice->set_discounts( $submission->get_discounts() ); |
|
162 | + $invoice->set_gateway( $data['wpi-gateway'] ); |
|
163 | 163 | |
164 | - $address_confirmed = $submission->get_field( 'confirm-address' ); |
|
165 | - $invoice->set_address_confirmed( ! empty( $address_confirmed ) ); |
|
164 | + $address_confirmed = $submission->get_field( 'confirm-address' ); |
|
165 | + $invoice->set_address_confirmed( ! empty( $address_confirmed ) ); |
|
166 | 166 | |
167 | - if ( $submission->has_discount_code() ) { |
|
167 | + if ( $submission->has_discount_code() ) { |
|
168 | 168 | $invoice->set_discount_code( $submission->get_discount_code() ); |
169 | - } |
|
170 | - |
|
171 | - getpaid_maybe_add_default_address( $invoice ); |
|
172 | - return $invoice; |
|
173 | - } |
|
174 | - |
|
175 | - /** |
|
176 | - * Retrieves the submission's customer. |
|
177 | - * |
|
178 | - * @return int The customer id. |
|
179 | - */ |
|
180 | - protected function get_submission_customer() { |
|
181 | - $submission = $this->payment_form_submission; |
|
182 | - |
|
183 | - // If this is an existing invoice... |
|
184 | - if ( $submission->has_invoice() ) { |
|
185 | - return $submission->get_invoice()->get_user_id(); |
|
186 | - } |
|
187 | - |
|
188 | - // (Maybe) create the user. |
|
169 | + } |
|
170 | + |
|
171 | + getpaid_maybe_add_default_address( $invoice ); |
|
172 | + return $invoice; |
|
173 | + } |
|
174 | + |
|
175 | + /** |
|
176 | + * Retrieves the submission's customer. |
|
177 | + * |
|
178 | + * @return int The customer id. |
|
179 | + */ |
|
180 | + protected function get_submission_customer() { |
|
181 | + $submission = $this->payment_form_submission; |
|
182 | + |
|
183 | + // If this is an existing invoice... |
|
184 | + if ( $submission->has_invoice() ) { |
|
185 | + return $submission->get_invoice()->get_user_id(); |
|
186 | + } |
|
187 | + |
|
188 | + // (Maybe) create the user. |
|
189 | 189 | $user = get_current_user_id(); |
190 | 190 | |
191 | 191 | if ( empty( $user ) ) { |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | if ( empty( $user ) ) { |
196 | 196 | $user = wpinv_create_user( $submission->get_billing_email() ); |
197 | 197 | |
198 | - // (Maybe) send new user notification. |
|
199 | - $should_send_notification = wpinv_get_option( 'disable_new_user_emails' ); |
|
200 | - if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', empty( $should_send_notification ), $user ) ) { |
|
201 | - wp_send_new_user_notifications( $user, 'user' ); |
|
202 | - } |
|
198 | + // (Maybe) send new user notification. |
|
199 | + $should_send_notification = wpinv_get_option( 'disable_new_user_emails' ); |
|
200 | + if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', empty( $should_send_notification ), $user ) ) { |
|
201 | + wp_send_new_user_notifications( $user, 'user' ); |
|
202 | + } |
|
203 | 203 | |
204 | 204 | } |
205 | 205 | |
@@ -209,34 +209,34 @@ discard block |
||
209 | 209 | |
210 | 210 | if ( is_numeric( $user ) ) { |
211 | 211 | return $user; |
212 | - } |
|
212 | + } |
|
213 | 213 | |
214 | - return $user->ID; |
|
214 | + return $user->ID; |
|
215 | 215 | |
216 | - } |
|
216 | + } |
|
217 | 217 | |
218 | - /** |
|
218 | + /** |
|
219 | 219 | * Prepares submission data for saving to the database. |
220 | 220 | * |
221 | - * @return array |
|
221 | + * @return array |
|
222 | 222 | */ |
223 | 223 | public function prepare_submission_data_for_saving() { |
224 | 224 | |
225 | - $submission = $this->payment_form_submission; |
|
225 | + $submission = $this->payment_form_submission; |
|
226 | 226 | |
227 | - // Prepared submission details. |
|
227 | + // Prepared submission details. |
|
228 | 228 | $prepared = array( |
229 | - 'all' => array(), |
|
230 | - 'meta' => array(), |
|
231 | - ); |
|
229 | + 'all' => array(), |
|
230 | + 'meta' => array(), |
|
231 | + ); |
|
232 | 232 | |
233 | 233 | // Raw submission details. |
234 | - $data = $submission->get_data(); |
|
234 | + $data = $submission->get_data(); |
|
235 | 235 | |
236 | - // Loop through the submitted details. |
|
236 | + // Loop through the submitted details. |
|
237 | 237 | foreach ( $submission->get_payment_form()->get_elements() as $field ) { |
238 | 238 | |
239 | - // Skip premade fields. |
|
239 | + // Skip premade fields. |
|
240 | 240 | if ( ! empty( $field['premade'] ) || $field['type'] == 'address' ) { |
241 | 241 | continue; |
242 | 242 | } |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | // Handle misc fields. |
250 | 250 | if ( isset( $data[ $field['id'] ] ) ) { |
251 | 251 | |
252 | - if ( $field['type'] == 'checkbox' ) { |
|
253 | - $value = isset( $data[ $field['id'] ] ) ? __( 'Yes', 'invoicing' ) : __( 'No', 'invoicing' ); |
|
254 | - } else { |
|
255 | - $value = wp_kses_post( $data[ $field['id'] ] ); |
|
256 | - } |
|
252 | + if ( $field['type'] == 'checkbox' ) { |
|
253 | + $value = isset( $data[ $field['id'] ] ) ? __( 'Yes', 'invoicing' ) : __( 'No', 'invoicing' ); |
|
254 | + } else { |
|
255 | + $value = wp_kses_post( $data[ $field['id'] ] ); |
|
256 | + } |
|
257 | 257 | |
258 | 258 | $label = $field['id']; |
259 | 259 | |
@@ -261,189 +261,189 @@ discard block |
||
261 | 261 | $label = $field['label']; |
262 | 262 | } |
263 | 263 | |
264 | - if ( ! empty( $field['add_meta'] ) ) { |
|
265 | - $prepared['meta'][ wpinv_clean( $label ) ] = $value; |
|
266 | - } |
|
267 | - $prepared['all'][ wpinv_clean( $label ) ] = $value; |
|
264 | + if ( ! empty( $field['add_meta'] ) ) { |
|
265 | + $prepared['meta'][ wpinv_clean( $label ) ] = $value; |
|
266 | + } |
|
267 | + $prepared['all'][ wpinv_clean( $label ) ] = $value; |
|
268 | 268 | |
269 | 269 | } |
270 | 270 | |
271 | - } |
|
271 | + } |
|
272 | 272 | |
273 | - return $prepared; |
|
273 | + return $prepared; |
|
274 | 274 | |
275 | - } |
|
275 | + } |
|
276 | 276 | |
277 | - /** |
|
277 | + /** |
|
278 | 278 | * Retrieves address details. |
279 | 279 | * |
280 | - * @return array |
|
281 | - * @param WPInv_Invoice $invoice |
|
282 | - * @param string $type |
|
280 | + * @return array |
|
281 | + * @param WPInv_Invoice $invoice |
|
282 | + * @param string $type |
|
283 | 283 | */ |
284 | 284 | public function prepare_address_details( $invoice, $type = 'billing' ) { |
285 | 285 | |
286 | - $data = $this->payment_form_submission->get_data(); |
|
287 | - $type = sanitize_key( $type ); |
|
288 | - $address = array(); |
|
289 | - $prepared = array(); |
|
286 | + $data = $this->payment_form_submission->get_data(); |
|
287 | + $type = sanitize_key( $type ); |
|
288 | + $address = array(); |
|
289 | + $prepared = array(); |
|
290 | 290 | |
291 | - if ( ! empty( $data[ $type ] ) ) { |
|
292 | - $address = $data[ $type ]; |
|
293 | - } |
|
291 | + if ( ! empty( $data[ $type ] ) ) { |
|
292 | + $address = $data[ $type ]; |
|
293 | + } |
|
294 | 294 | |
295 | - // Clean address details. |
|
296 | - foreach ( $address as $key => $value ) { |
|
297 | - $key = sanitize_key( $key ); |
|
298 | - $key = str_replace( 'wpinv_', '', $key ); |
|
299 | - $value = wpinv_clean( $value ); |
|
300 | - $prepared[ $key] = apply_filters( "getpaid_checkout_{$type}_address_$key", $value, $this->payment_form_submission, $invoice ); |
|
301 | - } |
|
295 | + // Clean address details. |
|
296 | + foreach ( $address as $key => $value ) { |
|
297 | + $key = sanitize_key( $key ); |
|
298 | + $key = str_replace( 'wpinv_', '', $key ); |
|
299 | + $value = wpinv_clean( $value ); |
|
300 | + $prepared[ $key] = apply_filters( "getpaid_checkout_{$type}_address_$key", $value, $this->payment_form_submission, $invoice ); |
|
301 | + } |
|
302 | 302 | |
303 | - // Filter address details. |
|
304 | - $prepared = apply_filters( "getpaid_checkout_{$type}_address", $prepared, $this->payment_form_submission, $invoice ); |
|
303 | + // Filter address details. |
|
304 | + $prepared = apply_filters( "getpaid_checkout_{$type}_address", $prepared, $this->payment_form_submission, $invoice ); |
|
305 | 305 | |
306 | - // Remove non-whitelisted values. |
|
307 | - return array_filter( $prepared, 'getpaid_is_address_field_whitelisted', ARRAY_FILTER_USE_KEY ); |
|
306 | + // Remove non-whitelisted values. |
|
307 | + return array_filter( $prepared, 'getpaid_is_address_field_whitelisted', ARRAY_FILTER_USE_KEY ); |
|
308 | 308 | |
309 | - } |
|
309 | + } |
|
310 | 310 | |
311 | - /** |
|
311 | + /** |
|
312 | 312 | * Prepares the billing details. |
313 | 313 | * |
314 | - * @return array |
|
315 | - * @param WPInv_Invoice $invoice |
|
314 | + * @return array |
|
315 | + * @param WPInv_Invoice $invoice |
|
316 | 316 | */ |
317 | 317 | protected function prepare_billing_info( &$invoice ) { |
318 | 318 | |
319 | - $billing_address = $this->prepare_address_details( $invoice, 'billing' ); |
|
319 | + $billing_address = $this->prepare_address_details( $invoice, 'billing' ); |
|
320 | 320 | |
321 | - // Update the invoice with the billing details. |
|
322 | - $invoice->set_props( $billing_address ); |
|
321 | + // Update the invoice with the billing details. |
|
322 | + $invoice->set_props( $billing_address ); |
|
323 | 323 | |
324 | - } |
|
324 | + } |
|
325 | 325 | |
326 | - /** |
|
326 | + /** |
|
327 | 327 | * Prepares the shipping details. |
328 | 328 | * |
329 | - * @return array |
|
330 | - * @param WPInv_Invoice $invoice |
|
329 | + * @return array |
|
330 | + * @param WPInv_Invoice $invoice |
|
331 | 331 | */ |
332 | 332 | protected function prepare_shipping_info( $invoice ) { |
333 | 333 | |
334 | - $data = $this->payment_form_submission->get_data(); |
|
334 | + $data = $this->payment_form_submission->get_data(); |
|
335 | 335 | |
336 | - if ( empty( $data['same-shipping-address'] ) ) { |
|
337 | - return $this->prepare_address_details( $invoice, 'shipping' ); |
|
338 | - } |
|
336 | + if ( empty( $data['same-shipping-address'] ) ) { |
|
337 | + return $this->prepare_address_details( $invoice, 'shipping' ); |
|
338 | + } |
|
339 | 339 | |
340 | - return $this->prepare_address_details( $invoice, 'billing' ); |
|
340 | + return $this->prepare_address_details( $invoice, 'billing' ); |
|
341 | 341 | |
342 | - } |
|
342 | + } |
|
343 | 343 | |
344 | - /** |
|
345 | - * Confirms the submission is valid and send users to the gateway. |
|
346 | - * |
|
347 | - * @param WPInv_Invoice $invoice |
|
348 | - * @param array $prepared_payment_form_data |
|
349 | - * @param array $shipping |
|
350 | - */ |
|
351 | - protected function post_process_submission( $invoice, $prepared_payment_form_data, $shipping ) { |
|
344 | + /** |
|
345 | + * Confirms the submission is valid and send users to the gateway. |
|
346 | + * |
|
347 | + * @param WPInv_Invoice $invoice |
|
348 | + * @param array $prepared_payment_form_data |
|
349 | + * @param array $shipping |
|
350 | + */ |
|
351 | + protected function post_process_submission( $invoice, $prepared_payment_form_data, $shipping ) { |
|
352 | 352 | |
353 | - // Ensure the invoice exists. |
|
353 | + // Ensure the invoice exists. |
|
354 | 354 | if ( ! $invoice->exists() ) { |
355 | 355 | wp_send_json_error( __( 'An error occured while saving your invoice. Please try again.', 'invoicing' ) ); |
356 | 356 | } |
357 | 357 | |
358 | - // Save payment form data. |
|
359 | - $prepared_payment_form_data = apply_filters( 'getpaid_prepared_payment_form_data', $prepared_payment_form_data, $invoice ); |
|
358 | + // Save payment form data. |
|
359 | + $prepared_payment_form_data = apply_filters( 'getpaid_prepared_payment_form_data', $prepared_payment_form_data, $invoice ); |
|
360 | 360 | delete_post_meta( $invoice->get_id(), 'payment_form_data' ); |
361 | - delete_post_meta( $invoice->get_id(), 'additional_meta_data' ); |
|
362 | - if ( ! empty( $prepared_payment_form_data ) ) { |
|
361 | + delete_post_meta( $invoice->get_id(), 'additional_meta_data' ); |
|
362 | + if ( ! empty( $prepared_payment_form_data ) ) { |
|
363 | 363 | |
364 | - if ( ! empty( $prepared_payment_form_data['all'] ) ) { |
|
365 | - update_post_meta( $invoice->get_id(), 'payment_form_data', $prepared_payment_form_data['all'] ); |
|
366 | - } |
|
364 | + if ( ! empty( $prepared_payment_form_data['all'] ) ) { |
|
365 | + update_post_meta( $invoice->get_id(), 'payment_form_data', $prepared_payment_form_data['all'] ); |
|
366 | + } |
|
367 | 367 | |
368 | - if ( ! empty( $prepared_payment_form_data['meta'] ) ) { |
|
369 | - update_post_meta( $invoice->get_id(), 'additional_meta_data', $prepared_payment_form_data['meta'] ); |
|
370 | - } |
|
368 | + if ( ! empty( $prepared_payment_form_data['meta'] ) ) { |
|
369 | + update_post_meta( $invoice->get_id(), 'additional_meta_data', $prepared_payment_form_data['meta'] ); |
|
370 | + } |
|
371 | 371 | |
372 | - } |
|
372 | + } |
|
373 | 373 | |
374 | - // Save payment form data. |
|
374 | + // Save payment form data. |
|
375 | 375 | if ( ! empty( $shipping ) ) { |
376 | 376 | update_post_meta( $invoice->get_id(), 'shipping_address', $shipping ); |
377 | - } |
|
377 | + } |
|
378 | 378 | |
379 | - // Backwards compatibility. |
|
379 | + // Backwards compatibility. |
|
380 | 380 | add_filter( 'wp_redirect', array( $this, 'send_redirect_response' ) ); |
381 | 381 | |
382 | - $this->process_payment( $invoice ); |
|
382 | + $this->process_payment( $invoice ); |
|
383 | 383 | |
384 | 384 | // If we are here, there was an error. |
385 | - wpinv_send_back_to_checkout( $invoice ); |
|
385 | + wpinv_send_back_to_checkout( $invoice ); |
|
386 | 386 | |
387 | - } |
|
387 | + } |
|
388 | 388 | |
389 | - /** |
|
390 | - * Processes the actual payment. |
|
391 | - * |
|
392 | - * @param WPInv_Invoice $invoice |
|
393 | - */ |
|
394 | - protected function process_payment( $invoice ) { |
|
389 | + /** |
|
390 | + * Processes the actual payment. |
|
391 | + * |
|
392 | + * @param WPInv_Invoice $invoice |
|
393 | + */ |
|
394 | + protected function process_payment( $invoice ) { |
|
395 | 395 | |
396 | - // Clear any checkout errors. |
|
397 | - wpinv_clear_errors(); |
|
396 | + // Clear any checkout errors. |
|
397 | + wpinv_clear_errors(); |
|
398 | 398 | |
399 | - // No need to send free invoices to the gateway. |
|
400 | - if ( $invoice->is_free() ) { |
|
401 | - $this->process_free_payment( $invoice ); |
|
402 | - } |
|
399 | + // No need to send free invoices to the gateway. |
|
400 | + if ( $invoice->is_free() ) { |
|
401 | + $this->process_free_payment( $invoice ); |
|
402 | + } |
|
403 | 403 | |
404 | - $submission = $this->payment_form_submission; |
|
404 | + $submission = $this->payment_form_submission; |
|
405 | 405 | |
406 | - // Fires before sending to the gateway. |
|
407 | - do_action( 'getpaid_checkout_before_gateway', $invoice, $submission ); |
|
406 | + // Fires before sending to the gateway. |
|
407 | + do_action( 'getpaid_checkout_before_gateway', $invoice, $submission ); |
|
408 | 408 | |
409 | - // Allow the sumission data to be modified before it is sent to the gateway. |
|
410 | - $submission_data = $submission->get_data(); |
|
411 | - $submission_gateway = apply_filters( 'getpaid_gateway_submission_gateway', $invoice->get_gateway(), $submission, $invoice ); |
|
412 | - $submission_data = apply_filters( 'getpaid_gateway_submission_data', $submission_data, $submission, $invoice ); |
|
409 | + // Allow the sumission data to be modified before it is sent to the gateway. |
|
410 | + $submission_data = $submission->get_data(); |
|
411 | + $submission_gateway = apply_filters( 'getpaid_gateway_submission_gateway', $invoice->get_gateway(), $submission, $invoice ); |
|
412 | + $submission_data = apply_filters( 'getpaid_gateway_submission_data', $submission_data, $submission, $invoice ); |
|
413 | 413 | |
414 | - // Validate the currency. |
|
415 | - if ( ! apply_filters( "getpaid_gateway_{$submission_gateway}_is_valid_for_currency", true, $invoice->get_currency() ) ) { |
|
416 | - wpinv_set_error( 'invalid_currency', __( 'The chosen payment gateway does not support this currency', 'invoicing' ) ); |
|
417 | - } |
|
414 | + // Validate the currency. |
|
415 | + if ( ! apply_filters( "getpaid_gateway_{$submission_gateway}_is_valid_for_currency", true, $invoice->get_currency() ) ) { |
|
416 | + wpinv_set_error( 'invalid_currency', __( 'The chosen payment gateway does not support this currency', 'invoicing' ) ); |
|
417 | + } |
|
418 | 418 | |
419 | - // Check to see if we have any errors. |
|
420 | - if ( wpinv_get_errors() ) { |
|
421 | - wpinv_send_back_to_checkout( $invoice ); |
|
422 | - } |
|
419 | + // Check to see if we have any errors. |
|
420 | + if ( wpinv_get_errors() ) { |
|
421 | + wpinv_send_back_to_checkout( $invoice ); |
|
422 | + } |
|
423 | 423 | |
424 | - // Send info to the gateway for payment processing |
|
425 | - do_action( "getpaid_gateway_$submission_gateway", $invoice, $submission_data, $submission ); |
|
424 | + // Send info to the gateway for payment processing |
|
425 | + do_action( "getpaid_gateway_$submission_gateway", $invoice, $submission_data, $submission ); |
|
426 | 426 | |
427 | - // Backwards compatibility. |
|
428 | - wpinv_send_to_gateway( $submission_gateway, $invoice ); |
|
427 | + // Backwards compatibility. |
|
428 | + wpinv_send_to_gateway( $submission_gateway, $invoice ); |
|
429 | 429 | |
430 | - } |
|
430 | + } |
|
431 | 431 | |
432 | - /** |
|
433 | - * Marks the invoice as paid in case the checkout is free. |
|
434 | - * |
|
435 | - * @param WPInv_Invoice $invoice |
|
436 | - */ |
|
437 | - protected function process_free_payment( $invoice ) { |
|
432 | + /** |
|
433 | + * Marks the invoice as paid in case the checkout is free. |
|
434 | + * |
|
435 | + * @param WPInv_Invoice $invoice |
|
436 | + */ |
|
437 | + protected function process_free_payment( $invoice ) { |
|
438 | 438 | |
439 | - $invoice->set_gateway( 'none' ); |
|
440 | - $invoice->add_note( __( "This is a free invoice and won't be sent to the payment gateway", 'invoicing' ), false, false, true ); |
|
441 | - $invoice->mark_paid(); |
|
442 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
439 | + $invoice->set_gateway( 'none' ); |
|
440 | + $invoice->add_note( __( "This is a free invoice and won't be sent to the payment gateway", 'invoicing' ), false, false, true ); |
|
441 | + $invoice->mark_paid(); |
|
442 | + wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
443 | 443 | |
444 | - } |
|
444 | + } |
|
445 | 445 | |
446 | - /** |
|
446 | + /** |
|
447 | 447 | * Sends a redrect response to payment details. |
448 | 448 | * |
449 | 449 | */ |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Main Checkout Class. |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @param GetPaid_Payment_Form_Submission $submission |
24 | 24 | */ |
25 | - public function __construct( $submission ) { |
|
25 | + public function __construct($submission) { |
|
26 | 26 | $this->payment_form_submission = $submission; |
27 | 27 | } |
28 | 28 | |
@@ -38,22 +38,22 @@ discard block |
||
38 | 38 | // Prepare the invoice. |
39 | 39 | $items = $this->get_submission_items(); |
40 | 40 | $invoice = $this->get_submission_invoice(); |
41 | - $invoice = $this->process_submission_invoice( $invoice, $items ); |
|
41 | + $invoice = $this->process_submission_invoice($invoice, $items); |
|
42 | 42 | $prepared = $this->prepare_submission_data_for_saving(); |
43 | 43 | |
44 | - $this->prepare_billing_info( $invoice ); |
|
44 | + $this->prepare_billing_info($invoice); |
|
45 | 45 | |
46 | - $shipping = $this->prepare_shipping_info( $invoice ); |
|
46 | + $shipping = $this->prepare_shipping_info($invoice); |
|
47 | 47 | |
48 | 48 | // Save the invoice. |
49 | - $invoice->set_is_viewed( true ); |
|
49 | + $invoice->set_is_viewed(true); |
|
50 | 50 | $invoice->recalculate_total(); |
51 | 51 | $invoice->save(); |
52 | 52 | |
53 | - do_action( 'getpaid_checkout_invoice_updated', $invoice ); |
|
53 | + do_action('getpaid_checkout_invoice_updated', $invoice); |
|
54 | 54 | |
55 | 55 | // Send to the gateway. |
56 | - $this->post_process_submission( $invoice, $prepared, $shipping ); |
|
56 | + $this->post_process_submission($invoice, $prepared, $shipping); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -66,34 +66,34 @@ discard block |
||
66 | 66 | $data = $submission->get_data(); |
67 | 67 | |
68 | 68 | // Do we have an error? |
69 | - if ( ! empty( $submission->last_error ) ) { |
|
70 | - wp_send_json_error( $submission->last_error ); |
|
69 | + if (!empty($submission->last_error)) { |
|
70 | + wp_send_json_error($submission->last_error); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // We need a billing email. |
74 | - if ( ! $submission->has_billing_email() ) { |
|
75 | - wp_send_json_error( __( 'Provide a valid billing email.', 'invoicing' ) ); |
|
74 | + if (!$submission->has_billing_email()) { |
|
75 | + wp_send_json_error(__('Provide a valid billing email.', 'invoicing')); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | // Non-recurring gateways should not be allowed to process recurring invoices. |
79 | - if ( $submission->should_collect_payment_details() && $submission->has_recurring && ! wpinv_gateway_support_subscription( $data['wpi-gateway'] ) ) { |
|
80 | - wp_send_json_error( __( 'The selected payment gateway does not support subscription payments.', 'invoicing' ) ); |
|
79 | + if ($submission->should_collect_payment_details() && $submission->has_recurring && !wpinv_gateway_support_subscription($data['wpi-gateway'])) { |
|
80 | + wp_send_json_error(__('The selected payment gateway does not support subscription payments.', 'invoicing')); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | // Ensure the gateway is active. |
84 | - if ( $submission->should_collect_payment_details() && ! wpinv_is_gateway_active( $data['wpi-gateway'] ) ) { |
|
85 | - wpinv_set_error( 'invalid_gateway', __( 'The selected payment gateway is not active', 'invoicing' ) ); |
|
84 | + if ($submission->should_collect_payment_details() && !wpinv_is_gateway_active($data['wpi-gateway'])) { |
|
85 | + wpinv_set_error('invalid_gateway', __('The selected payment gateway is not active', 'invoicing')); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | // Clear any existing errors. |
89 | 89 | wpinv_clear_errors(); |
90 | 90 | |
91 | 91 | // Allow themes and plugins to hook to errors |
92 | - do_action( 'getpaid_checkout_error_checks', $submission ); |
|
92 | + do_action('getpaid_checkout_error_checks', $submission); |
|
93 | 93 | |
94 | 94 | // Do we have any errors? |
95 | - if ( wpinv_get_errors() ) { |
|
96 | - wp_send_json_error( getpaid_get_errors_html() ); |
|
95 | + if (wpinv_get_errors()) { |
|
96 | + wp_send_json_error(getpaid_get_errors_html()); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | } |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | $items = $this->payment_form_submission->get_items(); |
109 | 109 | |
110 | 110 | // Ensure that we have items. |
111 | - if ( empty( $items ) && ! $this->payment_form_submission->has_fees() ) { |
|
112 | - wp_send_json_error( __( 'Please provide at least one item or amount.', 'invoicing' ) ); |
|
111 | + if (empty($items) && !$this->payment_form_submission->has_fees()) { |
|
112 | + wp_send_json_error(__('Please provide at least one item or amount.', 'invoicing')); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return $items; |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | protected function get_submission_invoice() { |
124 | 124 | $submission = $this->payment_form_submission; |
125 | 125 | |
126 | - if ( ! $submission->has_invoice() ) { |
|
126 | + if (!$submission->has_invoice()) { |
|
127 | 127 | $invoice = new WPInv_Invoice(); |
128 | - $invoice->set_created_via( 'payment_form' ); |
|
128 | + $invoice->set_created_via('payment_form'); |
|
129 | 129 | return $invoice; |
130 | 130 | } |
131 | 131 | |
132 | 132 | $invoice = $submission->get_invoice(); |
133 | 133 | |
134 | 134 | // Make sure that it is neither paid or refunded. |
135 | - if ( $invoice->is_paid() || $invoice->is_refunded() ) { |
|
136 | - wp_send_json_error( __( 'This invoice has already been paid for.', 'invoicing' ) ); |
|
135 | + if ($invoice->is_paid() || $invoice->is_refunded()) { |
|
136 | + wp_send_json_error(__('This invoice has already been paid for.', 'invoicing')); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | return $invoice; |
@@ -146,29 +146,29 @@ discard block |
||
146 | 146 | * @param GetPaid_Form_Item[] $items |
147 | 147 | * @return WPInv_Invoice |
148 | 148 | */ |
149 | - protected function process_submission_invoice( $invoice, $items ) { |
|
149 | + protected function process_submission_invoice($invoice, $items) { |
|
150 | 150 | |
151 | 151 | $submission = $this->payment_form_submission; |
152 | 152 | $data = $submission->get_data(); |
153 | 153 | |
154 | 154 | // Set-up the invoice details. |
155 | - $invoice->set_email( sanitize_email( $submission->get_billing_email() ) ); |
|
156 | - $invoice->set_user_id( $this->get_submission_customer() ); |
|
157 | - $invoice->set_payment_form( absint( $submission->get_payment_form()->get_id() ) ); |
|
158 | - $invoice->set_items( $items ); |
|
159 | - $invoice->set_fees( $submission->get_fees() ); |
|
160 | - $invoice->set_taxes( $submission->get_taxes() ); |
|
161 | - $invoice->set_discounts( $submission->get_discounts() ); |
|
162 | - $invoice->set_gateway( $data['wpi-gateway'] ); |
|
163 | - |
|
164 | - $address_confirmed = $submission->get_field( 'confirm-address' ); |
|
165 | - $invoice->set_address_confirmed( ! empty( $address_confirmed ) ); |
|
166 | - |
|
167 | - if ( $submission->has_discount_code() ) { |
|
168 | - $invoice->set_discount_code( $submission->get_discount_code() ); |
|
155 | + $invoice->set_email(sanitize_email($submission->get_billing_email())); |
|
156 | + $invoice->set_user_id($this->get_submission_customer()); |
|
157 | + $invoice->set_payment_form(absint($submission->get_payment_form()->get_id())); |
|
158 | + $invoice->set_items($items); |
|
159 | + $invoice->set_fees($submission->get_fees()); |
|
160 | + $invoice->set_taxes($submission->get_taxes()); |
|
161 | + $invoice->set_discounts($submission->get_discounts()); |
|
162 | + $invoice->set_gateway($data['wpi-gateway']); |
|
163 | + |
|
164 | + $address_confirmed = $submission->get_field('confirm-address'); |
|
165 | + $invoice->set_address_confirmed(!empty($address_confirmed)); |
|
166 | + |
|
167 | + if ($submission->has_discount_code()) { |
|
168 | + $invoice->set_discount_code($submission->get_discount_code()); |
|
169 | 169 | } |
170 | 170 | |
171 | - getpaid_maybe_add_default_address( $invoice ); |
|
171 | + getpaid_maybe_add_default_address($invoice); |
|
172 | 172 | return $invoice; |
173 | 173 | } |
174 | 174 | |
@@ -181,33 +181,33 @@ discard block |
||
181 | 181 | $submission = $this->payment_form_submission; |
182 | 182 | |
183 | 183 | // If this is an existing invoice... |
184 | - if ( $submission->has_invoice() ) { |
|
184 | + if ($submission->has_invoice()) { |
|
185 | 185 | return $submission->get_invoice()->get_user_id(); |
186 | 186 | } |
187 | 187 | |
188 | 188 | // (Maybe) create the user. |
189 | 189 | $user = get_current_user_id(); |
190 | 190 | |
191 | - if ( empty( $user ) ) { |
|
192 | - $user = get_user_by( 'email', $submission->get_billing_email() ); |
|
191 | + if (empty($user)) { |
|
192 | + $user = get_user_by('email', $submission->get_billing_email()); |
|
193 | 193 | } |
194 | 194 | |
195 | - if ( empty( $user ) ) { |
|
196 | - $user = wpinv_create_user( $submission->get_billing_email() ); |
|
195 | + if (empty($user)) { |
|
196 | + $user = wpinv_create_user($submission->get_billing_email()); |
|
197 | 197 | |
198 | 198 | // (Maybe) send new user notification. |
199 | - $should_send_notification = wpinv_get_option( 'disable_new_user_emails' ); |
|
200 | - if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', empty( $should_send_notification ), $user ) ) { |
|
201 | - wp_send_new_user_notifications( $user, 'user' ); |
|
199 | + $should_send_notification = wpinv_get_option('disable_new_user_emails'); |
|
200 | + if (!empty($user) && is_numeric($user) && apply_filters('getpaid_send_new_user_notification', empty($should_send_notification), $user)) { |
|
201 | + wp_send_new_user_notifications($user, 'user'); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | } |
205 | 205 | |
206 | - if ( is_wp_error( $user ) ) { |
|
207 | - wp_send_json_error( $user->get_error_message() ); |
|
206 | + if (is_wp_error($user)) { |
|
207 | + wp_send_json_error($user->get_error_message()); |
|
208 | 208 | } |
209 | 209 | |
210 | - if ( is_numeric( $user ) ) { |
|
210 | + if (is_numeric($user)) { |
|
211 | 211 | return $user; |
212 | 212 | } |
213 | 213 | |
@@ -231,40 +231,40 @@ discard block |
||
231 | 231 | ); |
232 | 232 | |
233 | 233 | // Raw submission details. |
234 | - $data = $submission->get_data(); |
|
234 | + $data = $submission->get_data(); |
|
235 | 235 | |
236 | 236 | // Loop through the submitted details. |
237 | - foreach ( $submission->get_payment_form()->get_elements() as $field ) { |
|
237 | + foreach ($submission->get_payment_form()->get_elements() as $field) { |
|
238 | 238 | |
239 | 239 | // Skip premade fields. |
240 | - if ( ! empty( $field['premade'] ) || $field['type'] == 'address' ) { |
|
240 | + if (!empty($field['premade']) || $field['type'] == 'address') { |
|
241 | 241 | continue; |
242 | 242 | } |
243 | 243 | |
244 | 244 | // If it is required and not set, abort. |
245 | - if ( ! $submission->is_required_field_set( $field ) ) { |
|
246 | - wp_send_json_error( __( 'Please fill all required fields.', 'invoicing' ) ); |
|
245 | + if (!$submission->is_required_field_set($field)) { |
|
246 | + wp_send_json_error(__('Please fill all required fields.', 'invoicing')); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | // Handle misc fields. |
250 | - if ( isset( $data[ $field['id'] ] ) ) { |
|
250 | + if (isset($data[$field['id']])) { |
|
251 | 251 | |
252 | - if ( $field['type'] == 'checkbox' ) { |
|
253 | - $value = isset( $data[ $field['id'] ] ) ? __( 'Yes', 'invoicing' ) : __( 'No', 'invoicing' ); |
|
252 | + if ($field['type'] == 'checkbox') { |
|
253 | + $value = isset($data[$field['id']]) ? __('Yes', 'invoicing') : __('No', 'invoicing'); |
|
254 | 254 | } else { |
255 | - $value = wp_kses_post( $data[ $field['id'] ] ); |
|
255 | + $value = wp_kses_post($data[$field['id']]); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | $label = $field['id']; |
259 | 259 | |
260 | - if ( isset( $field['label'] ) ) { |
|
260 | + if (isset($field['label'])) { |
|
261 | 261 | $label = $field['label']; |
262 | 262 | } |
263 | 263 | |
264 | - if ( ! empty( $field['add_meta'] ) ) { |
|
265 | - $prepared['meta'][ wpinv_clean( $label ) ] = $value; |
|
264 | + if (!empty($field['add_meta'])) { |
|
265 | + $prepared['meta'][wpinv_clean($label)] = $value; |
|
266 | 266 | } |
267 | - $prepared['all'][ wpinv_clean( $label ) ] = $value; |
|
267 | + $prepared['all'][wpinv_clean($label)] = $value; |
|
268 | 268 | |
269 | 269 | } |
270 | 270 | |
@@ -281,30 +281,30 @@ discard block |
||
281 | 281 | * @param WPInv_Invoice $invoice |
282 | 282 | * @param string $type |
283 | 283 | */ |
284 | - public function prepare_address_details( $invoice, $type = 'billing' ) { |
|
284 | + public function prepare_address_details($invoice, $type = 'billing') { |
|
285 | 285 | |
286 | 286 | $data = $this->payment_form_submission->get_data(); |
287 | - $type = sanitize_key( $type ); |
|
287 | + $type = sanitize_key($type); |
|
288 | 288 | $address = array(); |
289 | 289 | $prepared = array(); |
290 | 290 | |
291 | - if ( ! empty( $data[ $type ] ) ) { |
|
292 | - $address = $data[ $type ]; |
|
291 | + if (!empty($data[$type])) { |
|
292 | + $address = $data[$type]; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | // Clean address details. |
296 | - foreach ( $address as $key => $value ) { |
|
297 | - $key = sanitize_key( $key ); |
|
298 | - $key = str_replace( 'wpinv_', '', $key ); |
|
299 | - $value = wpinv_clean( $value ); |
|
300 | - $prepared[ $key] = apply_filters( "getpaid_checkout_{$type}_address_$key", $value, $this->payment_form_submission, $invoice ); |
|
296 | + foreach ($address as $key => $value) { |
|
297 | + $key = sanitize_key($key); |
|
298 | + $key = str_replace('wpinv_', '', $key); |
|
299 | + $value = wpinv_clean($value); |
|
300 | + $prepared[$key] = apply_filters("getpaid_checkout_{$type}_address_$key", $value, $this->payment_form_submission, $invoice); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | // Filter address details. |
304 | - $prepared = apply_filters( "getpaid_checkout_{$type}_address", $prepared, $this->payment_form_submission, $invoice ); |
|
304 | + $prepared = apply_filters("getpaid_checkout_{$type}_address", $prepared, $this->payment_form_submission, $invoice); |
|
305 | 305 | |
306 | 306 | // Remove non-whitelisted values. |
307 | - return array_filter( $prepared, 'getpaid_is_address_field_whitelisted', ARRAY_FILTER_USE_KEY ); |
|
307 | + return array_filter($prepared, 'getpaid_is_address_field_whitelisted', ARRAY_FILTER_USE_KEY); |
|
308 | 308 | |
309 | 309 | } |
310 | 310 | |
@@ -314,12 +314,12 @@ discard block |
||
314 | 314 | * @return array |
315 | 315 | * @param WPInv_Invoice $invoice |
316 | 316 | */ |
317 | - protected function prepare_billing_info( &$invoice ) { |
|
317 | + protected function prepare_billing_info(&$invoice) { |
|
318 | 318 | |
319 | - $billing_address = $this->prepare_address_details( $invoice, 'billing' ); |
|
319 | + $billing_address = $this->prepare_address_details($invoice, 'billing'); |
|
320 | 320 | |
321 | 321 | // Update the invoice with the billing details. |
322 | - $invoice->set_props( $billing_address ); |
|
322 | + $invoice->set_props($billing_address); |
|
323 | 323 | |
324 | 324 | } |
325 | 325 | |
@@ -329,15 +329,15 @@ discard block |
||
329 | 329 | * @return array |
330 | 330 | * @param WPInv_Invoice $invoice |
331 | 331 | */ |
332 | - protected function prepare_shipping_info( $invoice ) { |
|
332 | + protected function prepare_shipping_info($invoice) { |
|
333 | 333 | |
334 | 334 | $data = $this->payment_form_submission->get_data(); |
335 | 335 | |
336 | - if ( empty( $data['same-shipping-address'] ) ) { |
|
337 | - return $this->prepare_address_details( $invoice, 'shipping' ); |
|
336 | + if (empty($data['same-shipping-address'])) { |
|
337 | + return $this->prepare_address_details($invoice, 'shipping'); |
|
338 | 338 | } |
339 | 339 | |
340 | - return $this->prepare_address_details( $invoice, 'billing' ); |
|
340 | + return $this->prepare_address_details($invoice, 'billing'); |
|
341 | 341 | |
342 | 342 | } |
343 | 343 | |
@@ -348,41 +348,41 @@ discard block |
||
348 | 348 | * @param array $prepared_payment_form_data |
349 | 349 | * @param array $shipping |
350 | 350 | */ |
351 | - protected function post_process_submission( $invoice, $prepared_payment_form_data, $shipping ) { |
|
351 | + protected function post_process_submission($invoice, $prepared_payment_form_data, $shipping) { |
|
352 | 352 | |
353 | 353 | // Ensure the invoice exists. |
354 | - if ( ! $invoice->exists() ) { |
|
355 | - wp_send_json_error( __( 'An error occured while saving your invoice. Please try again.', 'invoicing' ) ); |
|
354 | + if (!$invoice->exists()) { |
|
355 | + wp_send_json_error(__('An error occured while saving your invoice. Please try again.', 'invoicing')); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | // Save payment form data. |
359 | - $prepared_payment_form_data = apply_filters( 'getpaid_prepared_payment_form_data', $prepared_payment_form_data, $invoice ); |
|
360 | - delete_post_meta( $invoice->get_id(), 'payment_form_data' ); |
|
361 | - delete_post_meta( $invoice->get_id(), 'additional_meta_data' ); |
|
362 | - if ( ! empty( $prepared_payment_form_data ) ) { |
|
359 | + $prepared_payment_form_data = apply_filters('getpaid_prepared_payment_form_data', $prepared_payment_form_data, $invoice); |
|
360 | + delete_post_meta($invoice->get_id(), 'payment_form_data'); |
|
361 | + delete_post_meta($invoice->get_id(), 'additional_meta_data'); |
|
362 | + if (!empty($prepared_payment_form_data)) { |
|
363 | 363 | |
364 | - if ( ! empty( $prepared_payment_form_data['all'] ) ) { |
|
365 | - update_post_meta( $invoice->get_id(), 'payment_form_data', $prepared_payment_form_data['all'] ); |
|
364 | + if (!empty($prepared_payment_form_data['all'])) { |
|
365 | + update_post_meta($invoice->get_id(), 'payment_form_data', $prepared_payment_form_data['all']); |
|
366 | 366 | } |
367 | 367 | |
368 | - if ( ! empty( $prepared_payment_form_data['meta'] ) ) { |
|
369 | - update_post_meta( $invoice->get_id(), 'additional_meta_data', $prepared_payment_form_data['meta'] ); |
|
368 | + if (!empty($prepared_payment_form_data['meta'])) { |
|
369 | + update_post_meta($invoice->get_id(), 'additional_meta_data', $prepared_payment_form_data['meta']); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | } |
373 | 373 | |
374 | 374 | // Save payment form data. |
375 | - if ( ! empty( $shipping ) ) { |
|
376 | - update_post_meta( $invoice->get_id(), 'shipping_address', $shipping ); |
|
375 | + if (!empty($shipping)) { |
|
376 | + update_post_meta($invoice->get_id(), 'shipping_address', $shipping); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | // Backwards compatibility. |
380 | - add_filter( 'wp_redirect', array( $this, 'send_redirect_response' ) ); |
|
380 | + add_filter('wp_redirect', array($this, 'send_redirect_response')); |
|
381 | 381 | |
382 | - $this->process_payment( $invoice ); |
|
382 | + $this->process_payment($invoice); |
|
383 | 383 | |
384 | 384 | // If we are here, there was an error. |
385 | - wpinv_send_back_to_checkout( $invoice ); |
|
385 | + wpinv_send_back_to_checkout($invoice); |
|
386 | 386 | |
387 | 387 | } |
388 | 388 | |
@@ -391,41 +391,41 @@ discard block |
||
391 | 391 | * |
392 | 392 | * @param WPInv_Invoice $invoice |
393 | 393 | */ |
394 | - protected function process_payment( $invoice ) { |
|
394 | + protected function process_payment($invoice) { |
|
395 | 395 | |
396 | 396 | // Clear any checkout errors. |
397 | 397 | wpinv_clear_errors(); |
398 | 398 | |
399 | 399 | // No need to send free invoices to the gateway. |
400 | - if ( $invoice->is_free() ) { |
|
401 | - $this->process_free_payment( $invoice ); |
|
400 | + if ($invoice->is_free()) { |
|
401 | + $this->process_free_payment($invoice); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | $submission = $this->payment_form_submission; |
405 | 405 | |
406 | 406 | // Fires before sending to the gateway. |
407 | - do_action( 'getpaid_checkout_before_gateway', $invoice, $submission ); |
|
407 | + do_action('getpaid_checkout_before_gateway', $invoice, $submission); |
|
408 | 408 | |
409 | 409 | // Allow the sumission data to be modified before it is sent to the gateway. |
410 | 410 | $submission_data = $submission->get_data(); |
411 | - $submission_gateway = apply_filters( 'getpaid_gateway_submission_gateway', $invoice->get_gateway(), $submission, $invoice ); |
|
412 | - $submission_data = apply_filters( 'getpaid_gateway_submission_data', $submission_data, $submission, $invoice ); |
|
411 | + $submission_gateway = apply_filters('getpaid_gateway_submission_gateway', $invoice->get_gateway(), $submission, $invoice); |
|
412 | + $submission_data = apply_filters('getpaid_gateway_submission_data', $submission_data, $submission, $invoice); |
|
413 | 413 | |
414 | 414 | // Validate the currency. |
415 | - if ( ! apply_filters( "getpaid_gateway_{$submission_gateway}_is_valid_for_currency", true, $invoice->get_currency() ) ) { |
|
416 | - wpinv_set_error( 'invalid_currency', __( 'The chosen payment gateway does not support this currency', 'invoicing' ) ); |
|
415 | + if (!apply_filters("getpaid_gateway_{$submission_gateway}_is_valid_for_currency", true, $invoice->get_currency())) { |
|
416 | + wpinv_set_error('invalid_currency', __('The chosen payment gateway does not support this currency', 'invoicing')); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | // Check to see if we have any errors. |
420 | - if ( wpinv_get_errors() ) { |
|
421 | - wpinv_send_back_to_checkout( $invoice ); |
|
420 | + if (wpinv_get_errors()) { |
|
421 | + wpinv_send_back_to_checkout($invoice); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | // Send info to the gateway for payment processing |
425 | - do_action( "getpaid_gateway_$submission_gateway", $invoice, $submission_data, $submission ); |
|
425 | + do_action("getpaid_gateway_$submission_gateway", $invoice, $submission_data, $submission); |
|
426 | 426 | |
427 | 427 | // Backwards compatibility. |
428 | - wpinv_send_to_gateway( $submission_gateway, $invoice ); |
|
428 | + wpinv_send_to_gateway($submission_gateway, $invoice); |
|
429 | 429 | |
430 | 430 | } |
431 | 431 | |
@@ -434,12 +434,12 @@ discard block |
||
434 | 434 | * |
435 | 435 | * @param WPInv_Invoice $invoice |
436 | 436 | */ |
437 | - protected function process_free_payment( $invoice ) { |
|
437 | + protected function process_free_payment($invoice) { |
|
438 | 438 | |
439 | - $invoice->set_gateway( 'none' ); |
|
440 | - $invoice->add_note( __( "This is a free invoice and won't be sent to the payment gateway", 'invoicing' ), false, false, true ); |
|
439 | + $invoice->set_gateway('none'); |
|
440 | + $invoice->add_note(__("This is a free invoice and won't be sent to the payment gateway", 'invoicing'), false, false, true); |
|
441 | 441 | $invoice->mark_paid(); |
442 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
442 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
443 | 443 | |
444 | 444 | } |
445 | 445 | |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | * Sends a redrect response to payment details. |
448 | 448 | * |
449 | 449 | */ |
450 | - public function send_redirect_response( $url ) { |
|
451 | - $url = urlencode( $url ); |
|
452 | - wp_send_json_success( $url ); |
|
450 | + public function send_redirect_response($url) { |
|
451 | + $url = urlencode($url); |
|
452 | + wp_send_json_success($url); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | } |
@@ -9,41 +9,41 @@ discard block |
||
9 | 9 | * @version 1.0.19 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | 14 | return array( |
15 | 15 | |
16 | 16 | array( |
17 | 17 | 'type' => 'heading', |
18 | - 'name' => __( 'Heading', 'invoicing' ), |
|
18 | + 'name' => __('Heading', 'invoicing'), |
|
19 | 19 | 'defaults' => array( |
20 | 20 | 'level' => 'h2', |
21 | - 'text' => __( 'Heading', 'invoicing' ), |
|
21 | + 'text' => __('Heading', 'invoicing'), |
|
22 | 22 | ) |
23 | 23 | ), |
24 | 24 | |
25 | 25 | array( |
26 | 26 | 'type' => 'paragraph', |
27 | - 'name' => __( 'Paragraph', 'invoicing' ), |
|
27 | + 'name' => __('Paragraph', 'invoicing'), |
|
28 | 28 | 'defaults' => array( |
29 | - 'text' => __( 'Paragraph text', 'invoicing' ), |
|
29 | + 'text' => __('Paragraph text', 'invoicing'), |
|
30 | 30 | ) |
31 | 31 | ), |
32 | 32 | |
33 | 33 | array( |
34 | 34 | 'type' => 'alert', |
35 | - 'name' => __( 'Alert', 'invoicing' ), |
|
35 | + 'name' => __('Alert', 'invoicing'), |
|
36 | 36 | 'defaults' => array( |
37 | 37 | 'value' => '', |
38 | 38 | 'class' => 'alert-warning', |
39 | - 'text' => __( 'Alert', 'invoicing' ), |
|
39 | + 'text' => __('Alert', 'invoicing'), |
|
40 | 40 | 'dismissible' => false, |
41 | 41 | ) |
42 | 42 | ), |
43 | 43 | |
44 | 44 | array( |
45 | 45 | 'type' => 'separator', |
46 | - 'name' => __( 'Separator', 'invoicing' ), |
|
46 | + 'name' => __('Separator', 'invoicing'), |
|
47 | 47 | 'defaults' => array( |
48 | 48 | 'value' => '', |
49 | 49 | ), |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | |
52 | 52 | array( |
53 | 53 | 'type' => 'text', |
54 | - 'name' => __( 'Text Input', 'invoicing' ), |
|
54 | + 'name' => __('Text Input', 'invoicing'), |
|
55 | 55 | 'defaults' => array( |
56 | - 'placeholder' => __( 'Enter some text', 'invoicing' ), |
|
56 | + 'placeholder' => __('Enter some text', 'invoicing'), |
|
57 | 57 | 'value' => '', |
58 | - 'label' => __( 'Field Label', 'invoicing' ), |
|
58 | + 'label' => __('Field Label', 'invoicing'), |
|
59 | 59 | 'description' => '', |
60 | 60 | 'required' => false, |
61 | 61 | ) |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | |
64 | 64 | array( |
65 | 65 | 'type' => 'textarea', |
66 | - 'name' => __( 'Textarea', 'invoicing' ), |
|
66 | + 'name' => __('Textarea', 'invoicing'), |
|
67 | 67 | 'defaults' => array( |
68 | - 'placeholder' => __( 'Enter your text here', 'invoicing' ), |
|
68 | + 'placeholder' => __('Enter your text here', 'invoicing'), |
|
69 | 69 | 'value' => '', |
70 | - 'label' => __( 'Textarea Label', 'invoicing' ), |
|
70 | + 'label' => __('Textarea Label', 'invoicing'), |
|
71 | 71 | 'description' => '', |
72 | 72 | 'required' => false, |
73 | 73 | ) |
@@ -75,27 +75,27 @@ discard block |
||
75 | 75 | |
76 | 76 | array( |
77 | 77 | 'type' => 'select', |
78 | - 'name' => __( 'Dropdown', 'invoicing' ), |
|
78 | + 'name' => __('Dropdown', 'invoicing'), |
|
79 | 79 | 'defaults' => array( |
80 | - 'placeholder' => __( 'Select a value', 'invoicing' ), |
|
80 | + 'placeholder' => __('Select a value', 'invoicing'), |
|
81 | 81 | 'value' => '', |
82 | - 'label' => __( 'Dropdown Label', 'invoicing' ), |
|
82 | + 'label' => __('Dropdown Label', 'invoicing'), |
|
83 | 83 | 'description' => '', |
84 | 84 | 'required' => false, |
85 | 85 | 'options' => array( |
86 | - esc_attr__( 'Option One', 'invoicing' ), |
|
87 | - esc_attr__( 'Option Two', 'invoicing' ), |
|
88 | - esc_attr__( 'Option Three', 'invoicing' ) |
|
86 | + esc_attr__('Option One', 'invoicing'), |
|
87 | + esc_attr__('Option Two', 'invoicing'), |
|
88 | + esc_attr__('Option Three', 'invoicing') |
|
89 | 89 | ), |
90 | 90 | ) |
91 | 91 | ), |
92 | 92 | |
93 | 93 | array( |
94 | 94 | 'type' => 'checkbox', |
95 | - 'name' => __( 'Checkbox', 'invoicing' ), |
|
95 | + 'name' => __('Checkbox', 'invoicing'), |
|
96 | 96 | 'defaults' => array( |
97 | 97 | 'value' => '', |
98 | - 'label' => __( 'Checkbox Label', 'invoicing' ), |
|
98 | + 'label' => __('Checkbox Label', 'invoicing'), |
|
99 | 99 | 'description' => '', |
100 | 100 | 'required' => false, |
101 | 101 | ) |
@@ -103,23 +103,23 @@ discard block |
||
103 | 103 | |
104 | 104 | array( |
105 | 105 | 'type' => 'radio', |
106 | - 'name' => __( 'Radio', 'invoicing' ), |
|
106 | + 'name' => __('Radio', 'invoicing'), |
|
107 | 107 | 'defaults' => array( |
108 | - 'label' => __( 'Select one choice', 'invoicing' ), |
|
108 | + 'label' => __('Select one choice', 'invoicing'), |
|
109 | 109 | 'options' => array( |
110 | - esc_attr__( 'Choice One', 'invoicing' ), |
|
111 | - esc_attr__( 'Choice Two', 'invoicing' ), |
|
112 | - esc_attr__( 'Choice Three', 'invoicing' ) |
|
110 | + esc_attr__('Choice One', 'invoicing'), |
|
111 | + esc_attr__('Choice Two', 'invoicing'), |
|
112 | + esc_attr__('Choice Three', 'invoicing') |
|
113 | 113 | ), |
114 | 114 | ) |
115 | 115 | ), |
116 | 116 | |
117 | 117 | array( |
118 | 118 | 'type' => 'date', |
119 | - 'name' => __( 'Date', 'invoicing' ), |
|
119 | + 'name' => __('Date', 'invoicing'), |
|
120 | 120 | 'defaults' => array( |
121 | 121 | 'value' => '', |
122 | - 'label' => __( 'Date', 'invoicing' ), |
|
122 | + 'label' => __('Date', 'invoicing'), |
|
123 | 123 | 'description' => '', |
124 | 124 | 'required' => false, |
125 | 125 | ) |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | |
128 | 128 | array( |
129 | 129 | 'type' => 'time', |
130 | - 'name' => __( 'Time', 'invoicing' ), |
|
130 | + 'name' => __('Time', 'invoicing'), |
|
131 | 131 | 'defaults' => array( |
132 | 132 | 'value' => '', |
133 | - 'label' => __( 'Time', 'invoicing' ), |
|
133 | + 'label' => __('Time', 'invoicing'), |
|
134 | 134 | 'description' => '', |
135 | 135 | 'required' => false, |
136 | 136 | ) |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | |
139 | 139 | array( |
140 | 140 | 'type' => 'number', |
141 | - 'name' => __( 'Number', 'invoicing' ), |
|
141 | + 'name' => __('Number', 'invoicing'), |
|
142 | 142 | 'defaults' => array( |
143 | 143 | 'placeholder' => '', |
144 | 144 | 'value' => '', |
145 | - 'label' => __( 'Number', 'invoicing' ), |
|
145 | + 'label' => __('Number', 'invoicing'), |
|
146 | 146 | 'description' => '', |
147 | 147 | 'required' => false, |
148 | 148 | ) |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | |
151 | 151 | array( |
152 | 152 | 'type' => 'website', |
153 | - 'name' => __( 'Website', 'invoicing' ), |
|
153 | + 'name' => __('Website', 'invoicing'), |
|
154 | 154 | 'defaults' => array( |
155 | 155 | 'placeholder' => 'http://example.com', |
156 | 156 | 'value' => '', |
157 | - 'label' => __( 'Website', 'invoicing' ), |
|
157 | + 'label' => __('Website', 'invoicing'), |
|
158 | 158 | 'description' => '', |
159 | 159 | 'required' => false, |
160 | 160 | ) |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | |
163 | 163 | array( |
164 | 164 | 'type' => 'email', |
165 | - 'name' => __( 'Email', 'invoicing' ), |
|
165 | + 'name' => __('Email', 'invoicing'), |
|
166 | 166 | 'defaults' => array( |
167 | 167 | 'placeholder' => '[email protected]', |
168 | 168 | 'value' => '', |
169 | - 'label' => __( 'Email Address', 'invoicing' ), |
|
169 | + 'label' => __('Email Address', 'invoicing'), |
|
170 | 170 | 'description' => '', |
171 | 171 | 'required' => false, |
172 | 172 | ) |
@@ -174,18 +174,18 @@ discard block |
||
174 | 174 | |
175 | 175 | array( |
176 | 176 | 'type' => 'address', |
177 | - 'name' => __( 'Address', 'invoicing' ), |
|
177 | + 'name' => __('Address', 'invoicing'), |
|
178 | 178 | 'defaults' => array( |
179 | 179 | |
180 | 180 | 'address_type' => 'billing', |
181 | - 'billing_address_title' => __( 'Billing Address', 'invoicing' ), |
|
182 | - 'shipping_address_title' => __( 'Shipping Address', 'invoicing' ), |
|
183 | - 'shipping_address_toggle' => __( 'Same billing & shipping address.', 'invoicing' ), |
|
181 | + 'billing_address_title' => __('Billing Address', 'invoicing'), |
|
182 | + 'shipping_address_title' => __('Shipping Address', 'invoicing'), |
|
183 | + 'shipping_address_toggle' => __('Same billing & shipping address.', 'invoicing'), |
|
184 | 184 | 'fields' => array( |
185 | 185 | array( |
186 | 186 | 'placeholder' => 'Jon', |
187 | 187 | 'value' => '', |
188 | - 'label' => __( 'First Name', 'invoicing' ), |
|
188 | + 'label' => __('First Name', 'invoicing'), |
|
189 | 189 | 'description' => '', |
190 | 190 | 'required' => false, |
191 | 191 | 'visible' => true, |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | array( |
197 | 197 | 'placeholder' => 'Snow', |
198 | 198 | 'value' => '', |
199 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
199 | + 'label' => __('Last Name', 'invoicing'), |
|
200 | 200 | 'description' => '', |
201 | 201 | 'required' => false, |
202 | 202 | 'visible' => true, |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | array( |
208 | 208 | 'placeholder' => '', |
209 | 209 | 'value' => '', |
210 | - 'label' => __( 'Address', 'invoicing' ), |
|
210 | + 'label' => __('Address', 'invoicing'), |
|
211 | 211 | 'description' => '', |
212 | 212 | 'required' => false, |
213 | 213 | 'visible' => true, |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | array( |
219 | 219 | 'placeholder' => '', |
220 | 220 | 'value' => '', |
221 | - 'label' => __( 'City', 'invoicing' ), |
|
221 | + 'label' => __('City', 'invoicing'), |
|
222 | 222 | 'description' => '', |
223 | 223 | 'required' => false, |
224 | 224 | 'visible' => true, |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | ), |
228 | 228 | |
229 | 229 | array( |
230 | - 'placeholder' => __( 'Select your country' ), |
|
230 | + 'placeholder' => __('Select your country'), |
|
231 | 231 | 'value' => '', |
232 | - 'label' => __( 'Country', 'invoicing' ), |
|
232 | + 'label' => __('Country', 'invoicing'), |
|
233 | 233 | 'description' => '', |
234 | 234 | 'required' => false, |
235 | 235 | 'visible' => true, |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | ), |
239 | 239 | |
240 | 240 | array( |
241 | - 'placeholder' => __( 'Choose a state', 'invoicing' ), |
|
241 | + 'placeholder' => __('Choose a state', 'invoicing'), |
|
242 | 242 | 'value' => '', |
243 | - 'label' => __( 'State / Province', 'invoicing' ), |
|
243 | + 'label' => __('State / Province', 'invoicing'), |
|
244 | 244 | 'description' => '', |
245 | 245 | 'required' => false, |
246 | 246 | 'visible' => true, |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | array( |
252 | 252 | 'placeholder' => '', |
253 | 253 | 'value' => '', |
254 | - 'label' => __( 'ZIP / Postcode', 'invoicing' ), |
|
254 | + 'label' => __('ZIP / Postcode', 'invoicing'), |
|
255 | 255 | 'description' => '', |
256 | 256 | 'required' => false, |
257 | 257 | 'visible' => true, |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | array( |
263 | 263 | 'placeholder' => '', |
264 | 264 | 'value' => '', |
265 | - 'label' => __( 'Phone', 'invoicing' ), |
|
265 | + 'label' => __('Phone', 'invoicing'), |
|
266 | 266 | 'description' => '', |
267 | 267 | 'required' => false, |
268 | 268 | 'visible' => true, |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | array( |
274 | 274 | 'placeholder' => '', |
275 | 275 | 'value' => '', |
276 | - 'label' => __( 'Company', 'invoicing' ), |
|
276 | + 'label' => __('Company', 'invoicing'), |
|
277 | 277 | 'description' => '', |
278 | 278 | 'required' => false, |
279 | 279 | 'visible' => false, |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | array( |
285 | 285 | 'placeholder' => '', |
286 | 286 | 'value' => '', |
287 | - 'label' => __( 'VAT Number', 'invoicing' ), |
|
287 | + 'label' => __('VAT Number', 'invoicing'), |
|
288 | 288 | 'description' => '', |
289 | 289 | 'required' => false, |
290 | 290 | 'visible' => false, |
@@ -297,11 +297,11 @@ discard block |
||
297 | 297 | |
298 | 298 | array( |
299 | 299 | 'type' => 'billing_email', |
300 | - 'name' => __( 'Billing Email', 'invoicing' ), |
|
300 | + 'name' => __('Billing Email', 'invoicing'), |
|
301 | 301 | 'defaults' => array( |
302 | 302 | 'placeholder' => '[email protected]', |
303 | 303 | 'value' => '', |
304 | - 'label' => __( 'Billing Email', 'invoicing' ), |
|
304 | + 'label' => __('Billing Email', 'invoicing'), |
|
305 | 305 | 'description' => '', |
306 | 306 | 'premade' => true, |
307 | 307 | ) |
@@ -309,18 +309,18 @@ discard block |
||
309 | 309 | |
310 | 310 | array( |
311 | 311 | 'type' => 'discount', |
312 | - 'name' => __( 'Discount Input', 'invoicing' ), |
|
312 | + 'name' => __('Discount Input', 'invoicing'), |
|
313 | 313 | 'defaults' => array( |
314 | 314 | 'value' => '', |
315 | - 'input_label' => __( 'Coupon Code', 'invoicing' ), |
|
316 | - 'button_label' => __( 'Apply Coupon', 'invoicing' ), |
|
317 | - 'description' => __( 'Have a discount code? Enter it above.', 'invoicing' ), |
|
315 | + 'input_label' => __('Coupon Code', 'invoicing'), |
|
316 | + 'button_label' => __('Apply Coupon', 'invoicing'), |
|
317 | + 'description' => __('Have a discount code? Enter it above.', 'invoicing'), |
|
318 | 318 | ) |
319 | 319 | ), |
320 | 320 | |
321 | 321 | array( |
322 | 322 | 'type' => 'items', |
323 | - 'name' => __( 'Items', 'invoicing' ), |
|
323 | + 'name' => __('Items', 'invoicing'), |
|
324 | 324 | 'defaults' => array( |
325 | 325 | 'value' => '', |
326 | 326 | 'items_type' => 'total', |
@@ -332,22 +332,22 @@ discard block |
||
332 | 332 | |
333 | 333 | array( |
334 | 334 | 'type' => 'price_input', |
335 | - 'name' => __( 'Price Input', 'invoicing' ), |
|
335 | + 'name' => __('Price Input', 'invoicing'), |
|
336 | 336 | 'defaults' => array( |
337 | 337 | 'placeholder' => wpinv_format_amount(0), |
338 | 338 | 'value' => wpinv_format_amount(0), |
339 | 339 | 'minimum' => wpinv_format_amount(0), |
340 | - 'label' => __( 'Enter Amount', 'invoicing' ), |
|
340 | + 'label' => __('Enter Amount', 'invoicing'), |
|
341 | 341 | 'description' => '', |
342 | 342 | ) |
343 | 343 | ), |
344 | 344 | |
345 | 345 | array( |
346 | 346 | 'type' => 'price_select', |
347 | - 'name' => __( 'Price Select', 'invoicing' ), |
|
347 | + 'name' => __('Price Select', 'invoicing'), |
|
348 | 348 | 'defaults' => array( |
349 | 349 | 'description' => '', |
350 | - 'label' => __( 'Select Amount', 'invoicing' ), |
|
350 | + 'label' => __('Select Amount', 'invoicing'), |
|
351 | 351 | 'options' => 'Option 1|10, Option 2|20', |
352 | 352 | 'placeholder' => '', |
353 | 353 | 'select_type' => 'select', |
@@ -356,39 +356,39 @@ discard block |
||
356 | 356 | |
357 | 357 | array( |
358 | 358 | 'type' => 'pay_button', |
359 | - 'name' => __( 'Payment Button', 'invoicing' ), |
|
359 | + 'name' => __('Payment Button', 'invoicing'), |
|
360 | 360 | 'defaults' => array( |
361 | 361 | 'value' => '', |
362 | 362 | 'class' => 'btn-primary', |
363 | - 'label' => __( 'Pay %price% »', 'invoicing' ), |
|
364 | - 'free' => __( 'Continue »', 'invoicing' ), |
|
365 | - 'description' => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
363 | + 'label' => __('Pay %price% »', 'invoicing'), |
|
364 | + 'free' => __('Continue »', 'invoicing'), |
|
365 | + 'description' => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
366 | 366 | 'premade' => true, |
367 | 367 | ) |
368 | 368 | ), |
369 | 369 | |
370 | 370 | array( |
371 | 371 | 'type' => 'gateway_select', |
372 | - 'name' => __( 'Gateway Select', 'invoicing' ), |
|
372 | + 'name' => __('Gateway Select', 'invoicing'), |
|
373 | 373 | 'defaults' => array( |
374 | - 'text' => __( 'Select Payment Method', 'invoicing' ), |
|
374 | + 'text' => __('Select Payment Method', 'invoicing'), |
|
375 | 375 | 'premade' => true, |
376 | 376 | ) |
377 | 377 | ), |
378 | 378 | |
379 | 379 | array( |
380 | 380 | 'type' => 'total_payable', |
381 | - 'name' => __( 'Total Payable', 'invoicing' ), |
|
381 | + 'name' => __('Total Payable', 'invoicing'), |
|
382 | 382 | 'defaults' => array( |
383 | - 'text' => __( 'Total to pay:', 'invoicing' ), |
|
383 | + 'text' => __('Total to pay:', 'invoicing'), |
|
384 | 384 | ) |
385 | 385 | ), |
386 | 386 | |
387 | 387 | array( |
388 | 388 | 'type' => 'ip_address', |
389 | - 'name' => __( 'IP Address', 'invoicing' ), |
|
389 | + 'name' => __('IP Address', 'invoicing'), |
|
390 | 390 | 'defaults' => array( |
391 | - 'text' => __( 'Your IP address is:', 'invoicing' ), |
|
391 | + 'text' => __('Your IP address is:', 'invoicing'), |
|
392 | 392 | ) |
393 | 393 | ) |
394 | 394 | ); |
@@ -7,42 +7,42 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
24 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
25 | - <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small> |
|
23 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
24 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
25 | + <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small> |
|
26 | 26 | </label> |
27 | 27 | </div> |
28 | 28 | |
29 | 29 | <div class='form-group form-check'> |
30 | 30 | <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' /> |
31 | - <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label> |
|
31 | + <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label> |
|
32 | 32 | </div> |
33 | 33 | |
34 | 34 | <div class='form-group form-check'> |
35 | 35 | <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' /> |
36 | - <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label> |
|
36 | + <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label> |
|
37 | 37 | </div> |
38 | 38 | |
39 | 39 | <hr class='featurette-divider mt-4'> |
40 | 40 | |
41 | 41 | <div class='form-group'> |
42 | 42 | <label class="d-block"> |
43 | - <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span> |
|
43 | + <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span> |
|
44 | 44 | <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" /> |
45 | - <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span> |
|
45 | + <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span> |
|
46 | 46 | </label> |
47 | 47 | </div> |
48 | 48 |