@@ -7,10 +7,10 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$text = isset( $element['text'] ) ? trim( $element['text'] ) : ''; |
|
12 | +$text = isset($element['text']) ? trim($element['text']) : ''; |
|
13 | 13 | |
14 | -if ( ! empty( $text ) ) { |
|
14 | +if (!empty($text)) { |
|
15 | 15 | echo "<p>$text</p>"; |
16 | 16 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @version 1.0.19 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | return array( |
14 | 14 | |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | 'placeholder' => '[email protected]', |
18 | 18 | 'value' => '', |
19 | - 'label' => __( 'Billing Email', 'invoicing' ), |
|
19 | + 'label' => __('Billing Email', 'invoicing'), |
|
20 | 20 | 'description' => '', |
21 | 21 | 'required' => true, |
22 | 22 | 'id' => 'mmdwqzpox', |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | array( |
35 | 35 | 'placeholder' => 'Jon', |
36 | 36 | 'value' => '', |
37 | - 'label' => __( 'First Name', 'invoicing' ), |
|
37 | + 'label' => __('First Name', 'invoicing'), |
|
38 | 38 | 'description' => '', |
39 | 39 | 'required' => false, |
40 | 40 | 'visible' => true, |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | array( |
45 | 45 | 'placeholder' => 'Snow', |
46 | 46 | 'value' => '', |
47 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
47 | + 'label' => __('Last Name', 'invoicing'), |
|
48 | 48 | 'description' => '', |
49 | 49 | 'required' => false, |
50 | 50 | 'visible' => true, |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | array( |
55 | 55 | 'placeholder' => '', |
56 | 56 | 'value' => '', |
57 | - 'label' => __( 'Address', 'invoicing' ), |
|
57 | + 'label' => __('Address', 'invoicing'), |
|
58 | 58 | 'description' => '', |
59 | 59 | 'required' => false, |
60 | 60 | 'visible' => true, |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | array( |
65 | 65 | 'placeholder' => '', |
66 | 66 | 'value' => '', |
67 | - 'label' => __( 'City', 'invoicing' ), |
|
67 | + 'label' => __('City', 'invoicing'), |
|
68 | 68 | 'description' => '', |
69 | 69 | 'required' => false, |
70 | 70 | 'visible' => true, |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | ), |
73 | 73 | |
74 | 74 | array( |
75 | - 'placeholder' => __( 'Select your country' ), |
|
75 | + 'placeholder' => __('Select your country'), |
|
76 | 76 | 'value' => '', |
77 | - 'label' => __( 'Country', 'invoicing' ), |
|
77 | + 'label' => __('Country', 'invoicing'), |
|
78 | 78 | 'description' => '', |
79 | 79 | 'required' => false, |
80 | 80 | 'visible' => true, |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | ), |
83 | 83 | |
84 | 84 | array( |
85 | - 'placeholder' => __( 'Choose a state', 'invoicing' ), |
|
85 | + 'placeholder' => __('Choose a state', 'invoicing'), |
|
86 | 86 | 'value' => '', |
87 | - 'label' => __( 'State / Province', 'invoicing' ), |
|
87 | + 'label' => __('State / Province', 'invoicing'), |
|
88 | 88 | 'description' => '', |
89 | 89 | 'required' => false, |
90 | 90 | 'visible' => true, |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | array( |
95 | 95 | 'placeholder' => '', |
96 | 96 | 'value' => '', |
97 | - 'label' => __( 'ZIP / Postcode', 'invoicing' ), |
|
97 | + 'label' => __('ZIP / Postcode', 'invoicing'), |
|
98 | 98 | 'description' => '', |
99 | 99 | 'required' => false, |
100 | 100 | 'visible' => true, |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | array( |
105 | 105 | 'placeholder' => '', |
106 | 106 | 'value' => '', |
107 | - 'label' => __( 'Phone', 'invoicing' ), |
|
107 | + 'label' => __('Phone', 'invoicing'), |
|
108 | 108 | 'description' => '', |
109 | 109 | 'required' => false, |
110 | 110 | 'visible' => true, |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | array( |
115 | 115 | 'placeholder' => '', |
116 | 116 | 'value' => '', |
117 | - 'label' => __( 'Company', 'invoicing' ), |
|
117 | + 'label' => __('Company', 'invoicing'), |
|
118 | 118 | 'description' => '', |
119 | 119 | 'required' => false, |
120 | 120 | 'visible' => false, |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | array( |
125 | 125 | 'placeholder' => '', |
126 | 126 | 'value' => '', |
127 | - 'label' => __( 'VAT Number', 'invoicing' ), |
|
127 | + 'label' => __('VAT Number', 'invoicing'), |
|
128 | 128 | 'description' => '', |
129 | 129 | 'required' => false, |
130 | 130 | 'visible' => false, |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | ), |
147 | 147 | |
148 | 148 | array( |
149 | - 'text' => __( 'Select Payment Method', 'invoicing' ), |
|
149 | + 'text' => __('Select Payment Method', 'invoicing'), |
|
150 | 150 | 'id' => 'gtscicd', |
151 | 151 | 'name' => 'gtscicd', |
152 | 152 | 'type' => 'gateway_select', |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | |
159 | 159 | 'value' =>'', |
160 | 160 | 'class' => 'btn-primary', |
161 | - 'label' => __( 'Pay Now »', 'invoicing' ), |
|
162 | - 'description' => __( 'By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
161 | + 'label' => __('Pay Now »', 'invoicing'), |
|
162 | + 'description' => __('By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
163 | 163 | 'id' => 'rtqljyy', |
164 | 164 | 'name' => 'rtqljyy', |
165 | 165 | 'type' => 'pay_button', |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @version 1.0.19 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | return array( |
14 | 14 | |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | 'placeholder' => '[email protected]', |
18 | 18 | 'value' => '', |
19 | - 'label' => __( 'Billing Email', 'invoicing' ), |
|
19 | + 'label' => __('Billing Email', 'invoicing'), |
|
20 | 20 | 'description' => '', |
21 | 21 | 'required' => true, |
22 | 22 | 'id' => 'mmdwqzpox', |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ), |
39 | 39 | |
40 | 40 | array( |
41 | - 'text' => __( 'Select Payment Method', 'invoicing' ), |
|
41 | + 'text' => __('Select Payment Method', 'invoicing'), |
|
42 | 42 | 'id' => 'gtscicd', |
43 | 43 | 'name' => 'gtscicd', |
44 | 44 | 'type' => 'gateway_select', |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | |
51 | 51 | 'value' =>'', |
52 | 52 | 'class' => 'btn-primary', |
53 | - 'label' => __( 'Pay Now »', 'invoicing' ), |
|
54 | - 'description' => __( 'By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
53 | + 'label' => __('Pay Now »', 'invoicing'), |
|
54 | + 'description' => __('By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
55 | 55 | 'id' => 'rtqljyy', |
56 | 56 | 'name' => 'rtqljyy', |
57 | 57 | 'type' => 'pay_button', |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Prepare the selectable items. |
13 | 13 | $selectable = array(); |
14 | -foreach ( $form->get_items() as $item ) { |
|
15 | - if ( ! $item->is_required ) { |
|
16 | - $selectable[$item->get_id()] = $item->get_name() . ' — ' . wpinv_price( wpinv_format_amount( $item->get_initial_price() ) ); |
|
14 | +foreach ($form->get_items() as $item) { |
|
15 | + if (!$item->is_required) { |
|
16 | + $selectable[$item->get_id()] = $item->get_name() . ' — ' . wpinv_price(wpinv_format_amount($item->get_initial_price())); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | -if ( empty( $selectable ) ) { |
|
20 | +if (empty($selectable)) { |
|
21 | 21 | return; |
22 | 22 | } |
23 | 23 | |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | echo aui()->radio( |
28 | 28 | array( |
29 | 29 | 'name' => 'getpaid-payment-form-selected-item', |
30 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
30 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_'), |
|
31 | 31 | 'required' => true, |
32 | - 'label' => __( 'Select Item', 'invoicing' ), |
|
32 | + 'label' => __('Select Item', 'invoicing'), |
|
33 | 33 | 'label_type' => 'vertical', |
34 | 34 | 'inline' => false, |
35 | 35 | 'options' => $selectable, |
@@ -7,29 +7,29 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Prepare the selectable items. |
13 | 13 | $selectable = array(); |
14 | -foreach ( $form->get_items() as $item ) { |
|
15 | - if ( ! $item->is_required ) { |
|
16 | - $selectable[$item->get_id()] = $item->get_name() . ' — ' . wpinv_price( wpinv_format_amount( $item->get_initial_price() ) ); |
|
14 | +foreach ($form->get_items() as $item) { |
|
15 | + if (!$item->is_required) { |
|
16 | + $selectable[$item->get_id()] = $item->get_name() . ' — ' . wpinv_price(wpinv_format_amount($item->get_initial_price())); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | -if ( empty( $selectable ) ) { |
|
20 | +if (empty($selectable)) { |
|
21 | 21 | return; |
22 | 22 | } |
23 | 23 | |
24 | 24 | echo '<div class="getpaid-payment-form-items-checkbox form-group">'; |
25 | 25 | |
26 | -foreach ( $selectable as $item_id => $item_name ) { |
|
26 | +foreach ($selectable as $item_id => $item_name) { |
|
27 | 27 | |
28 | 28 | echo aui()->input( |
29 | 29 | array( |
30 | 30 | 'type' => 'checkbox', |
31 | 31 | 'name' => 'getpaid-payment-form-selected-item', |
32 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ) . $item_id, |
|
32 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_') . $item_id, |
|
33 | 33 | 'label' => $item_name, |
34 | 34 | 'value' => $item_id, |
35 | 35 | 'no_wrap' => true, |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if (!defined('ABSPATH')) exit; |
|
4 | 4 | |
5 | -function wpinv_get_users_invoices( $user = 0, $number = 20, $pagination = false, $status = 'publish', $orderby = 'ID', $order = 'DESC' ) { |
|
6 | - if ( empty( $user ) ) { |
|
5 | +function wpinv_get_users_invoices($user = 0, $number = 20, $pagination = false, $status = 'publish', $orderby = 'ID', $order = 'DESC') { |
|
6 | + if (empty($user)) { |
|
7 | 7 | $user = get_current_user_id(); |
8 | 8 | } |
9 | 9 | |
10 | - if ( empty( $user ) ) { |
|
10 | + if (empty($user)) { |
|
11 | 11 | return false; |
12 | 12 | } |
13 | 13 | |
14 | - $args = apply_filters( 'wpinv_get_users_invoices_args', array( 'user' => $user, 'limit' => $number, 'status' => $status, 'paginate' => $pagination, 'orderby' => $orderby, 'order' => $order ) ); |
|
14 | + $args = apply_filters('wpinv_get_users_invoices_args', array('user' => $user, 'limit' => $number, 'status' => $status, 'paginate' => $pagination, 'orderby' => $orderby, 'order' => $order)); |
|
15 | 15 | |
16 | - return wpinv_get_invoices( $args ); |
|
16 | + return wpinv_get_invoices($args); |
|
17 | 17 | } |
18 | 18 | |
19 | -function wpinv_dropdown_users( $args = '' ) { |
|
19 | +function wpinv_dropdown_users($args = '') { |
|
20 | 20 | $defaults = array( |
21 | 21 | 'show_option_all' => '', 'show_option_none' => '', 'hide_if_only_one_author' => '', |
22 | 22 | 'orderby' => 'display_name', 'order' => 'ASC', |
@@ -27,18 +27,18 @@ discard block |
||
27 | 27 | 'option_none_value' => -1 |
28 | 28 | ); |
29 | 29 | |
30 | - $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0; |
|
30 | + $defaults['selected'] = is_author() ? get_query_var('author') : 0; |
|
31 | 31 | |
32 | - $r = wp_parse_args( $args, $defaults ); |
|
32 | + $r = wp_parse_args($args, $defaults); |
|
33 | 33 | |
34 | - $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) ); |
|
34 | + $query_args = wp_array_slice_assoc($r, array('blog_id', 'include', 'exclude', 'orderby', 'order', 'who')); |
|
35 | 35 | |
36 | - $fields = array( 'ID', 'user_login', 'user_email' ); |
|
36 | + $fields = array('ID', 'user_login', 'user_email'); |
|
37 | 37 | |
38 | - $show = ! empty( $r['show'] ) ? $r['show'] : 'display_name'; |
|
39 | - if ( 'display_name_with_login' === $show ) { |
|
38 | + $show = !empty($r['show']) ? $r['show'] : 'display_name'; |
|
39 | + if ('display_name_with_login' === $show) { |
|
40 | 40 | $fields[] = 'display_name'; |
41 | - } else if ( 'display_name_with_email' === $show ) { |
|
41 | + } else if ('display_name_with_email' === $show) { |
|
42 | 42 | $fields[] = 'display_name'; |
43 | 43 | } else { |
44 | 44 | $fields[] = $show; |
@@ -50,99 +50,99 @@ discard block |
||
50 | 50 | $show_option_none = $r['show_option_none']; |
51 | 51 | $option_none_value = $r['option_none_value']; |
52 | 52 | |
53 | - $query_args = apply_filters( 'wpinv_dropdown_users_args', $query_args, $r ); |
|
53 | + $query_args = apply_filters('wpinv_dropdown_users_args', $query_args, $r); |
|
54 | 54 | |
55 | - $users = get_users( $query_args ); |
|
55 | + $users = get_users($query_args); |
|
56 | 56 | |
57 | 57 | $output = ''; |
58 | - if ( ! empty( $users ) && ( empty( $r['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) { |
|
59 | - $name = esc_attr( $r['name'] ); |
|
60 | - if ( $r['multi'] && ! $r['id'] ) { |
|
58 | + if (!empty($users) && (empty($r['hide_if_only_one_author']) || count($users) > 1)) { |
|
59 | + $name = esc_attr($r['name']); |
|
60 | + if ($r['multi'] && !$r['id']) { |
|
61 | 61 | $id = ''; |
62 | 62 | } else { |
63 | - $id = $r['id'] ? " id='" . esc_attr( $r['id'] ) . "'" : " id='$name'"; |
|
63 | + $id = $r['id'] ? " id='" . esc_attr($r['id']) . "'" : " id='$name'"; |
|
64 | 64 | } |
65 | 65 | $output = "<select name='{$name}'{$id} class='" . $r['class'] . "'>\n"; |
66 | 66 | |
67 | - if ( $show_option_all ) { |
|
67 | + if ($show_option_all) { |
|
68 | 68 | $output .= "\t<option value='0'>$show_option_all</option>\n"; |
69 | 69 | } |
70 | 70 | |
71 | - if ( $show_option_none ) { |
|
72 | - $_selected = selected( $option_none_value, $r['selected'], false ); |
|
73 | - $output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$_selected>$show_option_none</option>\n"; |
|
71 | + if ($show_option_none) { |
|
72 | + $_selected = selected($option_none_value, $r['selected'], false); |
|
73 | + $output .= "\t<option value='" . esc_attr($option_none_value) . "'$_selected>$show_option_none</option>\n"; |
|
74 | 74 | } |
75 | 75 | |
76 | - if ( $r['include_selected'] && ( $r['selected'] > 0 ) ) { |
|
76 | + if ($r['include_selected'] && ($r['selected'] > 0)) { |
|
77 | 77 | $found_selected = false; |
78 | 78 | $r['selected'] = (int) $r['selected']; |
79 | - foreach ( (array) $users as $user ) { |
|
79 | + foreach ((array) $users as $user) { |
|
80 | 80 | $user->ID = (int) $user->ID; |
81 | - if ( $user->ID === $r['selected'] ) { |
|
81 | + if ($user->ID === $r['selected']) { |
|
82 | 82 | $found_selected = true; |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - if ( ! $found_selected ) { |
|
87 | - $users[] = get_userdata( $r['selected'] ); |
|
86 | + if (!$found_selected) { |
|
87 | + $users[] = get_userdata($r['selected']); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | - foreach ( (array) $users as $user ) { |
|
92 | - if ( 'display_name_with_login' === $show ) { |
|
91 | + foreach ((array) $users as $user) { |
|
92 | + if ('display_name_with_login' === $show) { |
|
93 | 93 | /* translators: 1: display name, 2: user_login */ |
94 | - $display = sprintf( _x( '%1$s (%2$s)', 'user dropdown' ), $user->display_name, $user->user_login ); |
|
95 | - } elseif ( 'display_name_with_email' === $show ) { |
|
94 | + $display = sprintf(_x('%1$s (%2$s)', 'user dropdown'), $user->display_name, $user->user_login); |
|
95 | + } elseif ('display_name_with_email' === $show) { |
|
96 | 96 | /* translators: 1: display name, 2: user_email */ |
97 | - if ( $user->display_name == $user->user_email ) { |
|
97 | + if ($user->display_name == $user->user_email) { |
|
98 | 98 | $display = $user->display_name; |
99 | 99 | } else { |
100 | - $display = sprintf( _x( '%1$s (%2$s)', 'user dropdown' ), $user->display_name, $user->user_email ); |
|
100 | + $display = sprintf(_x('%1$s (%2$s)', 'user dropdown'), $user->display_name, $user->user_email); |
|
101 | 101 | } |
102 | - } elseif ( ! empty( $user->$show ) ) { |
|
102 | + } elseif (!empty($user->$show)) { |
|
103 | 103 | $display = $user->$show; |
104 | 104 | } else { |
105 | 105 | $display = '(' . $user->user_login . ')'; |
106 | 106 | } |
107 | 107 | |
108 | - $_selected = selected( $user->ID, $r['selected'], false ); |
|
109 | - $output .= "\t<option value='$user->ID'$_selected>" . esc_html( $display ) . "</option>\n"; |
|
108 | + $_selected = selected($user->ID, $r['selected'], false); |
|
109 | + $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n"; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $output .= "</select>"; |
113 | 113 | } |
114 | 114 | |
115 | - $html = apply_filters( 'wpinv_dropdown_users', $output ); |
|
115 | + $html = apply_filters('wpinv_dropdown_users', $output); |
|
116 | 116 | |
117 | - if ( $r['echo'] ) { |
|
117 | + if ($r['echo']) { |
|
118 | 118 | echo $html; |
119 | 119 | } |
120 | 120 | return $html; |
121 | 121 | } |
122 | 122 | |
123 | -function wpinv_guest_redirect( $redirect_to, $user_id = 0 ) { |
|
124 | - if ( (int)wpinv_get_option( 'guest_checkout' ) && $user_id > 0 ) { |
|
125 | - wpinv_login_user( $user_id ); |
|
123 | +function wpinv_guest_redirect($redirect_to, $user_id = 0) { |
|
124 | + if ((int) wpinv_get_option('guest_checkout') && $user_id > 0) { |
|
125 | + wpinv_login_user($user_id); |
|
126 | 126 | } else { |
127 | - $redirect_to = wp_login_url( $redirect_to ); |
|
127 | + $redirect_to = wp_login_url($redirect_to); |
|
128 | 128 | } |
129 | 129 | |
130 | - $redirect_to = apply_filters( 'wpinv_invoice_link_guest_redirect', $redirect_to, $user_id ); |
|
130 | + $redirect_to = apply_filters('wpinv_invoice_link_guest_redirect', $redirect_to, $user_id); |
|
131 | 131 | |
132 | - wp_redirect( $redirect_to ); |
|
132 | + wp_redirect($redirect_to); |
|
133 | 133 | } |
134 | 134 | |
135 | -function wpinv_login_user( $user_id ) { |
|
136 | - if ( is_user_logged_in() ) { |
|
135 | +function wpinv_login_user($user_id) { |
|
136 | + if (is_user_logged_in()) { |
|
137 | 137 | return true; |
138 | 138 | } |
139 | 139 | |
140 | - $user = get_user_by( 'id', $user_id ); |
|
140 | + $user = get_user_by('id', $user_id); |
|
141 | 141 | |
142 | - if ( !empty( $user ) && !is_wp_error( $user ) && !empty( $user->user_login ) ) { |
|
143 | - wp_set_current_user( $user_id, $user->user_login ); |
|
144 | - wp_set_auth_cookie( $user_id ); |
|
145 | - do_action( 'wp_login', $user->user_login ); |
|
142 | + if (!empty($user) && !is_wp_error($user) && !empty($user->user_login)) { |
|
143 | + wp_set_current_user($user_id, $user->user_login); |
|
144 | + wp_set_auth_cookie($user_id); |
|
145 | + do_action('wp_login', $user->user_login); |
|
146 | 146 | |
147 | 147 | return true; |
148 | 148 | } |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | * @return string capability to check against |
158 | 158 | * @param string $capalibilty Optional. The alternative capability to check against. |
159 | 159 | */ |
160 | -function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
|
160 | +function wpinv_get_capability($capalibilty = 'manage_invoicing') { |
|
161 | 161 | |
162 | - if ( current_user_can( 'manage_options' ) ) { |
|
162 | + if (current_user_can('manage_options')) { |
|
163 | 163 | return 'manage_options'; |
164 | 164 | }; |
165 | 165 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @return bool |
174 | 174 | */ |
175 | 175 | function wpinv_current_user_can_manage_invoicing() { |
176 | - return current_user_can( wpinv_get_capability() ); |
|
176 | + return current_user_can(wpinv_get_capability()); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -182,17 +182,17 @@ discard block |
||
182 | 182 | * @since 1.0.19 |
183 | 183 | * @return int|WP_Error |
184 | 184 | */ |
185 | -function wpinv_create_user( $email ) { |
|
185 | +function wpinv_create_user($email) { |
|
186 | 186 | |
187 | 187 | // Prepare user values. |
188 | 188 | $args = array( |
189 | - 'user_login' => wpinv_generate_user_name( $email ), |
|
189 | + 'user_login' => wpinv_generate_user_name($email), |
|
190 | 190 | 'user_pass' => wp_generate_password(), |
191 | 191 | 'user_email' => $email, |
192 | 192 | 'role' => 'subscriber', |
193 | 193 | ); |
194 | 194 | |
195 | - return wp_insert_user( $args ); |
|
195 | + return wp_insert_user($args); |
|
196 | 196 | |
197 | 197 | } |
198 | 198 | |
@@ -202,22 +202,22 @@ discard block |
||
202 | 202 | * @since 1.0.19 |
203 | 203 | * @return bool|WP_User |
204 | 204 | */ |
205 | -function wpinv_generate_user_name( $prefix = '' ) { |
|
205 | +function wpinv_generate_user_name($prefix = '') { |
|
206 | 206 | |
207 | 207 | // If prefix is an email, retrieve the part before the email. |
208 | - $prefix = strtok( $prefix, '@' ); |
|
208 | + $prefix = strtok($prefix, '@'); |
|
209 | 209 | |
210 | 210 | // Trim to 4 characters max. |
211 | - $prefix = sanitize_user( $prefix ); |
|
211 | + $prefix = sanitize_user($prefix); |
|
212 | 212 | |
213 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
214 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
213 | + $illegal_logins = (array) apply_filters('illegal_user_logins', array()); |
|
214 | + if (empty($prefix) || in_array(strtolower($prefix), array_map('strtolower', $illegal_logins), true)) { |
|
215 | 215 | $prefix = 'gtp'; |
216 | 216 | } |
217 | 217 | |
218 | - $username = $prefix . '_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
219 | - if ( username_exists( $username ) ) { |
|
220 | - return wpinv_generate_user_name( $username ); |
|
218 | + $username = $prefix . '_' . zeroise(wp_rand(0, 9999), 4); |
|
219 | + if (username_exists($username)) { |
|
220 | + return wpinv_generate_user_name($username); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return $username; |
@@ -1,39 +1,39 @@ |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class WPInv_Meta_Box_Notes { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | global $post; |
10 | 10 | |
11 | - $notes = wpinv_get_invoice_notes( $post->ID ); |
|
11 | + $notes = wpinv_get_invoice_notes($post->ID); |
|
12 | 12 | |
13 | 13 | echo '<ul class="invoice_notes">'; |
14 | 14 | |
15 | - if ( $notes ) { |
|
16 | - foreach( $notes as $note ) { |
|
17 | - wpinv_get_invoice_note_line_item( $note ); |
|
15 | + if ($notes) { |
|
16 | + foreach ($notes as $note) { |
|
17 | + wpinv_get_invoice_note_line_item($note); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | } else { |
21 | - echo '<li>' . __( 'There are no notes yet.', 'invoicing' ) . '</li>'; |
|
21 | + echo '<li>' . __('There are no notes yet.', 'invoicing') . '</li>'; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | echo '</ul>'; |
25 | 25 | ?> |
26 | 26 | <div class="add_note"> |
27 | - <h4><?php _e( 'Add note', 'invoicing' ); ?></h4> |
|
27 | + <h4><?php _e('Add note', 'invoicing'); ?></h4> |
|
28 | 28 | <p> |
29 | 29 | <textarea type="text" name="invoice_note" id="add_invoice_note" class="input-text" cols="20" rows="5"></textarea> |
30 | 30 | </p> |
31 | 31 | <p> |
32 | 32 | <select name="invoice_note_type" id="invoice_note_type" class="regular-text"> |
33 | - <option value=""><?php _e( 'Private note', 'invoicing' ); ?></option> |
|
34 | - <option value="customer"><?php _e( 'Note to customer', 'invoicing' ); ?></option> |
|
33 | + <option value=""><?php _e('Private note', 'invoicing'); ?></option> |
|
34 | + <option value="customer"><?php _e('Note to customer', 'invoicing'); ?></option> |
|
35 | 35 | </select> |
36 | - <a href="#" class="add_note button"><?php _e( 'Add', 'invoicing' ); ?></a> <span class="description"><?php _e( 'Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing' ); ?></span> |
|
36 | + <a href="#" class="add_note button"><?php _e('Add', 'invoicing'); ?></a> <span class="description"><?php _e('Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing'); ?></span> |
|
37 | 37 | </p> |
38 | 38 | </div> |
39 | 39 | <?php |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | 28 | |
29 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
29 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
30 | 30 | |
31 | 31 | ?> |
32 | 32 | |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | <div class="col-12 col-sm-6"> |
43 | 43 | <div id="getpaid-invoice-user-id-wrapper" class="form-group"> |
44 | 44 | <div> |
45 | - <label for="post_author_override"><?php _e( 'Customer', 'invoicing' );?></label> |
|
45 | + <label for="post_author_override"><?php _e('Customer', 'invoicing'); ?></label> |
|
46 | 46 | </div> |
47 | 47 | <?php |
48 | 48 | wpinv_dropdown_users( |
49 | 49 | array( |
50 | 50 | 'name' => 'post_author_override', |
51 | - 'selected' => $invoice->get_id() ? $invoice->get_user_id( 'edit' ) : get_current_user_id(), |
|
51 | + 'selected' => $invoice->get_id() ? $invoice->get_user_id('edit') : get_current_user_id(), |
|
52 | 52 | 'include_selected' => true, |
53 | 53 | 'show' => 'display_name_with_email', |
54 | 54 | 'orderby' => 'user_email', |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | 'type' => 'text', |
67 | 67 | 'id' => 'getpaid-invoice-new-user-email', |
68 | 68 | 'name' => 'wpinv_email', |
69 | - 'label' => __( 'Email', 'invoicing' ) . '<span class="required">*</span>', |
|
69 | + 'label' => __('Email', 'invoicing') . '<span class="required">*</span>', |
|
70 | 70 | 'label_type' => 'vertical', |
71 | 71 | 'placeholder' => '[email protected]', |
72 | 72 | 'class' => 'form-control-sm', |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | </div> |
77 | 77 | </div> |
78 | 78 | <div class="col-12 col-sm-6 form-group mt-sm-4"> |
79 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?> |
|
79 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?> |
|
80 | 80 | <a id="getpaid-invoice-fill-user-details" class="button button-small button-secondary" href="javascript:void(0)"> |
81 | 81 | <i aria-hidden="true" class="fa fa-refresh"></i> |
82 | - <?php _e( 'Fill User Details', 'invoicing' );?> |
|
82 | + <?php _e('Fill User Details', 'invoicing'); ?> |
|
83 | 83 | </a> |
84 | 84 | <a id="getpaid-invoice-create-new-user-button" class="button button-small button-secondary" href="javascript:void(0)"> |
85 | 85 | <i aria-hidden="true" class="fa fa-plus"></i> |
86 | - <?php _e( 'Add New User', 'invoicing' );?> |
|
86 | + <?php _e('Add New User', 'invoicing'); ?> |
|
87 | 87 | </a> |
88 | 88 | <a id="getpaid-invoice-cancel-create-new-user" class="button button-small button-secondary d-none" href="javascript:void(0)"> |
89 | 89 | <i aria-hidden="true" class="fa fa-close"></i> |
90 | - <?php _e( 'Cancel', 'invoicing' );?> |
|
90 | + <?php _e('Cancel', 'invoicing'); ?> |
|
91 | 91 | </a> |
92 | 92 | <?php endif; ?> |
93 | 93 | </div> |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | 'type' => 'text', |
101 | 101 | 'id' => 'wpinv_first_name', |
102 | 102 | 'name' => 'wpinv_first_name', |
103 | - 'label' => __( 'First Name', 'invoicing' ), |
|
103 | + 'label' => __('First Name', 'invoicing'), |
|
104 | 104 | 'label_type' => 'vertical', |
105 | 105 | 'placeholder' => 'Jane', |
106 | 106 | 'class' => 'form-control-sm', |
107 | - 'value' => $invoice->get_first_name( 'edit' ), |
|
107 | + 'value' => $invoice->get_first_name('edit'), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | ?> |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | 'type' => 'text', |
117 | 117 | 'id' => 'wpinv_last_name', |
118 | 118 | 'name' => 'wpinv_last_name', |
119 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
119 | + 'label' => __('Last Name', 'invoicing'), |
|
120 | 120 | 'label_type' => 'vertical', |
121 | 121 | 'placeholder' => 'Doe', |
122 | 122 | 'class' => 'form-control-sm', |
123 | - 'value' => $invoice->get_last_name( 'edit' ), |
|
123 | + 'value' => $invoice->get_last_name('edit'), |
|
124 | 124 | ) |
125 | 125 | ); |
126 | 126 | ?> |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | 'type' => 'text', |
136 | 136 | 'id' => 'wpinv_company', |
137 | 137 | 'name' => 'wpinv_company', |
138 | - 'label' => __( 'Company', 'invoicing' ), |
|
138 | + 'label' => __('Company', 'invoicing'), |
|
139 | 139 | 'label_type' => 'vertical', |
140 | 140 | 'placeholder' => 'Acme Corporation', |
141 | 141 | 'class' => 'form-control-sm', |
142 | - 'value' => $invoice->get_company( 'edit' ), |
|
142 | + 'value' => $invoice->get_company('edit'), |
|
143 | 143 | ) |
144 | 144 | ); |
145 | 145 | ?> |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | 'type' => 'text', |
152 | 152 | 'id' => 'wpinv_vat_number', |
153 | 153 | 'name' => 'wpinv_vat_number', |
154 | - 'label' => __( 'Vat Number', 'invoicing' ), |
|
154 | + 'label' => __('Vat Number', 'invoicing'), |
|
155 | 155 | 'label_type' => 'vertical', |
156 | 156 | 'placeholder' => '1234567890', |
157 | 157 | 'class' => 'form-control-sm', |
158 | - 'value' => $invoice->get_vat_number( 'edit' ), |
|
158 | + 'value' => $invoice->get_vat_number('edit'), |
|
159 | 159 | ) |
160 | 160 | ); |
161 | 161 | ?> |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | 'type' => 'text', |
171 | 171 | 'id' => 'wpinv_address', |
172 | 172 | 'name' => 'wpinv_address', |
173 | - 'label' => __( 'Address', 'invoicing' ), |
|
173 | + 'label' => __('Address', 'invoicing'), |
|
174 | 174 | 'label_type' => 'vertical', |
175 | 175 | 'placeholder' => 'Blekersdijk 295', |
176 | 176 | 'class' => 'form-control-sm', |
177 | - 'value' => $invoice->get_address( 'edit' ), |
|
177 | + 'value' => $invoice->get_address('edit'), |
|
178 | 178 | ) |
179 | 179 | ); |
180 | 180 | ?> |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | 'type' => 'text', |
187 | 187 | 'id' => 'wpinv_city', |
188 | 188 | 'name' => 'wpinv_city', |
189 | - 'label' => __( 'City', 'invoicing' ), |
|
189 | + 'label' => __('City', 'invoicing'), |
|
190 | 190 | 'label_type' => 'vertical', |
191 | 191 | 'placeholder' => 'Dolembreux', |
192 | 192 | 'class' => 'form-control-sm', |
193 | - 'value' => $invoice->get_vat_number( 'edit' ), |
|
193 | + 'value' => $invoice->get_vat_number('edit'), |
|
194 | 194 | ) |
195 | 195 | ); |
196 | 196 | ?> |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | array( |
205 | 205 | 'id' => 'wpinv_country', |
206 | 206 | 'name' => 'wpinv_country', |
207 | - 'label' => __( 'Country', 'invoicing' ), |
|
207 | + 'label' => __('Country', 'invoicing'), |
|
208 | 208 | 'label_type' => 'vertical', |
209 | - 'placeholder' => __( 'Choose a country', 'invoicing' ), |
|
209 | + 'placeholder' => __('Choose a country', 'invoicing'), |
|
210 | 210 | 'class' => 'form-control-sm', |
211 | - 'value' => $invoice->get_country( 'edit' ), |
|
211 | + 'value' => $invoice->get_country('edit'), |
|
212 | 212 | 'options' => wpinv_get_country_list(), |
213 | 213 | 'data-allow-clear' => 'false', |
214 | 214 | 'select2' => true, |
@@ -219,20 +219,20 @@ discard block |
||
219 | 219 | <div class="col-12 col-sm-6"> |
220 | 220 | <?php |
221 | 221 | |
222 | - $states = wpinv_get_country_states( $invoice->get_country( 'edit' ) ); |
|
222 | + $states = wpinv_get_country_states($invoice->get_country('edit')); |
|
223 | 223 | |
224 | - if ( empty( $states ) ) { |
|
224 | + if (empty($states)) { |
|
225 | 225 | |
226 | 226 | echo aui()->input( |
227 | 227 | array( |
228 | 228 | 'type' => 'text', |
229 | 229 | 'id' => 'wpinv_state', |
230 | 230 | 'name' => 'wpinv_state', |
231 | - 'label' => __( 'State', 'invoicing' ), |
|
231 | + 'label' => __('State', 'invoicing'), |
|
232 | 232 | 'label_type' => 'vertical', |
233 | 233 | 'placeholder' => 'Liège', |
234 | 234 | 'class' => 'form-control-sm', |
235 | - 'value' => $invoice->get_state( 'edit' ), |
|
235 | + 'value' => $invoice->get_state('edit'), |
|
236 | 236 | ) |
237 | 237 | ); |
238 | 238 | |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | array( |
243 | 243 | 'id' => 'wpinv_state', |
244 | 244 | 'name' => 'wpinv_state', |
245 | - 'label' => __( 'State', 'invoicing' ), |
|
245 | + 'label' => __('State', 'invoicing'), |
|
246 | 246 | 'label_type' => 'vertical', |
247 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
247 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
248 | 248 | 'class' => 'form-control-sm', |
249 | - 'value' => $invoice->get_state( 'edit' ), |
|
249 | + 'value' => $invoice->get_state('edit'), |
|
250 | 250 | 'options' => $states, |
251 | 251 | 'data-allow-clear' => 'false', |
252 | 252 | 'select2' => true, |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | 'type' => 'text', |
268 | 268 | 'id' => 'wpinv_zip', |
269 | 269 | 'name' => 'wpinv_zip', |
270 | - 'label' => __( 'Zip / Postal Code', 'invoicing' ), |
|
270 | + 'label' => __('Zip / Postal Code', 'invoicing'), |
|
271 | 271 | 'label_type' => 'vertical', |
272 | 272 | 'placeholder' => '4140', |
273 | 273 | 'class' => 'form-control-sm', |
274 | - 'value' => $invoice->get_zip( 'edit' ), |
|
274 | + 'value' => $invoice->get_zip('edit'), |
|
275 | 275 | ) |
276 | 276 | ); |
277 | 277 | ?> |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | 'type' => 'text', |
284 | 284 | 'id' => 'wpinv_phone', |
285 | 285 | 'name' => 'wpinv_phone', |
286 | - 'label' => __( 'Phone', 'invoicing' ), |
|
286 | + 'label' => __('Phone', 'invoicing'), |
|
287 | 287 | 'label_type' => 'vertical', |
288 | 288 | 'placeholder' => '0493 18 45822', |
289 | 289 | 'class' => 'form-control-sm', |
290 | - 'value' => $invoice->get_phone( 'edit' ), |
|
290 | + 'value' => $invoice->get_phone('edit'), |
|
291 | 291 | ) |
292 | 292 | ); |
293 | 293 | ?> |
@@ -304,34 +304,34 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @param int $post_id |
306 | 306 | */ |
307 | - public static function save( $post_id ) { |
|
307 | + public static function save($post_id) { |
|
308 | 308 | |
309 | 309 | // Prepare the invoice. |
310 | - $invoice = new WPInv_Invoice( $post_id ); |
|
310 | + $invoice = new WPInv_Invoice($post_id); |
|
311 | 311 | |
312 | 312 | // Load new data. |
313 | 313 | $invoice->set_props( |
314 | 314 | array( |
315 | - 'template' => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null, |
|
316 | - 'email_cc' => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null, |
|
317 | - 'disable_taxes' => isset( $_POST['disable_taxes'] ), |
|
318 | - 'currency' => isset( $_POST['wpinv_currency'] ) ? wpinv_clean( $_POST['wpinv_currency'] ) : null, |
|
319 | - 'gateway' => isset( $_POST['wpinv_gateway'] ) ? wpinv_clean( $_POST['wpinv_gateway'] ) : null, |
|
320 | - 'address' => isset( $_POST['wpinv_address'] ) ? wpinv_clean( $_POST['wpinv_address'] ) : null, |
|
321 | - 'vat_number' => isset( $_POST['wpinv_vat_number'] ) ? wpinv_clean( $_POST['wpinv_vat_number'] ) : null, |
|
322 | - 'company' => isset( $_POST['wpinv_company'] ) ? wpinv_clean( $_POST['wpinv_company'] ) : null, |
|
323 | - 'zip' => isset( $_POST['wpinv_zip'] ) ? wpinv_clean( $_POST['wpinv_zip'] ) : null, |
|
324 | - 'state' => isset( $_POST['wpinv_state'] ) ? wpinv_clean( $_POST['wpinv_state'] ) : null, |
|
325 | - 'city' => isset( $_POST['wpinv_city'] ) ? wpinv_clean( $_POST['wpinv_city'] ) : null, |
|
326 | - 'country' => isset( $_POST['wpinv_country'] ) ? wpinv_clean( $_POST['wpinv_country'] ) : null, |
|
327 | - 'phone' => isset( $_POST['wpinv_phone'] ) ? wpinv_clean( $_POST['wpinv_phone'] ) : null, |
|
328 | - 'first_name' => isset( $_POST['wpinv_first_name'] ) ? wpinv_clean( $_POST['wpinv_first_name'] ) : null, |
|
329 | - 'last_name' => isset( $_POST['wpinv_last_name'] ) ? wpinv_clean( $_POST['wpinv_last_name'] ) : null, |
|
330 | - 'author' => isset( $_POST['post_author_override'] ) ? wpinv_clean( $_POST['post_author_override'] ) : null, |
|
331 | - 'date_created' => isset( $_POST['date_created'] ) ? wpinv_clean( $_POST['date_created'] ) : null, |
|
332 | - 'due_date' => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null, |
|
333 | - 'number' => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null, |
|
334 | - 'status' => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null, |
|
315 | + 'template' => isset($_POST['wpinv_template']) ? wpinv_clean($_POST['wpinv_template']) : null, |
|
316 | + 'email_cc' => isset($_POST['wpinv_cc']) ? wpinv_clean($_POST['wpinv_cc']) : null, |
|
317 | + 'disable_taxes' => isset($_POST['disable_taxes']), |
|
318 | + 'currency' => isset($_POST['wpinv_currency']) ? wpinv_clean($_POST['wpinv_currency']) : null, |
|
319 | + 'gateway' => isset($_POST['wpinv_gateway']) ? wpinv_clean($_POST['wpinv_gateway']) : null, |
|
320 | + 'address' => isset($_POST['wpinv_address']) ? wpinv_clean($_POST['wpinv_address']) : null, |
|
321 | + 'vat_number' => isset($_POST['wpinv_vat_number']) ? wpinv_clean($_POST['wpinv_vat_number']) : null, |
|
322 | + 'company' => isset($_POST['wpinv_company']) ? wpinv_clean($_POST['wpinv_company']) : null, |
|
323 | + 'zip' => isset($_POST['wpinv_zip']) ? wpinv_clean($_POST['wpinv_zip']) : null, |
|
324 | + 'state' => isset($_POST['wpinv_state']) ? wpinv_clean($_POST['wpinv_state']) : null, |
|
325 | + 'city' => isset($_POST['wpinv_city']) ? wpinv_clean($_POST['wpinv_city']) : null, |
|
326 | + 'country' => isset($_POST['wpinv_country']) ? wpinv_clean($_POST['wpinv_country']) : null, |
|
327 | + 'phone' => isset($_POST['wpinv_phone']) ? wpinv_clean($_POST['wpinv_phone']) : null, |
|
328 | + 'first_name' => isset($_POST['wpinv_first_name']) ? wpinv_clean($_POST['wpinv_first_name']) : null, |
|
329 | + 'last_name' => isset($_POST['wpinv_last_name']) ? wpinv_clean($_POST['wpinv_last_name']) : null, |
|
330 | + 'author' => isset($_POST['post_author_override']) ? wpinv_clean($_POST['post_author_override']) : null, |
|
331 | + 'date_created' => isset($_POST['date_created']) ? wpinv_clean($_POST['date_created']) : null, |
|
332 | + 'due_date' => isset($_POST['wpinv_due_date']) ? wpinv_clean($_POST['wpinv_due_date']) : null, |
|
333 | + 'number' => isset($_POST['wpinv_number']) ? wpinv_clean($_POST['wpinv_number']) : null, |
|
334 | + 'status' => isset($_POST['wpinv_status']) ? wpinv_clean($_POST['wpinv_status']) : null, |
|
335 | 335 | ) |
336 | 336 | ); |
337 | 337 | |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | $invoice->recalculate_total(); |
340 | 340 | |
341 | 341 | // If we're creating a new user... |
342 | - if ( ! empty( $_POST['wpinv_new_user'] ) && is_email( $_POST['wpinv_email'] ) ) { |
|
342 | + if (!empty($_POST['wpinv_new_user']) && is_email($_POST['wpinv_email'])) { |
|
343 | 343 | |
344 | 344 | // Attempt to create the user. |
345 | - $user = wpinv_create_user( sanitize_email( $_POST['wpinv_email'] ) ); |
|
345 | + $user = wpinv_create_user(sanitize_email($_POST['wpinv_email'])); |
|
346 | 346 | |
347 | 347 | |
348 | 348 | // If successful, update the invoice author. |
349 | - if ( is_numeric( $user ) ) { |
|
350 | - $invoice->set_author( $user ); |
|
349 | + if (is_numeric($user)) { |
|
350 | + $invoice->set_author($user); |
|
351 | 351 | } else { |
352 | - wpinv_error_log( $user->get_error_message(), __( 'Invoice add new user', 'invoicing' ), __FILE__, __LINE__ ); |
|
352 | + wpinv_error_log($user->get_error_message(), __('Invoice add new user', 'invoicing'), __FILE__, __LINE__); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
@@ -357,11 +357,11 @@ discard block |
||
357 | 357 | $invoice->save(); |
358 | 358 | |
359 | 359 | // (Maybe) send new user notification. |
360 | - if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', true ) ) { |
|
361 | - wp_send_new_user_notifications( $user, 'user' ); |
|
360 | + if (!empty($user) && is_numeric($user) && apply_filters('getpaid_send_new_user_notification', true)) { |
|
361 | + wp_send_new_user_notifications($user, 'user'); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | // Fires after an invoice is saved. |
365 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
365 | + do_action('wpinv_invoice_metabox_saved', $invoice); |
|
366 | 366 | } |
367 | 367 | } |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$invoice = new WPInv_Invoice( $invoice ); |
|
13 | -$address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() ); |
|
12 | +$invoice = new WPInv_Invoice($invoice); |
|
13 | +$address_row = wpinv_get_invoice_address_markup($invoice->get_user_info()); |
|
14 | 14 | $phone = $invoice->get_phone(); |
15 | 15 | $email = $invoice->get_email(); |
16 | 16 | |
@@ -21,36 +21,36 @@ discard block |
||
21 | 21 | |
22 | 22 | |
23 | 23 | <div class="invoice-billing-address-label col-2"> |
24 | - <strong><?php _e( 'To:', 'invoicing' ) ?></strong> |
|
24 | + <strong><?php _e('To:', 'invoicing') ?></strong> |
|
25 | 25 | </div> |
26 | 26 | |
27 | 27 | |
28 | 28 | <div class="invoice-billing-address-value col-10"> |
29 | 29 | |
30 | - <?php do_action( 'getpaid_billing_address_top' ); ?> |
|
30 | + <?php do_action('getpaid_billing_address_top'); ?> |
|
31 | 31 | |
32 | - <?php if ( ! empty( $address_row ) ) : ?> |
|
32 | + <?php if (!empty($address_row)) : ?> |
|
33 | 33 | <div class="billing-address"> |
34 | 34 | <?php echo $address_row; ?> |
35 | 35 | </div> |
36 | 36 | <?php endif; ?> |
37 | 37 | |
38 | 38 | |
39 | - <?php if ( ! empty( $phone ) ) : ?> |
|
39 | + <?php if (!empty($phone)) : ?> |
|
40 | 40 | <div class="billing-phone"> |
41 | - <?php echo wp_sprintf( __( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ); ?> |
|
41 | + <?php echo wp_sprintf(__('Phone: %s', 'invoicing'), esc_html($phone)); ?> |
|
42 | 42 | </div> |
43 | 43 | <?php endif; ?> |
44 | 44 | |
45 | 45 | |
46 | - <?php if ( ! empty( $email ) ) : ?> |
|
46 | + <?php if (!empty($email)) : ?> |
|
47 | 47 | <div class="billing-email"> |
48 | - <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), sanitize_email( $email ) ); ?> |
|
48 | + <?php echo wp_sprintf(__('Email: %s', 'invoicing'), sanitize_email($email)); ?> |
|
49 | 49 | </div> |
50 | 50 | <?php endif; ?> |
51 | 51 | |
52 | 52 | |
53 | - <?php do_action( 'getpaid_billing_address_bottom' ); ?> |
|
53 | + <?php do_action('getpaid_billing_address_bottom'); ?> |
|
54 | 54 | |
55 | 55 | </div> |
56 | 56 |