@@ -239,7 +239,7 @@ |
||
239 | 239 | do_action( 'getpaid_checkout_invoice_exception', $invoice ); |
240 | 240 | } |
241 | 241 | |
242 | - // Do we have any errors? |
|
242 | + // Do we have any errors? |
|
243 | 243 | if ( wpinv_get_errors() ) { |
244 | 244 | $response['data'] = getpaid_get_errors_html( true, false ); |
245 | 245 | } else { |
@@ -1,155 +1,155 @@ discard block |
||
1 | 1 | <?php |
2 | -function wpinv_is_subscription_payment( $invoice = '' ) { |
|
3 | - if ( empty( $invoice ) ) { |
|
2 | +function wpinv_is_subscription_payment($invoice = '') { |
|
3 | + if (empty($invoice)) { |
|
4 | 4 | return false; |
5 | 5 | } |
6 | 6 | |
7 | - if ( ! is_object( $invoice ) && is_scalar( $invoice ) ) { |
|
8 | - $invoice = wpinv_get_invoice( $invoice ); |
|
7 | + if (!is_object($invoice) && is_scalar($invoice)) { |
|
8 | + $invoice = wpinv_get_invoice($invoice); |
|
9 | 9 | } |
10 | 10 | |
11 | - if ( empty( $invoice ) ) { |
|
11 | + if (empty($invoice)) { |
|
12 | 12 | return false; |
13 | 13 | } |
14 | 14 | |
15 | - if ( $invoice->is_renewal() ) { |
|
15 | + if ($invoice->is_renewal()) { |
|
16 | 16 | return true; |
17 | 17 | } |
18 | 18 | |
19 | 19 | return false; |
20 | 20 | } |
21 | 21 | |
22 | -function wpinv_payment_link_transaction_id( $invoice = '' ) { |
|
23 | - if ( empty( $invoice ) ) { |
|
22 | +function wpinv_payment_link_transaction_id($invoice = '') { |
|
23 | + if (empty($invoice)) { |
|
24 | 24 | return false; |
25 | 25 | } |
26 | 26 | |
27 | - if ( ! is_object( $invoice ) && is_scalar( $invoice ) ) { |
|
28 | - $invoice = wpinv_get_invoice( $invoice ); |
|
27 | + if (!is_object($invoice) && is_scalar($invoice)) { |
|
28 | + $invoice = wpinv_get_invoice($invoice); |
|
29 | 29 | } |
30 | 30 | |
31 | - if ( empty( $invoice ) ) { |
|
31 | + if (empty($invoice)) { |
|
32 | 32 | return false; |
33 | 33 | } |
34 | 34 | |
35 | - return apply_filters( 'wpinv_payment_details_transaction_id-' . $invoice->gateway, $invoice->get_transaction_id(), $invoice->ID, $invoice ); |
|
35 | + return apply_filters('wpinv_payment_details_transaction_id-' . $invoice->gateway, $invoice->get_transaction_id(), $invoice->ID, $invoice); |
|
36 | 36 | } |
37 | 37 | |
38 | -function wpinv_subscription_initial_payment_desc( $amount, $period, $interval, $trial_period = '', $trial_interval = 0 ) { |
|
39 | - $interval = (int)$interval > 0 ? (int)$interval : 1; |
|
38 | +function wpinv_subscription_initial_payment_desc($amount, $period, $interval, $trial_period = '', $trial_interval = 0) { |
|
39 | + $interval = (int) $interval > 0 ? (int) $interval : 1; |
|
40 | 40 | |
41 | - if ( $trial_interval > 0 && ! empty( $trial_period ) ) { |
|
42 | - $amount = __( 'Free', 'invoicing' ); |
|
41 | + if ($trial_interval > 0 && !empty($trial_period)) { |
|
42 | + $amount = __('Free', 'invoicing'); |
|
43 | 43 | $interval = $trial_interval; |
44 | 44 | $period = $trial_period; |
45 | 45 | } |
46 | 46 | |
47 | 47 | $description = ''; |
48 | - switch ( $period ) { |
|
48 | + switch ($period) { |
|
49 | 49 | case 'D': |
50 | 50 | case 'day': |
51 | - $description = wp_sprintf( _n( '%s for the first day.', '%1$s for the first %2$d days.', $interval, 'invoicing' ), $amount, $interval ); |
|
51 | + $description = wp_sprintf(_n('%s for the first day.', '%1$s for the first %2$d days.', $interval, 'invoicing'), $amount, $interval); |
|
52 | 52 | break; |
53 | 53 | case 'W': |
54 | 54 | case 'week': |
55 | - $description = wp_sprintf( _n( '%s for the first week.', '%1$s for the first %2$d weeks.', $interval, 'invoicing' ), $amount, $interval ); |
|
55 | + $description = wp_sprintf(_n('%s for the first week.', '%1$s for the first %2$d weeks.', $interval, 'invoicing'), $amount, $interval); |
|
56 | 56 | break; |
57 | 57 | case 'M': |
58 | 58 | case 'month': |
59 | - $description = wp_sprintf( _n( '%s for the first month.', '%1$s for the first %2$d months.', $interval, 'invoicing' ), $amount, $interval ); |
|
59 | + $description = wp_sprintf(_n('%s for the first month.', '%1$s for the first %2$d months.', $interval, 'invoicing'), $amount, $interval); |
|
60 | 60 | break; |
61 | 61 | case 'Y': |
62 | 62 | case 'year': |
63 | - $description = wp_sprintf( _n( '%s for the first year.', '%1$s for the first %2$d years.', $interval, 'invoicing' ), $amount, $interval ); |
|
63 | + $description = wp_sprintf(_n('%s for the first year.', '%1$s for the first %2$d years.', $interval, 'invoicing'), $amount, $interval); |
|
64 | 64 | break; |
65 | 65 | } |
66 | 66 | |
67 | - return apply_filters( 'wpinv_subscription_initial_payment_desc', $description, $amount, $period, $interval, $trial_period, $trial_interval ); |
|
67 | + return apply_filters('wpinv_subscription_initial_payment_desc', $description, $amount, $period, $interval, $trial_period, $trial_interval); |
|
68 | 68 | } |
69 | 69 | |
70 | -function wpinv_subscription_recurring_payment_desc( $amount, $period, $interval, $bill_times = 0, $trial_period = '', $trial_interval = 0 ) { |
|
71 | - $interval = (int)$interval > 0 ? (int)$interval : 1; |
|
72 | - $bill_times = (int)$bill_times > 0 ? (int)$bill_times : 0; |
|
70 | +function wpinv_subscription_recurring_payment_desc($amount, $period, $interval, $bill_times = 0, $trial_period = '', $trial_interval = 0) { |
|
71 | + $interval = (int) $interval > 0 ? (int) $interval : 1; |
|
72 | + $bill_times = (int) $bill_times > 0 ? (int) $bill_times : 0; |
|
73 | 73 | |
74 | 74 | $description = ''; |
75 | - switch ( $period ) { |
|
75 | + switch ($period) { |
|
76 | 76 | case 'D': |
77 | 77 | case 'day': |
78 | - if ( (int)$bill_times > 0 ) { |
|
79 | - if ( $interval > 1 ) { |
|
80 | - if ( $bill_times > 1 ) { |
|
81 | - $description = wp_sprintf( __( '%1$s for each %2$d days, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
78 | + if ((int) $bill_times > 0) { |
|
79 | + if ($interval > 1) { |
|
80 | + if ($bill_times > 1) { |
|
81 | + $description = wp_sprintf(__('%1$s for each %2$d days, for %3$d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
82 | 82 | } else { |
83 | - $description = wp_sprintf( __( '%1$s for %2$d days.', 'invoicing' ), $amount, $interval ); |
|
83 | + $description = wp_sprintf(__('%1$s for %2$d days.', 'invoicing'), $amount, $interval); |
|
84 | 84 | } |
85 | 85 | } else { |
86 | - $description = wp_sprintf( _n( '%s for one day.', '%1$s for each day, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
86 | + $description = wp_sprintf(_n('%s for one day.', '%1$s for each day, for %2$d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
87 | 87 | } |
88 | 88 | } else { |
89 | - $description = wp_sprintf( _n( '%s for each day.', '%1$s for each %2$d days.', $interval, 'invoicing' ), $amount, $interval ); |
|
89 | + $description = wp_sprintf(_n('%s for each day.', '%1$s for each %2$d days.', $interval, 'invoicing'), $amount, $interval); |
|
90 | 90 | } |
91 | 91 | break; |
92 | 92 | case 'W': |
93 | 93 | case 'week': |
94 | - if ( (int)$bill_times > 0 ) { |
|
95 | - if ( $interval > 1 ) { |
|
96 | - if ( $bill_times > 1 ) { |
|
97 | - $description = wp_sprintf( __( '%1$s for each %2$d weeks, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
94 | + if ((int) $bill_times > 0) { |
|
95 | + if ($interval > 1) { |
|
96 | + if ($bill_times > 1) { |
|
97 | + $description = wp_sprintf(__('%1$s for each %2$d weeks, for %3$d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
98 | 98 | } else { |
99 | - $description = wp_sprintf( __( '%1$s for %2$d weeks.', 'invoicing' ), $amount, $interval ); |
|
99 | + $description = wp_sprintf(__('%1$s for %2$d weeks.', 'invoicing'), $amount, $interval); |
|
100 | 100 | } |
101 | 101 | } else { |
102 | - $description = wp_sprintf( _n( '%s for one week.', '%1$s for each week, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
102 | + $description = wp_sprintf(_n('%s for one week.', '%1$s for each week, for %2$d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
103 | 103 | } |
104 | 104 | } else { |
105 | - $description = wp_sprintf( _n( '%s for each week.', '%1$s for each %2$d weeks.', $interval, 'invoicing' ), $amount, $interval ); |
|
105 | + $description = wp_sprintf(_n('%s for each week.', '%1$s for each %2$d weeks.', $interval, 'invoicing'), $amount, $interval); |
|
106 | 106 | } |
107 | 107 | break; |
108 | 108 | case 'M': |
109 | 109 | case 'month': |
110 | - if ( (int)$bill_times > 0 ) { |
|
111 | - if ( $interval > 1 ) { |
|
112 | - if ( $bill_times > 1 ) { |
|
113 | - $description = wp_sprintf( __( '%1$s for each %2$d months, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
110 | + if ((int) $bill_times > 0) { |
|
111 | + if ($interval > 1) { |
|
112 | + if ($bill_times > 1) { |
|
113 | + $description = wp_sprintf(__('%1$s for each %2$d months, for %3$d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
114 | 114 | } else { |
115 | - $description = wp_sprintf( __( '%1$s for %2$d months.', 'invoicing' ), $amount, $interval ); |
|
115 | + $description = wp_sprintf(__('%1$s for %2$d months.', 'invoicing'), $amount, $interval); |
|
116 | 116 | } |
117 | 117 | } else { |
118 | - $description = wp_sprintf( _n( '%s for one month.', '%1$s for each month, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
118 | + $description = wp_sprintf(_n('%s for one month.', '%1$s for each month, for %2$d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
119 | 119 | } |
120 | 120 | } else { |
121 | - $description = wp_sprintf( _n( '%s for each month.', '%1$s for each %2$d months.', $interval, 'invoicing' ), $amount, $interval ); |
|
121 | + $description = wp_sprintf(_n('%s for each month.', '%1$s for each %2$d months.', $interval, 'invoicing'), $amount, $interval); |
|
122 | 122 | } |
123 | 123 | break; |
124 | 124 | case 'Y': |
125 | 125 | case 'year': |
126 | - if ( (int)$bill_times > 0 ) { |
|
127 | - if ( $interval > 1 ) { |
|
128 | - if ( $bill_times > 1 ) { |
|
129 | - $description = wp_sprintf( __( '%1$s for each %2$d years, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
126 | + if ((int) $bill_times > 0) { |
|
127 | + if ($interval > 1) { |
|
128 | + if ($bill_times > 1) { |
|
129 | + $description = wp_sprintf(__('%1$s for each %2$d years, for %3$d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
130 | 130 | } else { |
131 | - $description = wp_sprintf( __( '%1$s for %2$d years.', 'invoicing' ), $amount, $interval ); |
|
131 | + $description = wp_sprintf(__('%1$s for %2$d years.', 'invoicing'), $amount, $interval); |
|
132 | 132 | } |
133 | 133 | } else { |
134 | - $description = wp_sprintf( _n( '%s for one year.', '%1$s for each year, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
134 | + $description = wp_sprintf(_n('%s for one year.', '%1$s for each year, for %2$d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
135 | 135 | } |
136 | 136 | } else { |
137 | - $description = wp_sprintf( _n( '%s for each year.', '%1$s for each %2$d years.', $interval, 'invoicing' ), $amount, $interval ); |
|
137 | + $description = wp_sprintf(_n('%s for each year.', '%1$s for each %2$d years.', $interval, 'invoicing'), $amount, $interval); |
|
138 | 138 | } |
139 | 139 | break; |
140 | 140 | } |
141 | 141 | |
142 | - return apply_filters( 'wpinv_subscription_recurring_payment_desc', $description, $amount, $period, $interval, $bill_times, $trial_period, $trial_interval ); |
|
142 | + return apply_filters('wpinv_subscription_recurring_payment_desc', $description, $amount, $period, $interval, $bill_times, $trial_period, $trial_interval); |
|
143 | 143 | } |
144 | 144 | |
145 | -function wpinv_subscription_payment_desc( $invoice ) { |
|
146 | - if ( empty( $invoice ) ) { |
|
145 | +function wpinv_subscription_payment_desc($invoice) { |
|
146 | + if (empty($invoice)) { |
|
147 | 147 | return null; |
148 | 148 | } |
149 | 149 | |
150 | 150 | $description = ''; |
151 | - if ( $invoice->is_parent() && $item = $invoice->get_recurring( true ) ) { |
|
152 | - if ( $item->has_free_trial() ) { |
|
151 | + if ($invoice->is_parent() && $item = $invoice->get_recurring(true)) { |
|
152 | + if ($item->has_free_trial()) { |
|
153 | 153 | $trial_period = $item->get_trial_period(); |
154 | 154 | $trial_interval = $item->get_trial_interval(); |
155 | 155 | } else { |
@@ -157,40 +157,40 @@ discard block |
||
157 | 157 | $trial_interval = 0; |
158 | 158 | } |
159 | 159 | |
160 | - $description = wpinv_get_billing_cycle( $invoice->get_total(), $invoice->get_recurring_details( 'total' ), $item->get_recurring_period(), $item->get_recurring_interval(), $item->get_recurring_limit(), $trial_period, $trial_interval, $invoice->get_currency() ); |
|
160 | + $description = wpinv_get_billing_cycle($invoice->get_total(), $invoice->get_recurring_details('total'), $item->get_recurring_period(), $item->get_recurring_interval(), $item->get_recurring_limit(), $trial_period, $trial_interval, $invoice->get_currency()); |
|
161 | 161 | } |
162 | 162 | |
163 | - return apply_filters( 'wpinv_subscription_payment_desc', $description, $invoice ); |
|
163 | + return apply_filters('wpinv_subscription_payment_desc', $description, $invoice); |
|
164 | 164 | } |
165 | 165 | |
166 | -function wpinv_get_billing_cycle( $initial, $recurring, $period, $interval, $bill_times, $trial_period = '', $trial_interval = 0, $currency = '' ) { |
|
167 | - $initial_total = wpinv_round_amount( $initial ); |
|
168 | - $recurring_total = wpinv_round_amount( $recurring ); |
|
166 | +function wpinv_get_billing_cycle($initial, $recurring, $period, $interval, $bill_times, $trial_period = '', $trial_interval = 0, $currency = '') { |
|
167 | + $initial_total = wpinv_round_amount($initial); |
|
168 | + $recurring_total = wpinv_round_amount($recurring); |
|
169 | 169 | |
170 | - if ( $trial_interval > 0 && ! empty( $trial_period ) ) { |
|
170 | + if ($trial_interval > 0 && !empty($trial_period)) { |
|
171 | 171 | // Free trial |
172 | 172 | } else { |
173 | - if ( $bill_times == 1 ) { |
|
173 | + if ($bill_times == 1) { |
|
174 | 174 | $recurring_total = $initial_total; |
175 | - } elseif ( $bill_times > 1 && $initial_total != $recurring_total ) { |
|
175 | + } elseif ($bill_times > 1 && $initial_total != $recurring_total) { |
|
176 | 176 | $bill_times--; |
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - $initial_amount = wpinv_price( $initial_total, $currency ); |
|
181 | - $recurring_amount = wpinv_price( $recurring_total, $currency ); |
|
180 | + $initial_amount = wpinv_price($initial_total, $currency); |
|
181 | + $recurring_amount = wpinv_price($recurring_total, $currency); |
|
182 | 182 | |
183 | - $recurring = wpinv_subscription_recurring_payment_desc( $recurring_amount, $period, $interval, $bill_times, $trial_period, $trial_interval ); |
|
183 | + $recurring = wpinv_subscription_recurring_payment_desc($recurring_amount, $period, $interval, $bill_times, $trial_period, $trial_interval); |
|
184 | 184 | |
185 | - if ( $initial_total != $recurring_total ) { |
|
186 | - $initial = wpinv_subscription_initial_payment_desc( $initial_amount, $period, $interval, $trial_period, $trial_interval ); |
|
185 | + if ($initial_total != $recurring_total) { |
|
186 | + $initial = wpinv_subscription_initial_payment_desc($initial_amount, $period, $interval, $trial_period, $trial_interval); |
|
187 | 187 | |
188 | - $description = wp_sprintf( __( '%1$s Then %2$s', 'invoicing' ), $initial, $recurring ); |
|
188 | + $description = wp_sprintf(__('%1$s Then %2$s', 'invoicing'), $initial, $recurring); |
|
189 | 189 | } else { |
190 | 190 | $description = $recurring; |
191 | 191 | } |
192 | 192 | |
193 | - return apply_filters( 'wpinv_get_billing_cycle', $description, $initial, $recurring, $period, $interval, $bill_times, $trial_period, $trial_interval, $currency ); |
|
193 | + return apply_filters('wpinv_get_billing_cycle', $description, $initial, $recurring, $period, $interval, $bill_times, $trial_period, $trial_interval, $currency); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -200,27 +200,27 @@ discard block |
||
200 | 200 | * @param string $card_number Card number. |
201 | 201 | * @return string |
202 | 202 | */ |
203 | -function getpaid_get_card_name( $card_number ) { |
|
203 | +function getpaid_get_card_name($card_number) { |
|
204 | 204 | |
205 | 205 | // Known regexes. |
206 | 206 | $regexes = array( |
207 | - '/^4/' => __( 'Visa', 'invoicing' ), |
|
208 | - '/^5[1-5]/' => __( 'Mastercard', 'invoicing' ), |
|
209 | - '/^3[47]/' => __( 'Amex', 'invoicing' ), |
|
210 | - '/^3(?:0[0-5]|[68])/' => __( 'Diners Club', 'invoicing' ), |
|
211 | - '/^6(?:011|5)/' => __( 'Discover', 'invoicing' ), |
|
212 | - '/^(?:2131|1800|35\d{3})/' => __( 'JCB', 'invoicing' ), |
|
207 | + '/^4/' => __('Visa', 'invoicing'), |
|
208 | + '/^5[1-5]/' => __('Mastercard', 'invoicing'), |
|
209 | + '/^3[47]/' => __('Amex', 'invoicing'), |
|
210 | + '/^3(?:0[0-5]|[68])/' => __('Diners Club', 'invoicing'), |
|
211 | + '/^6(?:011|5)/' => __('Discover', 'invoicing'), |
|
212 | + '/^(?:2131|1800|35\d{3})/' => __('JCB', 'invoicing'), |
|
213 | 213 | ); |
214 | 214 | |
215 | 215 | // Confirm if one matches. |
216 | - foreach ( $regexes as $regex => $card ) { |
|
217 | - if ( preg_match( $regex, $card_number ) >= 1 ) { |
|
216 | + foreach ($regexes as $regex => $card) { |
|
217 | + if (preg_match($regex, $card_number) >= 1) { |
|
218 | 218 | return $card; |
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | 222 | // None matched. |
223 | - return __( 'Card', 'invoicing' ); |
|
223 | + return __('Card', 'invoicing'); |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | |
@@ -229,23 +229,23 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @param WPInv_Invoice|int|null $invoice |
231 | 231 | */ |
232 | -function wpinv_send_back_to_checkout( $invoice = null ) { |
|
233 | - $response = array( 'success' => false ); |
|
234 | - $invoice = wpinv_get_invoice( $invoice ); |
|
232 | +function wpinv_send_back_to_checkout($invoice = null) { |
|
233 | + $response = array('success' => false); |
|
234 | + $invoice = wpinv_get_invoice($invoice); |
|
235 | 235 | |
236 | 236 | // Was an invoice created? |
237 | - if ( ! empty( $invoice ) ) { |
|
238 | - $invoice = is_scalar( $invoice ) ? new WPInv_Invoice( $invoice ) : $invoice; |
|
237 | + if (!empty($invoice)) { |
|
238 | + $invoice = is_scalar($invoice) ? new WPInv_Invoice($invoice) : $invoice; |
|
239 | 239 | $response['invoice'] = $invoice->get_id(); |
240 | - do_action( 'getpaid_checkout_invoice_exception', $invoice ); |
|
240 | + do_action('getpaid_checkout_invoice_exception', $invoice); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | // Do we have any errors? |
244 | - if ( wpinv_get_errors() ) { |
|
245 | - $response['data'] = getpaid_get_errors_html( true, false ); |
|
244 | + if (wpinv_get_errors()) { |
|
245 | + $response['data'] = getpaid_get_errors_html(true, false); |
|
246 | 246 | } else { |
247 | - $response['data'] = __( 'An error occured while processing your payment. Please try again.', 'invoicing' ); |
|
247 | + $response['data'] = __('An error occured while processing your payment. Please try again.', 'invoicing'); |
|
248 | 248 | } |
249 | 249 | |
250 | - wp_send_json( $response ); |
|
250 | + wp_send_json($response); |
|
251 | 251 | } |
@@ -16,165 +16,165 @@ |
||
16 | 16 | */ |
17 | 17 | class GetPaid_MaxMind_Geolocation { |
18 | 18 | |
19 | - /** |
|
20 | - * The service responsible for interacting with the MaxMind database. |
|
21 | - * |
|
22 | - * @var GetPaid_MaxMind_Database_Service |
|
23 | - */ |
|
24 | - private $database_service; |
|
25 | - |
|
26 | - /** |
|
27 | - * Initialize the integration. |
|
28 | - */ |
|
29 | - public function __construct() { |
|
30 | - |
|
31 | - /** |
|
32 | - * Supports overriding the database service to be used. |
|
33 | - * |
|
34 | - * @since 1.0.19 |
|
35 | - * @return mixed|null The geolocation database service. |
|
36 | - */ |
|
37 | - $this->database_service = apply_filters( 'getpaid_maxmind_geolocation_database_service', null ); |
|
38 | - if ( null === $this->database_service ) { |
|
39 | - $this->database_service = new GetPaid_MaxMind_Database_Service( $this->get_database_prefix() ); |
|
40 | - } |
|
41 | - |
|
42 | - // Bind to the scheduled updater action. |
|
43 | - add_action( 'getpaid_update_geoip_databases', array( $this, 'update_database' ) ); |
|
44 | - |
|
45 | - // Bind to the geolocation filter for MaxMind database lookups. |
|
46 | - add_filter( 'getpaid_get_geolocation', array( $this, 'get_geolocation' ), 10, 2 ); |
|
47 | - |
|
48 | - // Handle maxmind key updates. |
|
49 | - add_filter( 'wpinv_settings_sanitize_maxmind_license_key', array( $this, 'handle_key_updates' ) ); |
|
50 | - |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * Get database service. |
|
55 | - * |
|
56 | - * @return GetPaid_MaxMind_Database_Service|null |
|
57 | - */ |
|
58 | - public function get_database_service() { |
|
59 | - return $this->database_service; |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Checks to make sure that the license key is valid. |
|
64 | - * |
|
65 | - * @param string $license_key The new license key. |
|
66 | - * @return string |
|
67 | - */ |
|
68 | - public function handle_key_updates( $license_key ) { |
|
69 | - |
|
70 | - // Trim whitespaces and strip slashes. |
|
71 | - $license_key = trim( $license_key ); |
|
72 | - |
|
73 | - // Abort if the license key is empty or unchanged. |
|
74 | - if ( empty( $license_key ) ) { |
|
75 | - return $license_key; |
|
76 | - } |
|
77 | - |
|
78 | - // Abort if a database exists and the license key is unchaged. |
|
79 | - if ( file_exists( $this->database_service->get_database_path() && $license_key == wpinv_get_option( 'maxmind_license_key' ) ) ) { |
|
80 | - return $license_key; |
|
81 | - } |
|
82 | - |
|
83 | - // Check the license key by attempting to download the Geolocation database. |
|
84 | - $tmp_database_path = $this->database_service->download_database( $license_key ); |
|
85 | - if ( is_wp_error( $tmp_database_path ) ) { |
|
86 | - getpaid_admin()->show_error( $tmp_database_path->get_error_message() ); |
|
87 | - return $license_key; |
|
88 | - } |
|
89 | - |
|
90 | - $this->update_database( /** @scrutinizer ignore-type */ $tmp_database_path ); |
|
91 | - |
|
92 | - return $license_key; |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * Updates the database used for geolocation queries. |
|
97 | - * |
|
98 | - * @param string $tmp_database_path Temporary database path. |
|
99 | - */ |
|
100 | - public function update_database( $tmp_database_path = null ) { |
|
101 | - |
|
102 | - // Allow us to easily interact with the filesystem. |
|
103 | - require_once ABSPATH . 'wp-admin/includes/file.php'; |
|
104 | - WP_Filesystem(); |
|
105 | - global $wp_filesystem; |
|
106 | - |
|
107 | - // Remove any existing archives to comply with the MaxMind TOS. |
|
108 | - $target_database_path = $this->database_service->get_database_path(); |
|
109 | - |
|
110 | - // If there's no database path, we can't store the database. |
|
111 | - if ( empty( $target_database_path ) ) { |
|
112 | - return; |
|
113 | - } |
|
114 | - |
|
115 | - if ( $wp_filesystem->exists( $target_database_path ) ) { |
|
116 | - $wp_filesystem->delete( $target_database_path ); |
|
117 | - } |
|
118 | - |
|
119 | - // We can't download a database if there's no license key configured. |
|
120 | - $license_key = wpinv_get_option( 'maxmind_license_key' ); |
|
121 | - if ( empty( $license_key ) ) { |
|
122 | - return; |
|
123 | - } |
|
124 | - |
|
125 | - if ( empty( $tmp_database_path ) ) { |
|
126 | - $tmp_database_path = $this->database_service->download_database( $license_key ); |
|
127 | - } |
|
128 | - |
|
129 | - if ( is_wp_error( $tmp_database_path ) ) { |
|
130 | - wpinv_error_log( $tmp_database_path->get_error_message() ); |
|
131 | - return; |
|
132 | - } |
|
133 | - |
|
134 | - // Move the new database into position. |
|
135 | - $wp_filesystem->move( $tmp_database_path, $target_database_path, true ); |
|
136 | - $wp_filesystem->delete( dirname( $tmp_database_path ) ); |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * Performs a geolocation lookup against the MaxMind database for the given IP address. |
|
141 | - * |
|
142 | - * @param array $data Geolocation data. |
|
143 | - * @param string $ip_address The IP address to geolocate. |
|
144 | - * @return array Geolocation including country code, state, city and postcode based on an IP address. |
|
145 | - */ |
|
146 | - public function get_geolocation( $data, $ip_address ) { |
|
147 | - |
|
148 | - if ( ! empty( $data['country'] ) || empty( $ip_address ) ) { |
|
149 | - return $data; |
|
150 | - } |
|
151 | - |
|
152 | - $country_code = $this->database_service->get_iso_country_code_for_ip( $ip_address ); |
|
153 | - |
|
154 | - return array( |
|
155 | - 'country' => $country_code, |
|
156 | - 'state' => '', |
|
157 | - 'city' => '', |
|
158 | - 'postcode' => '', |
|
159 | - ); |
|
160 | - |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * Fetches the prefix for the MaxMind database file. |
|
165 | - * |
|
166 | - * @return string |
|
167 | - */ |
|
168 | - private function get_database_prefix() { |
|
169 | - |
|
170 | - $prefix = get_option( 'wpinv_maxmind_database_prefix' ); |
|
171 | - |
|
172 | - if ( empty( $prefix ) ) { |
|
173 | - $prefix = md5( uniqid( 'wpinv' ) ); |
|
174 | - update_option( 'wpinv_maxmind_database_prefix', $prefix ); |
|
175 | - } |
|
176 | - |
|
177 | - return $prefix; |
|
178 | - } |
|
19 | + /** |
|
20 | + * The service responsible for interacting with the MaxMind database. |
|
21 | + * |
|
22 | + * @var GetPaid_MaxMind_Database_Service |
|
23 | + */ |
|
24 | + private $database_service; |
|
25 | + |
|
26 | + /** |
|
27 | + * Initialize the integration. |
|
28 | + */ |
|
29 | + public function __construct() { |
|
30 | + |
|
31 | + /** |
|
32 | + * Supports overriding the database service to be used. |
|
33 | + * |
|
34 | + * @since 1.0.19 |
|
35 | + * @return mixed|null The geolocation database service. |
|
36 | + */ |
|
37 | + $this->database_service = apply_filters( 'getpaid_maxmind_geolocation_database_service', null ); |
|
38 | + if ( null === $this->database_service ) { |
|
39 | + $this->database_service = new GetPaid_MaxMind_Database_Service( $this->get_database_prefix() ); |
|
40 | + } |
|
41 | + |
|
42 | + // Bind to the scheduled updater action. |
|
43 | + add_action( 'getpaid_update_geoip_databases', array( $this, 'update_database' ) ); |
|
44 | + |
|
45 | + // Bind to the geolocation filter for MaxMind database lookups. |
|
46 | + add_filter( 'getpaid_get_geolocation', array( $this, 'get_geolocation' ), 10, 2 ); |
|
47 | + |
|
48 | + // Handle maxmind key updates. |
|
49 | + add_filter( 'wpinv_settings_sanitize_maxmind_license_key', array( $this, 'handle_key_updates' ) ); |
|
50 | + |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * Get database service. |
|
55 | + * |
|
56 | + * @return GetPaid_MaxMind_Database_Service|null |
|
57 | + */ |
|
58 | + public function get_database_service() { |
|
59 | + return $this->database_service; |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Checks to make sure that the license key is valid. |
|
64 | + * |
|
65 | + * @param string $license_key The new license key. |
|
66 | + * @return string |
|
67 | + */ |
|
68 | + public function handle_key_updates( $license_key ) { |
|
69 | + |
|
70 | + // Trim whitespaces and strip slashes. |
|
71 | + $license_key = trim( $license_key ); |
|
72 | + |
|
73 | + // Abort if the license key is empty or unchanged. |
|
74 | + if ( empty( $license_key ) ) { |
|
75 | + return $license_key; |
|
76 | + } |
|
77 | + |
|
78 | + // Abort if a database exists and the license key is unchaged. |
|
79 | + if ( file_exists( $this->database_service->get_database_path() && $license_key == wpinv_get_option( 'maxmind_license_key' ) ) ) { |
|
80 | + return $license_key; |
|
81 | + } |
|
82 | + |
|
83 | + // Check the license key by attempting to download the Geolocation database. |
|
84 | + $tmp_database_path = $this->database_service->download_database( $license_key ); |
|
85 | + if ( is_wp_error( $tmp_database_path ) ) { |
|
86 | + getpaid_admin()->show_error( $tmp_database_path->get_error_message() ); |
|
87 | + return $license_key; |
|
88 | + } |
|
89 | + |
|
90 | + $this->update_database( /** @scrutinizer ignore-type */ $tmp_database_path ); |
|
91 | + |
|
92 | + return $license_key; |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * Updates the database used for geolocation queries. |
|
97 | + * |
|
98 | + * @param string $tmp_database_path Temporary database path. |
|
99 | + */ |
|
100 | + public function update_database( $tmp_database_path = null ) { |
|
101 | + |
|
102 | + // Allow us to easily interact with the filesystem. |
|
103 | + require_once ABSPATH . 'wp-admin/includes/file.php'; |
|
104 | + WP_Filesystem(); |
|
105 | + global $wp_filesystem; |
|
106 | + |
|
107 | + // Remove any existing archives to comply with the MaxMind TOS. |
|
108 | + $target_database_path = $this->database_service->get_database_path(); |
|
109 | + |
|
110 | + // If there's no database path, we can't store the database. |
|
111 | + if ( empty( $target_database_path ) ) { |
|
112 | + return; |
|
113 | + } |
|
114 | + |
|
115 | + if ( $wp_filesystem->exists( $target_database_path ) ) { |
|
116 | + $wp_filesystem->delete( $target_database_path ); |
|
117 | + } |
|
118 | + |
|
119 | + // We can't download a database if there's no license key configured. |
|
120 | + $license_key = wpinv_get_option( 'maxmind_license_key' ); |
|
121 | + if ( empty( $license_key ) ) { |
|
122 | + return; |
|
123 | + } |
|
124 | + |
|
125 | + if ( empty( $tmp_database_path ) ) { |
|
126 | + $tmp_database_path = $this->database_service->download_database( $license_key ); |
|
127 | + } |
|
128 | + |
|
129 | + if ( is_wp_error( $tmp_database_path ) ) { |
|
130 | + wpinv_error_log( $tmp_database_path->get_error_message() ); |
|
131 | + return; |
|
132 | + } |
|
133 | + |
|
134 | + // Move the new database into position. |
|
135 | + $wp_filesystem->move( $tmp_database_path, $target_database_path, true ); |
|
136 | + $wp_filesystem->delete( dirname( $tmp_database_path ) ); |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * Performs a geolocation lookup against the MaxMind database for the given IP address. |
|
141 | + * |
|
142 | + * @param array $data Geolocation data. |
|
143 | + * @param string $ip_address The IP address to geolocate. |
|
144 | + * @return array Geolocation including country code, state, city and postcode based on an IP address. |
|
145 | + */ |
|
146 | + public function get_geolocation( $data, $ip_address ) { |
|
147 | + |
|
148 | + if ( ! empty( $data['country'] ) || empty( $ip_address ) ) { |
|
149 | + return $data; |
|
150 | + } |
|
151 | + |
|
152 | + $country_code = $this->database_service->get_iso_country_code_for_ip( $ip_address ); |
|
153 | + |
|
154 | + return array( |
|
155 | + 'country' => $country_code, |
|
156 | + 'state' => '', |
|
157 | + 'city' => '', |
|
158 | + 'postcode' => '', |
|
159 | + ); |
|
160 | + |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * Fetches the prefix for the MaxMind database file. |
|
165 | + * |
|
166 | + * @return string |
|
167 | + */ |
|
168 | + private function get_database_prefix() { |
|
169 | + |
|
170 | + $prefix = get_option( 'wpinv_maxmind_database_prefix' ); |
|
171 | + |
|
172 | + if ( empty( $prefix ) ) { |
|
173 | + $prefix = md5( uniqid( 'wpinv' ) ); |
|
174 | + update_option( 'wpinv_maxmind_database_prefix', $prefix ); |
|
175 | + } |
|
176 | + |
|
177 | + return $prefix; |
|
178 | + } |
|
179 | 179 | |
180 | 180 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Uses MaxMind for Geolocation |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | * @since 1.0.19 |
35 | 35 | * @return mixed|null The geolocation database service. |
36 | 36 | */ |
37 | - $this->database_service = apply_filters( 'getpaid_maxmind_geolocation_database_service', null ); |
|
38 | - if ( null === $this->database_service ) { |
|
39 | - $this->database_service = new GetPaid_MaxMind_Database_Service( $this->get_database_prefix() ); |
|
37 | + $this->database_service = apply_filters('getpaid_maxmind_geolocation_database_service', null); |
|
38 | + if (null === $this->database_service) { |
|
39 | + $this->database_service = new GetPaid_MaxMind_Database_Service($this->get_database_prefix()); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | // Bind to the scheduled updater action. |
43 | - add_action( 'getpaid_update_geoip_databases', array( $this, 'update_database' ) ); |
|
43 | + add_action('getpaid_update_geoip_databases', array($this, 'update_database')); |
|
44 | 44 | |
45 | 45 | // Bind to the geolocation filter for MaxMind database lookups. |
46 | - add_filter( 'getpaid_get_geolocation', array( $this, 'get_geolocation' ), 10, 2 ); |
|
46 | + add_filter('getpaid_get_geolocation', array($this, 'get_geolocation'), 10, 2); |
|
47 | 47 | |
48 | 48 | // Handle maxmind key updates. |
49 | - add_filter( 'wpinv_settings_sanitize_maxmind_license_key', array( $this, 'handle_key_updates' ) ); |
|
49 | + add_filter('wpinv_settings_sanitize_maxmind_license_key', array($this, 'handle_key_updates')); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -65,29 +65,29 @@ discard block |
||
65 | 65 | * @param string $license_key The new license key. |
66 | 66 | * @return string |
67 | 67 | */ |
68 | - public function handle_key_updates( $license_key ) { |
|
68 | + public function handle_key_updates($license_key) { |
|
69 | 69 | |
70 | 70 | // Trim whitespaces and strip slashes. |
71 | - $license_key = trim( $license_key ); |
|
71 | + $license_key = trim($license_key); |
|
72 | 72 | |
73 | 73 | // Abort if the license key is empty or unchanged. |
74 | - if ( empty( $license_key ) ) { |
|
74 | + if (empty($license_key)) { |
|
75 | 75 | return $license_key; |
76 | 76 | } |
77 | 77 | |
78 | 78 | // Abort if a database exists and the license key is unchaged. |
79 | - if ( file_exists( $this->database_service->get_database_path() && $license_key == wpinv_get_option( 'maxmind_license_key' ) ) ) { |
|
79 | + if (file_exists($this->database_service->get_database_path() && $license_key == wpinv_get_option('maxmind_license_key'))) { |
|
80 | 80 | return $license_key; |
81 | 81 | } |
82 | 82 | |
83 | 83 | // Check the license key by attempting to download the Geolocation database. |
84 | - $tmp_database_path = $this->database_service->download_database( $license_key ); |
|
85 | - if ( is_wp_error( $tmp_database_path ) ) { |
|
86 | - getpaid_admin()->show_error( $tmp_database_path->get_error_message() ); |
|
84 | + $tmp_database_path = $this->database_service->download_database($license_key); |
|
85 | + if (is_wp_error($tmp_database_path)) { |
|
86 | + getpaid_admin()->show_error($tmp_database_path->get_error_message()); |
|
87 | 87 | return $license_key; |
88 | 88 | } |
89 | 89 | |
90 | - $this->update_database( /** @scrutinizer ignore-type */ $tmp_database_path ); |
|
90 | + $this->update_database(/** @scrutinizer ignore-type */ $tmp_database_path); |
|
91 | 91 | |
92 | 92 | return $license_key; |
93 | 93 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @param string $tmp_database_path Temporary database path. |
99 | 99 | */ |
100 | - public function update_database( $tmp_database_path = null ) { |
|
100 | + public function update_database($tmp_database_path = null) { |
|
101 | 101 | |
102 | 102 | // Allow us to easily interact with the filesystem. |
103 | 103 | require_once ABSPATH . 'wp-admin/includes/file.php'; |
@@ -108,32 +108,32 @@ discard block |
||
108 | 108 | $target_database_path = $this->database_service->get_database_path(); |
109 | 109 | |
110 | 110 | // If there's no database path, we can't store the database. |
111 | - if ( empty( $target_database_path ) ) { |
|
111 | + if (empty($target_database_path)) { |
|
112 | 112 | return; |
113 | 113 | } |
114 | 114 | |
115 | - if ( $wp_filesystem->exists( $target_database_path ) ) { |
|
116 | - $wp_filesystem->delete( $target_database_path ); |
|
115 | + if ($wp_filesystem->exists($target_database_path)) { |
|
116 | + $wp_filesystem->delete($target_database_path); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // We can't download a database if there's no license key configured. |
120 | - $license_key = wpinv_get_option( 'maxmind_license_key' ); |
|
121 | - if ( empty( $license_key ) ) { |
|
120 | + $license_key = wpinv_get_option('maxmind_license_key'); |
|
121 | + if (empty($license_key)) { |
|
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
125 | - if ( empty( $tmp_database_path ) ) { |
|
126 | - $tmp_database_path = $this->database_service->download_database( $license_key ); |
|
125 | + if (empty($tmp_database_path)) { |
|
126 | + $tmp_database_path = $this->database_service->download_database($license_key); |
|
127 | 127 | } |
128 | 128 | |
129 | - if ( is_wp_error( $tmp_database_path ) ) { |
|
130 | - wpinv_error_log( $tmp_database_path->get_error_message() ); |
|
129 | + if (is_wp_error($tmp_database_path)) { |
|
130 | + wpinv_error_log($tmp_database_path->get_error_message()); |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
134 | 134 | // Move the new database into position. |
135 | - $wp_filesystem->move( $tmp_database_path, $target_database_path, true ); |
|
136 | - $wp_filesystem->delete( dirname( $tmp_database_path ) ); |
|
135 | + $wp_filesystem->move($tmp_database_path, $target_database_path, true); |
|
136 | + $wp_filesystem->delete(dirname($tmp_database_path)); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | * @param string $ip_address The IP address to geolocate. |
144 | 144 | * @return array Geolocation including country code, state, city and postcode based on an IP address. |
145 | 145 | */ |
146 | - public function get_geolocation( $data, $ip_address ) { |
|
146 | + public function get_geolocation($data, $ip_address) { |
|
147 | 147 | |
148 | - if ( ! empty( $data['country'] ) || empty( $ip_address ) ) { |
|
148 | + if (!empty($data['country']) || empty($ip_address)) { |
|
149 | 149 | return $data; |
150 | 150 | } |
151 | 151 | |
152 | - $country_code = $this->database_service->get_iso_country_code_for_ip( $ip_address ); |
|
152 | + $country_code = $this->database_service->get_iso_country_code_for_ip($ip_address); |
|
153 | 153 | |
154 | 154 | return array( |
155 | 155 | 'country' => $country_code, |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | */ |
168 | 168 | private function get_database_prefix() { |
169 | 169 | |
170 | - $prefix = get_option( 'wpinv_maxmind_database_prefix' ); |
|
170 | + $prefix = get_option('wpinv_maxmind_database_prefix'); |
|
171 | 171 | |
172 | - if ( empty( $prefix ) ) { |
|
173 | - $prefix = md5( uniqid( 'wpinv' ) ); |
|
174 | - update_option( 'wpinv_maxmind_database_prefix', $prefix ); |
|
172 | + if (empty($prefix)) { |
|
173 | + $prefix = md5(uniqid('wpinv')); |
|
174 | + update_option('wpinv_maxmind_database_prefix', $prefix); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return $prefix; |
@@ -20,13 +20,13 @@ |
||
20 | 20 | <title><?php esc_html_e( 'GetPaid › Setup Wizard', 'invoicing' ); ?></title> |
21 | 21 | <?php |
22 | 22 | getpaid_admin()->enqeue_scripts(); |
23 | - wp_enqueue_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), 'v5.13.0' ); |
|
24 | - wp_print_styles( 'select2' ); |
|
23 | + wp_enqueue_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), 'v5.13.0' ); |
|
24 | + wp_print_styles( 'select2' ); |
|
25 | 25 | wp_print_scripts( 'select2' ); |
26 | - wp_print_scripts( 'wpinv-admin-script' ); |
|
26 | + wp_print_scripts( 'wpinv-admin-script' ); |
|
27 | 27 | do_action( 'admin_print_styles' ); |
28 | 28 | do_action( 'admin_head' ); |
29 | - ?> |
|
29 | + ?> |
|
30 | 30 | <style> |
31 | 31 | body, p{ |
32 | 32 | font-size: 16px; |
@@ -57,9 +57,12 @@ |
||
57 | 57 | </li> |
58 | 58 | <?php endforeach; ?> |
59 | 59 | </ol> |
60 | - <?php else : ?> |
|
60 | + <?php else { |
|
61 | + : ?> |
|
61 | 62 | <div class='mb-3'> </div> |
62 | - <?php endif; ?> |
|
63 | + <?php endif; |
|
64 | +} |
|
65 | +?> |
|
63 | 66 | |
64 | 67 | <div class="text-center pb-3 mt-5"> |
65 | 68 | <a class=" text-decoration-none" href="https://wpgetpaid.com/"> |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | $aui_settings = AyeCode_UI_Settings::instance(); |
10 | 10 | $aui_settings->enqueue_scripts(); |
@@ -17,15 +17,15 @@ discard block |
||
17 | 17 | <head> |
18 | 18 | <meta name="viewport" content="width=device-width"/> |
19 | 19 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
20 | - <title><?php esc_html_e( 'GetPaid › Setup Wizard', 'invoicing' ); ?></title> |
|
20 | + <title><?php esc_html_e('GetPaid › Setup Wizard', 'invoicing'); ?></title> |
|
21 | 21 | <?php |
22 | 22 | getpaid_admin()->enqeue_scripts(); |
23 | - wp_enqueue_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), 'v5.13.0' ); |
|
24 | - wp_print_styles( 'select2' ); |
|
25 | - wp_print_scripts( 'select2' ); |
|
26 | - wp_print_scripts( 'wpinv-admin-script' ); |
|
27 | - do_action( 'admin_print_styles' ); |
|
28 | - do_action( 'admin_head' ); |
|
23 | + wp_enqueue_style('font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), 'v5.13.0'); |
|
24 | + wp_print_styles('select2'); |
|
25 | + wp_print_scripts('select2'); |
|
26 | + wp_print_scripts('wpinv-admin-script'); |
|
27 | + do_action('admin_print_styles'); |
|
28 | + do_action('admin_head'); |
|
29 | 29 | ?> |
30 | 30 | <style> |
31 | 31 | body, p{ |
@@ -37,23 +37,23 @@ discard block |
||
37 | 37 | font-weight: 500; |
38 | 38 | margin-bottom: .1rem; |
39 | 39 | } |
40 | - <?php echo esc_html( $aui_settings::css_primary( '#009874', true ) ); ?> |
|
40 | + <?php echo esc_html($aui_settings::css_primary('#009874', true)); ?> |
|
41 | 41 | </style> |
42 | 42 | </head> |
43 | 43 | |
44 | 44 | <body class="gp-setup wp-core-ui bg-lightx mx-auto text-dark scrollbars-ios" style="background: #f3f6ff;"> |
45 | 45 | |
46 | - <?php if ( isset( $_REQUEST['step'] ) ) : ?> |
|
46 | + <?php if (isset($_REQUEST['step'])) : ?> |
|
47 | 47 | <ol class="gp-setup-steps mb-0 pb-4 mw-100 list-group list-group-horizontal text-center"> |
48 | - <?php foreach ( $steps as $step => $data ) : ?> |
|
48 | + <?php foreach ($steps as $step => $data) : ?> |
|
49 | 49 | <li class="list-group-item flex-fill rounded-0 |
50 | 50 | <?php |
51 | 51 | echo $step == $current ? 'active' : 'd-none d-md-block'; |
52 | - echo array_search( $current, array_keys( $steps ) ) > array_search( $step, array_keys( $steps ) ) ? ' done' : ''; |
|
52 | + echo array_search($current, array_keys($steps)) > array_search($step, array_keys($steps)) ? ' done' : ''; |
|
53 | 53 | ?> |
54 | 54 | "> |
55 | - <i class="far fa-check-circle <?php echo array_search( $current, array_keys( $steps ) ) > array_search( $step, array_keys( $steps ) ) ? 'text-success' : ''; ?>"></i> |
|
56 | - <?php echo esc_html( $data['name'] ); ?> |
|
55 | + <i class="far fa-check-circle <?php echo array_search($current, array_keys($steps)) > array_search($step, array_keys($steps)) ? 'text-success' : ''; ?>"></i> |
|
56 | + <?php echo esc_html($data['name']); ?> |
|
57 | 57 | </li> |
58 | 58 | <?php endforeach; ?> |
59 | 59 | </ol> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | <div class="text-center pb-3 mt-5"> |
65 | 65 | <a class=" text-decoration-none" href="https://wpgetpaid.com/"> |
66 | 66 | <span class="text-black-50"> |
67 | - <img class="ml-n3x" src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png' ); ?>" /> |
|
67 | + <img class="ml-n3x" src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png'); ?>" /> |
|
68 | 68 | </span> |
69 | 69 | </a> |
70 | 70 | </div> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; // Exit if accessed directly |
|
11 | + exit; // Exit if accessed directly |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -319,10 +319,10 @@ discard block |
||
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
322 | - * Output the metabox. |
|
323 | - * |
|
324 | - * @param WP_Post $post |
|
325 | - */ |
|
322 | + * Output the metabox. |
|
323 | + * |
|
324 | + * @param WP_Post $post |
|
325 | + */ |
|
326 | 326 | public static function output2( $post ) { |
327 | 327 | |
328 | 328 | // Prepare the invoice. |
@@ -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 | |
@@ -16,82 +16,82 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class GetPaid_Meta_Box_Invoice_Items { |
18 | 18 | |
19 | - public static function get_columns( $invoice ) { |
|
19 | + public static function get_columns($invoice) { |
|
20 | 20 | $use_taxes = $invoice->is_taxable() && wpinv_use_taxes(); |
21 | 21 | $columns = array( |
22 | - 'id' => __( 'ID', 'invoicing' ), |
|
23 | - 'title' => __( 'Item', 'invoicing' ), |
|
22 | + 'id' => __('ID', 'invoicing'), |
|
23 | + 'title' => __('Item', 'invoicing'), |
|
24 | 24 | 'price' => sprintf( |
25 | 25 | '<span class="getpaid-hide-if-hours getpaid-hide-if-quantity">%s</span> |
26 | 26 | <span class="getpaid-hide-if-hours hide-if-amount">%s</span> |
27 | 27 | <span class="getpaid-hide-if-quantity hide-if-amount">%s</span>', |
28 | - __( 'Amount', 'invoicing' ), |
|
29 | - __( 'Price', 'invoicing' ), |
|
30 | - __( 'Rate', 'invoicing' ) |
|
28 | + __('Amount', 'invoicing'), |
|
29 | + __('Price', 'invoicing'), |
|
30 | + __('Rate', 'invoicing') |
|
31 | 31 | ), |
32 | 32 | 'qty' => sprintf( |
33 | 33 | '<span class="getpaid-hide-if-hours">%s</span><span class="getpaid-hide-if-quantity">%s</span>', |
34 | - __( 'Quantity', 'invoicing' ), |
|
35 | - __( 'Hours', 'invoicing' ) |
|
34 | + __('Quantity', 'invoicing'), |
|
35 | + __('Hours', 'invoicing') |
|
36 | 36 | ), |
37 | - 'total' => __( 'Total', 'invoicing' ), |
|
38 | - 'tax' => __( 'Tax (%)', 'invoicing' ), |
|
37 | + 'total' => __('Total', 'invoicing'), |
|
38 | + 'tax' => __('Tax (%)', 'invoicing'), |
|
39 | 39 | 'action' => '', |
40 | 40 | ); |
41 | 41 | |
42 | - if ( ! $use_taxes ) { |
|
43 | - unset( $columns['tax'] ); |
|
42 | + if (!$use_taxes) { |
|
43 | + unset($columns['tax']); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return $columns; |
47 | 47 | } |
48 | 48 | |
49 | - public static function output( $post, $invoice = false ) { |
|
49 | + public static function output($post, $invoice = false) { |
|
50 | 50 | |
51 | - if ( apply_filters( 'getpaid_use_new_invoice_items_metabox', false ) ) { |
|
52 | - return self::output2( $post ); |
|
51 | + if (apply_filters('getpaid_use_new_invoice_items_metabox', false)) { |
|
52 | + return self::output2($post); |
|
53 | 53 | } |
54 | 54 | |
55 | - $post_id = !empty( $post->ID ) ? $post->ID : 0; |
|
56 | - $invoice = $invoice instanceof WPInv_Invoice ? $invoice : new WPInv_Invoice( $post_id ); |
|
55 | + $post_id = !empty($post->ID) ? $post->ID : 0; |
|
56 | + $invoice = $invoice instanceof WPInv_Invoice ? $invoice : new WPInv_Invoice($post_id); |
|
57 | 57 | $use_taxes = $invoice->is_taxable() && wpinv_use_taxes(); |
58 | - $item_types = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post ); |
|
59 | - $columns = self::get_columns( $invoice ); |
|
60 | - $cols = count( $columns ); |
|
58 | + $item_types = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post); |
|
59 | + $columns = self::get_columns($invoice); |
|
60 | + $cols = count($columns); |
|
61 | 61 | $class = ''; |
62 | 62 | |
63 | - unset( $item_types['adv'] ); |
|
64 | - unset( $item_types['package'] ); |
|
63 | + unset($item_types['adv']); |
|
64 | + unset($item_types['package']); |
|
65 | 65 | |
66 | - if ( $invoice->is_paid() ) { |
|
66 | + if ($invoice->is_paid()) { |
|
67 | 67 | $class .= ' wpinv-paid'; |
68 | 68 | } |
69 | 69 | |
70 | - if ( $invoice->is_refunded() ) { |
|
70 | + if ($invoice->is_refunded()) { |
|
71 | 71 | $class .= ' wpinv-refunded'; |
72 | 72 | } |
73 | 73 | |
74 | - if ( $invoice->is_recurring() ) { |
|
74 | + if ($invoice->is_recurring()) { |
|
75 | 75 | $class .= ' wpi-recurring'; |
76 | 76 | } |
77 | 77 | |
78 | 78 | ?> |
79 | 79 | |
80 | - <div class="wpinv-items-wrap<?php echo esc_attr( $class ); ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr( $invoice->get_status() ); ?>"> |
|
80 | + <div class="wpinv-items-wrap<?php echo esc_attr($class); ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr($invoice->get_status()); ?>"> |
|
81 | 81 | <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0"> |
82 | 82 | |
83 | 83 | <thead> |
84 | 84 | <tr> |
85 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
86 | - <th class="<?php echo esc_attr( $key ); echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '' ?>"><?php echo wp_kses_post( $label ); ?></th> |
|
85 | + <?php foreach ($columns as $key => $label) : ?> |
|
86 | + <th class="<?php echo esc_attr($key); echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '' ?>"><?php echo wp_kses_post($label); ?></th> |
|
87 | 87 | <?php endforeach; ?> |
88 | 88 | </tr> |
89 | 89 | </thead> |
90 | 90 | |
91 | 91 | <tbody class="wpinv-line-items"> |
92 | 92 | <?php |
93 | - foreach ( $invoice->get_items() as $int => $item ) { |
|
94 | - self::output_row( $columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd' ); |
|
93 | + foreach ($invoice->get_items() as $int => $item) { |
|
94 | + self::output_row($columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd'); |
|
95 | 95 | } |
96 | 96 | ?> |
97 | 97 | </tbody> |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | <div class="wp-clearfix"> |
109 | 109 | <label class="wpi-item-name"> |
110 | 110 | <span class="input-text-wrap"> |
111 | - <input type="text" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' );?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]"> |
|
111 | + <input type="text" style="width: 100%" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]"> |
|
112 | 112 | </span> |
113 | 113 | </label> |
114 | 114 | </div> |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | <div class="wp-clearfix"> |
117 | 117 | <label class="wpi-item-price"> |
118 | 118 | <span class="input-text-wrap"> |
119 | - <input type="text" style="width: 200px" placeholder="<?php esc_attr_e( 'Item Price', 'invoicing' );?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]"> |
|
120 | - × <input type="text" style="width: 140px" placeholder="<?php esc_attr_e( 'Item Quantity', 'invoicing' );?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]"> |
|
119 | + <input type="text" style="width: 200px" placeholder="<?php esc_attr_e('Item Price', 'invoicing'); ?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]"> |
|
120 | + × <input type="text" style="width: 140px" placeholder="<?php esc_attr_e('Item Quantity', 'invoicing'); ?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]"> |
|
121 | 121 | </span> |
122 | 122 | </label> |
123 | 123 | </div> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | <div class="wp-clearfix"> |
126 | 126 | <label class="wpi-item-name"> |
127 | 127 | <span class="input-text-wrap"> |
128 | - <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Description', 'invoicing' );?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea> |
|
128 | + <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e('Item Description', 'invoicing'); ?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea> |
|
129 | 129 | </span> |
130 | 130 | </label> |
131 | 131 | </div> |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | <div class="wp-clearfix"> |
134 | 134 | <label class="wpi-item-type"> |
135 | 135 | <span class="input-text-wrap"> |
136 | - <?php wpinv_html_select( array( |
|
136 | + <?php wpinv_html_select(array( |
|
137 | 137 | 'options' => $item_types, |
138 | 138 | 'name' => '_wpinv_quick[type]', |
139 | 139 | 'id' => '_wpinv_quick_type', |
@@ -141,19 +141,19 @@ discard block |
||
141 | 141 | 'show_option_all' => false, |
142 | 142 | 'show_option_none' => false, |
143 | 143 | 'class' => 'gdmbx2-text-medium wpinv-quick-type', |
144 | - ) ); ?> |
|
144 | + )); ?> |
|
145 | 145 | </span> |
146 | 146 | </label> |
147 | 147 | </div> |
148 | 148 | |
149 | - <?php if ( $use_taxes ) : ?> |
|
149 | + <?php if ($use_taxes) : ?> |
|
150 | 150 | <div class="wp-clearfix"> |
151 | 151 | <label class="wpi-vat-rule"> |
152 | 152 | <span class="input-text-wrap"> |
153 | 153 | <?php |
154 | - wpinv_html_select( array( |
|
154 | + wpinv_html_select(array( |
|
155 | 155 | 'options' => array_merge( |
156 | - array( '' => __( 'Select VAT Rule', 'invoicing' ) ), |
|
156 | + array('' => __('Select VAT Rule', 'invoicing')), |
|
157 | 157 | getpaid_get_tax_rules() |
158 | 158 | ), |
159 | 159 | 'name' => '_wpinv_quick[vat_rule]', |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 'show_option_none' => false, |
163 | 163 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-rule', |
164 | 164 | 'selected' => 'digital', |
165 | - ) ); |
|
165 | + )); |
|
166 | 166 | ?> |
167 | 167 | </span> |
168 | 168 | </label> |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | <label class="wpi-vat-class"> |
172 | 172 | <span class="input-text-wrap"> |
173 | 173 | <?php |
174 | - wpinv_html_select( array( |
|
174 | + wpinv_html_select(array( |
|
175 | 175 | 'options' => array_merge( |
176 | - array( '' => __( 'Select VAT Class', 'invoicing' ) ), |
|
176 | + array('' => __('Select VAT Class', 'invoicing')), |
|
177 | 177 | getpaid_get_tax_classes() |
178 | 178 | ), |
179 | 179 | 'name' => '_wpinv_quick[vat_class]', |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | 'show_option_none' => false, |
183 | 183 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-class', |
184 | 184 | 'selected' => '_standard', |
185 | - ) ); |
|
185 | + )); |
|
186 | 186 | ?> |
187 | 187 | </span> |
188 | 188 | </label> |
@@ -203,29 +203,29 @@ discard block |
||
203 | 203 | </td> |
204 | 204 | </tr> |
205 | 205 | <tr class="totals"> |
206 | - <td colspan="<?php echo ( (int) $cols - 4 ); ?>"></td> |
|
206 | + <td colspan="<?php echo ((int) $cols - 4); ?>"></td> |
|
207 | 207 | <td colspan="4"> |
208 | 208 | <table cellspacing="0" cellpadding="0"> |
209 | 209 | <tr class="subtotal"> |
210 | - <td class="name"><?php esc_html_e( 'Sub Total:', 'invoicing' );?></td> |
|
211 | - <td class="total"><?php wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() );?></td> |
|
210 | + <td class="name"><?php esc_html_e('Sub Total:', 'invoicing'); ?></td> |
|
211 | + <td class="total"><?php wpinv_the_price($invoice->get_subtotal(), $invoice->get_currency()); ?></td> |
|
212 | 212 | <td class="action"></td> |
213 | 213 | </tr> |
214 | 214 | <tr class="discount"> |
215 | - <td class="name"><?php esc_html_e( 'Discount:', 'invoicing' ) ; ?></td> |
|
216 | - <td class="total"><?php wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() );?></td> |
|
215 | + <td class="name"><?php esc_html_e('Discount:', 'invoicing'); ?></td> |
|
216 | + <td class="total"><?php wpinv_the_price($invoice->get_total_discount(), $invoice->get_currency()); ?></td> |
|
217 | 217 | <td class="action"></td> |
218 | 218 | </tr> |
219 | - <?php if ( $use_taxes ) : ?> |
|
219 | + <?php if ($use_taxes) : ?> |
|
220 | 220 | <tr class="tax"> |
221 | - <td class="name"><?php esc_html_e( 'Tax:', 'invoicing' );?></td> |
|
222 | - <td class="total"><?php wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() );?></td> |
|
221 | + <td class="name"><?php esc_html_e('Tax:', 'invoicing'); ?></td> |
|
222 | + <td class="total"><?php wpinv_the_price($invoice->get_total_tax(), $invoice->get_currency()); ?></td> |
|
223 | 223 | <td class="action"></td> |
224 | 224 | </tr> |
225 | 225 | <?php endif; ?> |
226 | 226 | <tr class="total"> |
227 | - <td class="name"><?php esc_html_e( 'Total:', 'invoicing' );?></td> |
|
228 | - <td class="total"><?php wpinv_the_price( $invoice->get_total(), $invoice->get_currency() );?></td> |
|
227 | + <td class="name"><?php esc_html_e('Total:', 'invoicing'); ?></td> |
|
228 | + <td class="total"><?php wpinv_the_price($invoice->get_total(), $invoice->get_currency()); ?></td> |
|
229 | 229 | <td class="action"></td> |
230 | 230 | </tr> |
231 | 231 | </table> |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | </table> |
237 | 237 | <div class="wpinv-actions"> |
238 | 238 | <?php |
239 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
239 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
240 | 240 | wpinv_item_dropdown( |
241 | 241 | array( |
242 | 242 | 'name' => 'wpinv_invoice_item', |
@@ -246,61 +246,61 @@ discard block |
||
246 | 246 | ) |
247 | 247 | ); |
248 | 248 | |
249 | - echo " " . '<button class="button button-primary" id="wpinv-add-item">' . sprintf( esc_html__( 'Add item to %s', 'invoicing' ), esc_html( $invoice->get_label() ) ) . '</button>'; |
|
250 | - echo " " . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__( 'Create new item', 'invoicing' ) . '</button>'; |
|
251 | - echo " " . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__( 'Recalculate Totals', 'invoicing' ) . '</button>'; |
|
249 | + echo " " . '<button class="button button-primary" id="wpinv-add-item">' . sprintf(esc_html__('Add item to %s', 'invoicing'), esc_html($invoice->get_label())) . '</button>'; |
|
250 | + echo " " . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__('Create new item', 'invoicing') . '</button>'; |
|
251 | + echo " " . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__('Recalculate Totals', 'invoicing') . '</button>'; |
|
252 | 252 | |
253 | 253 | } |
254 | 254 | ?> |
255 | - <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?> |
|
255 | + <?php do_action('wpinv_invoice_items_actions', $invoice); ?> |
|
256 | 256 | </div> |
257 | 257 | </div> |
258 | 258 | <?php |
259 | 259 | } |
260 | 260 | |
261 | - public static function output_row( $columns, $item, $invoice, $class='even' ) { |
|
261 | + public static function output_row($columns, $item, $invoice, $class = 'even') { |
|
262 | 262 | |
263 | 263 | ?> |
264 | - <tr class="item item-<?php echo esc_attr( $class ); ?>" data-item-id="<?php echo esc_attr( $item->get_id() ); ?>"> |
|
265 | - <?php foreach ( array_keys( $columns ) as $column ) : ?> |
|
266 | - <td class="<?php echo esc_attr( $column ); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>"> |
|
264 | + <tr class="item item-<?php echo esc_attr($class); ?>" data-item-id="<?php echo esc_attr($item->get_id()); ?>"> |
|
265 | + <?php foreach (array_keys($columns) as $column) : ?> |
|
266 | + <td class="<?php echo esc_attr($column); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>"> |
|
267 | 267 | <?php |
268 | - switch ( $column ) { |
|
268 | + switch ($column) { |
|
269 | 269 | case 'id': |
270 | 270 | echo (int) $item->get_id(); |
271 | 271 | break; |
272 | 272 | case 'title': |
273 | 273 | printf( |
274 | 274 | '<a href="%s" target="_blank">%s</a>', |
275 | - esc_url( get_edit_post_link( $item->get_id() ) ), |
|
276 | - esc_html( $item->get_raw_name() ) |
|
275 | + esc_url(get_edit_post_link($item->get_id())), |
|
276 | + esc_html($item->get_raw_name()) |
|
277 | 277 | ); |
278 | 278 | |
279 | - $summary = apply_filters( 'getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice ); |
|
280 | - if ( $summary !== '' ) { |
|
279 | + $summary = apply_filters('getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice); |
|
280 | + if ($summary !== '') { |
|
281 | 281 | printf( |
282 | 282 | '<span class="meta">%s</span>', |
283 | - wp_kses_post( wpautop( $summary ) ) |
|
283 | + wp_kses_post(wpautop($summary)) |
|
284 | 284 | ); |
285 | 285 | } |
286 | 286 | |
287 | 287 | printf( |
288 | 288 | '<input type="hidden" value="%s" name="getpaid_items[%s][name]" class="getpaid-recalculate-prices-on-change" />', |
289 | - esc_attr( $item->get_raw_name() ), |
|
289 | + esc_attr($item->get_raw_name()), |
|
290 | 290 | (int) $item->get_id() |
291 | 291 | ); |
292 | 292 | |
293 | 293 | printf( |
294 | 294 | '<textarea style="display: none;" name="getpaid_items[%s][description]" class="getpaid-recalculate-prices-on-change">%s</textarea>', |
295 | 295 | (int) $item->get_id(), |
296 | - esc_attr( $item->get_description() ) |
|
296 | + esc_attr($item->get_description()) |
|
297 | 297 | ); |
298 | 298 | |
299 | 299 | break; |
300 | 300 | case 'price': |
301 | 301 | printf( |
302 | 302 | '<input type="text" value="%s" name="getpaid_items[%s][price]" style="width: 100px;" class="getpaid-admin-invoice-item-price getpaid-recalculate-prices-on-change" />', |
303 | - esc_attr( getpaid_unstandardize_amount( $item->get_price() ) ), |
|
303 | + esc_attr(getpaid_unstandardize_amount($item->get_price())), |
|
304 | 304 | (int) $item->get_id() |
305 | 305 | ); |
306 | 306 | |
@@ -308,26 +308,26 @@ discard block |
||
308 | 308 | case 'qty': |
309 | 309 | printf( |
310 | 310 | '<input type="text" style="width: 100px;" value="%s" name="getpaid_items[%s][quantity]" class="getpaid-admin-invoice-item-quantity getpaid-recalculate-prices-on-change" />', |
311 | - floatval( $item->get_quantity() ), |
|
311 | + floatval($item->get_quantity()), |
|
312 | 312 | (int) $item->get_id() |
313 | 313 | ); |
314 | 314 | |
315 | 315 | break; |
316 | 316 | case 'total': |
317 | - wpinv_the_price( $item->get_sub_total(), $invoice->get_currency() ); |
|
317 | + wpinv_the_price($item->get_sub_total(), $invoice->get_currency()); |
|
318 | 318 | |
319 | 319 | break; |
320 | 320 | case 'tax': |
321 | - echo floatval( wpinv_round_amount( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%'; |
|
321 | + echo floatval(wpinv_round_amount(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%'; |
|
322 | 322 | |
323 | 323 | break; |
324 | 324 | case 'action': |
325 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
325 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
326 | 326 | echo '<i class="fa fa-trash wpinv-item-remove"></i>'; |
327 | 327 | } |
328 | 328 | break; |
329 | 329 | } |
330 | - do_action( 'getpaid_admin_edit_invoice_item_' . $column, $item, $invoice ); |
|
330 | + do_action('getpaid_admin_edit_invoice_item_' . $column, $item, $invoice); |
|
331 | 331 | ?> |
332 | 332 | </td> |
333 | 333 | <?php endforeach; ?> |
@@ -340,10 +340,10 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @param WP_Post $post |
342 | 342 | */ |
343 | - public static function output2( $post ) { |
|
343 | + public static function output2($post) { |
|
344 | 344 | |
345 | 345 | // Prepare the invoice. |
346 | - $invoice = new WPInv_Invoice( $post ); |
|
346 | + $invoice = new WPInv_Invoice($post); |
|
347 | 347 | |
348 | 348 | // Invoice items. |
349 | 349 | $items = $invoice->get_items(); |
@@ -351,28 +351,28 @@ discard block |
||
351 | 351 | $totals = array( |
352 | 352 | |
353 | 353 | 'subtotal' => array( |
354 | - 'label' => __( 'Items Subtotal', 'invoicing' ), |
|
355 | - 'value' => wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ), |
|
354 | + 'label' => __('Items Subtotal', 'invoicing'), |
|
355 | + 'value' => wpinv_price($invoice->get_subtotal(), $invoice->get_currency()), |
|
356 | 356 | ), |
357 | 357 | |
358 | 358 | 'discount' => array( |
359 | - 'label' => __( 'Total Discount', 'invoicing' ), |
|
360 | - 'value' => wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ), |
|
359 | + 'label' => __('Total Discount', 'invoicing'), |
|
360 | + 'value' => wpinv_price($invoice->get_total_discount(), $invoice->get_currency()), |
|
361 | 361 | ), |
362 | 362 | |
363 | 363 | 'tax' => array( |
364 | - 'label' => __( 'Total Tax', 'invoicing' ), |
|
365 | - 'value' => wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ), |
|
364 | + 'label' => __('Total Tax', 'invoicing'), |
|
365 | + 'value' => wpinv_price($invoice->get_total_tax(), $invoice->get_currency()), |
|
366 | 366 | ), |
367 | 367 | |
368 | 368 | 'total' => array( |
369 | - 'label' => __( 'Invoice Total', 'invoicing' ), |
|
370 | - 'value' => wpinv_price( $invoice->get_total(), $invoice->get_currency() ), |
|
369 | + 'label' => __('Invoice Total', 'invoicing'), |
|
370 | + 'value' => wpinv_price($invoice->get_total(), $invoice->get_currency()), |
|
371 | 371 | ) |
372 | 372 | ); |
373 | 373 | |
374 | - if ( ! wpinv_use_taxes() ) { |
|
375 | - unset( $totals['tax'] ); |
|
374 | + if (!wpinv_use_taxes()) { |
|
375 | + unset($totals['tax']); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | $item_args = array( |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | 'orderby' => 'title', |
381 | 381 | 'order' => 'ASC', |
382 | 382 | 'posts_per_page' => -1, |
383 | - 'post_status' => array( 'publish' ), |
|
383 | + 'post_status' => array('publish'), |
|
384 | 384 | 'meta_query' => array( |
385 | 385 | array( |
386 | 386 | 'key' => '_wpinv_type', |
@@ -404,10 +404,10 @@ discard block |
||
404 | 404 | } |
405 | 405 | </style> |
406 | 406 | |
407 | - <div class="bsui getpaid-invoice-items-inner <?php echo empty( $items ) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem; padding: 0 12px 12px;"> |
|
407 | + <div class="bsui getpaid-invoice-items-inner <?php echo empty($items) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem; padding: 0 12px 12px;"> |
|
408 | 408 | |
409 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?> |
|
410 | - <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?> |
|
409 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?> |
|
410 | + <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?> |
|
411 | 411 | |
412 | 412 | <div class="row"> |
413 | 413 | <div class="col-12 col-sm-6"> |
@@ -416,15 +416,15 @@ discard block |
||
416 | 416 | array( |
417 | 417 | 'id' => 'wpinv_template', |
418 | 418 | 'name' => 'wpinv_template', |
419 | - 'label' => __( 'Template', 'invoicing' ), |
|
419 | + 'label' => __('Template', 'invoicing'), |
|
420 | 420 | 'label_type' => 'vertical', |
421 | - 'placeholder' => __( 'Choose a template', 'invoicing' ), |
|
421 | + 'placeholder' => __('Choose a template', 'invoicing'), |
|
422 | 422 | 'class' => 'form-control-sm', |
423 | - 'value' => $invoice->get_template( 'edit' ), |
|
423 | + 'value' => $invoice->get_template('edit'), |
|
424 | 424 | 'options' => array( |
425 | - 'quantity' => __( 'Quantity', 'invoicing' ), |
|
426 | - 'hours' => __( 'Hours', 'invoicing' ), |
|
427 | - 'amount' => __( 'Amount Only', 'invoicing' ), |
|
425 | + 'quantity' => __('Quantity', 'invoicing'), |
|
426 | + 'hours' => __('Hours', 'invoicing'), |
|
427 | + 'amount' => __('Amount Only', 'invoicing'), |
|
428 | 428 | ), |
429 | 429 | 'data-allow-clear' => 'false', |
430 | 430 | 'select2' => true, |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | array( |
442 | 442 | 'id' => 'wpinv_currency', |
443 | 443 | 'name' => 'wpinv_currency', |
444 | - 'label' => __( 'Currency', 'invoicing' ), |
|
444 | + 'label' => __('Currency', 'invoicing'), |
|
445 | 445 | 'label_type' => 'vertical', |
446 | - 'placeholder' => __( 'Select Invoice Currency', 'invoicing' ), |
|
446 | + 'placeholder' => __('Select Invoice Currency', 'invoicing'), |
|
447 | 447 | 'class' => 'form-control-sm', |
448 | - 'value' => $invoice->get_currency( 'edit' ), |
|
448 | + 'value' => $invoice->get_currency('edit'), |
|
449 | 449 | 'required' => false, |
450 | 450 | 'data-allow-clear' => 'false', |
451 | 451 | 'select2' => true, |
@@ -458,24 +458,24 @@ discard block |
||
458 | 458 | </div> |
459 | 459 | </div> |
460 | 460 | |
461 | - <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?> |
|
461 | + <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?> |
|
462 | 462 | <?php endif; ?> |
463 | 463 | |
464 | 464 | <table cellpadding="0" cellspacing="0" class="getpaid_invoice_items"> |
465 | 465 | <thead> |
466 | 466 | <tr> |
467 | - <th class="getpaid-item" colspan="2"><?php esc_html_e( 'Item', 'invoicing' ) ?></th> |
|
467 | + <th class="getpaid-item" colspan="2"><?php esc_html_e('Item', 'invoicing') ?></th> |
|
468 | 468 | <th class="getpaid-quantity hide-if-amount text-right"> |
469 | - <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Quantity', 'invoicing' ) ?></span> |
|
470 | - <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Hours', 'invoicing' ) ?></span> |
|
469 | + <span class="getpaid-hide-if-hours"><?php esc_html_e('Quantity', 'invoicing') ?></span> |
|
470 | + <span class="getpaid-hide-if-quantity"><?php esc_html_e('Hours', 'invoicing') ?></span> |
|
471 | 471 | </th> |
472 | 472 | <th class="getpaid-price hide-if-amount text-right"> |
473 | - <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Price', 'invoicing' ) ?></span> |
|
474 | - <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Rate', 'invoicing' ) ?></span> |
|
473 | + <span class="getpaid-hide-if-hours"><?php esc_html_e('Price', 'invoicing') ?></span> |
|
474 | + <span class="getpaid-hide-if-quantity"><?php esc_html_e('Rate', 'invoicing') ?></span> |
|
475 | 475 | </th> |
476 | 476 | <th class="getpaid-item-subtotal text-right"> |
477 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php esc_html_e( 'Amount', 'invoicing' ) ?></span> |
|
478 | - <span class="hide-if-amount"><?php esc_html_e( 'Total', 'invoicing' ) ?></span> |
|
477 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php esc_html_e('Amount', 'invoicing') ?></span> |
|
478 | + <span class="hide-if-amount"><?php esc_html_e('Total', 'invoicing') ?></span> |
|
479 | 479 | </th> |
480 | 480 | <th class="getpaid-item-actions hide-if-not-editable" width="70px"> </th> |
481 | 481 | </tr> |
@@ -483,8 +483,8 @@ discard block |
||
483 | 483 | <tbody class="getpaid_invoice_line_items"> |
484 | 484 | <tr class="hide-if-has-items hide-if-not-editable"> |
485 | 485 | <td colspan="2" class="pt-4 pb-4"> |
486 | - <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php esc_html_e( 'Add Existing Items', 'invoicing' ) ?></button> |
|
487 | - <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php esc_html_e( 'Create New Item', 'invoicing' ) ?></button> |
|
486 | + <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php esc_html_e('Add Existing Items', 'invoicing') ?></button> |
|
487 | + <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php esc_html_e('Create New Item', 'invoicing') ?></button> |
|
488 | 488 | </td> |
489 | 489 | <td class="hide-if-amount"> </th> |
490 | 490 | <td class="hide-if-amount"> </th> |
@@ -516,11 +516,11 @@ discard block |
||
516 | 516 | <div class="col-12 col-sm-6 offset-sm-6"> |
517 | 517 | <table class="getpaid-invoice-totals text-right w-100"> |
518 | 518 | <tbody> |
519 | - <?php foreach ( apply_filters( 'getpaid_invoice_subtotal_rows', $totals, $invoice ) as $key => $data ) : ?> |
|
520 | - <tr class="getpaid-totals-<?php echo esc_attr( $key ); ?>"> |
|
521 | - <td class="label"><?php echo esc_html( $data['label'] ) ?>:</td> |
|
519 | + <?php foreach (apply_filters('getpaid_invoice_subtotal_rows', $totals, $invoice) as $key => $data) : ?> |
|
520 | + <tr class="getpaid-totals-<?php echo esc_attr($key); ?>"> |
|
521 | + <td class="label"><?php echo esc_html($data['label']) ?>:</td> |
|
522 | 522 | <td width="1%"></td> |
523 | - <td class="value"><?php echo wp_kses_post( $data['value'] ) ?></td> |
|
523 | + <td class="value"><?php echo wp_kses_post($data['value']) ?></td> |
|
524 | 524 | </tr> |
525 | 525 | <?php endforeach; ?> |
526 | 526 | </tbody> |
@@ -533,18 +533,18 @@ discard block |
||
533 | 533 | <div class="getpaid-invoice-item-actions hide-if-no-items hide-if-not-editable"> |
534 | 534 | <div class="row"> |
535 | 535 | <div class="text-left col-12 col-sm-8"> |
536 | - <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php esc_html_e( 'Add Existing Item', 'invoicing' ) ?></button> |
|
537 | - <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php esc_html_e( 'Create New Item', 'invoicing' ) ?></button> |
|
538 | - <?php do_action( 'getpaid-invoice-items-actions', $invoice ); ?> |
|
536 | + <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php esc_html_e('Add Existing Item', 'invoicing') ?></button> |
|
537 | + <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php esc_html_e('Create New Item', 'invoicing') ?></button> |
|
538 | + <?php do_action('getpaid-invoice-items-actions', $invoice); ?> |
|
539 | 539 | </div> |
540 | 540 | <div class="text-right col-12 col-sm-4"> |
541 | - <button type="button" class="button button-primary recalculate-totals-button"><?php esc_html_e( 'Recalculate Totals', 'invoicing' ) ?></button> |
|
541 | + <button type="button" class="button button-primary recalculate-totals-button"><?php esc_html_e('Recalculate Totals', 'invoicing') ?></button> |
|
542 | 542 | </div> |
543 | 543 | </div> |
544 | 544 | </div> |
545 | 545 | |
546 | 546 | <div class="getpaid-invoice-item-actions hide-if-editable"> |
547 | - <p class="description m-2 text-right text-muted"><?php esc_html_e( 'This invoice is no longer editable', 'invoicing' ); ?></p> |
|
547 | + <p class="description m-2 text-right text-muted"><?php esc_html_e('This invoice is no longer editable', 'invoicing'); ?></p> |
|
548 | 548 | </div> |
549 | 549 | |
550 | 550 | <!-- Add items to an invoice --> |
@@ -552,9 +552,9 @@ discard block |
||
552 | 552 | <div class="modal-dialog modal-dialog-centered" role="document"> |
553 | 553 | <div class="modal-content"> |
554 | 554 | <div class="modal-header"> |
555 | - <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php esc_html_e( "Add Item(s)", 'invoicing' ); ?></h5> |
|
556 | - <button type="button" class="close btn-close" data-dismiss="modal" aria-label="<?php esc_html_e( "Close", 'invoicing' ); ?>"> |
|
557 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
555 | + <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php esc_html_e("Add Item(s)", 'invoicing'); ?></h5> |
|
556 | + <button type="button" class="close btn-close" data-dismiss="modal" aria-label="<?php esc_html_e("Close", 'invoicing'); ?>"> |
|
557 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
558 | 558 | <span aria-hidden="true">×</span> |
559 | 559 | <?php endif; ?> |
560 | 560 | </button> |
@@ -563,10 +563,10 @@ discard block |
||
563 | 563 | <table class="widefat"> |
564 | 564 | <thead> |
565 | 565 | <tr> |
566 | - <th class="pl-0 text-left"><?php esc_html_e( 'Item', 'invoicing' ) ?></th> |
|
566 | + <th class="pl-0 text-left"><?php esc_html_e('Item', 'invoicing') ?></th> |
|
567 | 567 | <th class="pr-0 text-right hide-if-amount"> |
568 | - <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Quantity', 'invoicing' ) ?></span> |
|
569 | - <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Hours', 'invoicing' ) ?></span> |
|
568 | + <span class="getpaid-hide-if-hours"><?php esc_html_e('Quantity', 'invoicing') ?></span> |
|
569 | + <span class="getpaid-hide-if-quantity"><?php esc_html_e('Hours', 'invoicing') ?></span> |
|
570 | 570 | </th> |
571 | 571 | </tr> |
572 | 572 | </thead> |
@@ -574,9 +574,9 @@ discard block |
||
574 | 574 | <tr> |
575 | 575 | <td class="pl-0 text-left"> |
576 | 576 | <select class="regular-text getpaid-add-invoice-item-select"> |
577 | - <option value="" selected="selected" disabled><?php esc_html_e( 'Select an item…', 'invoicing' ); ?></option> |
|
578 | - <?php foreach ( get_posts( $item_args ) as $item ) : ?> |
|
579 | - <option value="<?php echo (int) $item->ID; ?>"><?php echo esc_html( $item->post_title ); ?></option> |
|
577 | + <option value="" selected="selected" disabled><?php esc_html_e('Select an item…', 'invoicing'); ?></option> |
|
578 | + <?php foreach (get_posts($item_args) as $item) : ?> |
|
579 | + <option value="<?php echo (int) $item->ID; ?>"><?php echo esc_html($item->post_title); ?></option> |
|
580 | 580 | <?php endforeach; ?> |
581 | 581 | </select> |
582 | 582 | </td> |
@@ -588,8 +588,8 @@ discard block |
||
588 | 588 | </table> |
589 | 589 | </div> |
590 | 590 | <div class="modal-footer"> |
591 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button> |
|
592 | - <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php esc_html_e( 'Add', 'invoicing' ); ?></button> |
|
591 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button> |
|
592 | + <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php esc_html_e('Add', 'invoicing'); ?></button> |
|
593 | 593 | </div> |
594 | 594 | </div> |
595 | 595 | </div> |
@@ -600,9 +600,9 @@ discard block |
||
600 | 600 | <div class="modal-dialog modal-dialog-centered" role="document"> |
601 | 601 | <div class="modal-content"> |
602 | 602 | <div class="modal-header"> |
603 | - <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php esc_html_e( "Create Item", 'invoicing' ); ?></h5> |
|
604 | - <button type="button" class="close btn-close" data-dismiss="modal" aria-label="<?php esc_html_e( "Close", 'invoicing' ); ?>"> |
|
605 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
603 | + <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php esc_html_e("Create Item", 'invoicing'); ?></h5> |
|
604 | + <button type="button" class="close btn-close" data-dismiss="modal" aria-label="<?php esc_html_e("Close", 'invoicing'); ?>"> |
|
605 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
606 | 606 | <span aria-hidden="true">×</span> |
607 | 607 | <?php endif; ?> |
608 | 608 | </button> |
@@ -611,27 +611,27 @@ discard block |
||
611 | 611 | <div class="getpaid-create-item-div"> |
612 | 612 | <input type="hidden" name="id" value="new" class="form-control form-control-sm item-id"> |
613 | 613 | <label class="form-group mb-3 w-100"> |
614 | - <span><?php esc_html_e( 'Name', 'invoicing' ); ?></span> |
|
615 | - <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name"> |
|
614 | + <span><?php esc_html_e('Name', 'invoicing'); ?></span> |
|
615 | + <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name"> |
|
616 | 616 | </label> |
617 | 617 | <label class="form-group mb-3 w-100"> |
618 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e( 'Amount', 'invoicing' ); ?></span> |
|
619 | - <span class="hide-if-amount"><?php esc_html_e( 'Price', 'invoicing' ); ?></span> |
|
620 | - <input type="text" name="price" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control form-control-sm item-price"> |
|
618 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e('Amount', 'invoicing'); ?></span> |
|
619 | + <span class="hide-if-amount"><?php esc_html_e('Price', 'invoicing'); ?></span> |
|
620 | + <input type="text" name="price" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control form-control-sm item-price"> |
|
621 | 621 | </label> |
622 | 622 | <label class="form-group mb-3 w-100 hide-if-amount"> |
623 | - <span><?php esc_html_e( 'Quantity', 'invoicing' ); ?></span> |
|
623 | + <span><?php esc_html_e('Quantity', 'invoicing'); ?></span> |
|
624 | 624 | <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity"> |
625 | 625 | </label> |
626 | 626 | <label class="form-group mb-3 w-100"> |
627 | - <span><?php esc_html_e( 'Item Description', 'invoicing' ); ?></span> |
|
628 | - <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea> |
|
627 | + <span><?php esc_html_e('Item Description', 'invoicing'); ?></span> |
|
628 | + <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea> |
|
629 | 629 | </label> |
630 | 630 | </div> |
631 | 631 | </div> |
632 | 632 | <div class="modal-footer"> |
633 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button> |
|
634 | - <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e( 'Create', 'invoicing' ); ?></button> |
|
633 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button> |
|
634 | + <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e('Create', 'invoicing'); ?></button> |
|
635 | 635 | </div> |
636 | 636 | </div> |
637 | 637 | </div> |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | <div class="modal-dialog modal-dialog-centered" role="document"> |
643 | 643 | <div class="modal-content"> |
644 | 644 | <div class="modal-header"> |
645 | - <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php esc_html_e( "Edit Item", 'invoicing' ); ?></h5> |
|
646 | - <button type="button" class="close close" data-dismiss="modal" aria-label="<?php esc_html_e( "Close", 'invoicing' ); ?>"> |
|
647 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
645 | + <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php esc_html_e("Edit Item", 'invoicing'); ?></h5> |
|
646 | + <button type="button" class="close close" data-dismiss="modal" aria-label="<?php esc_html_e("Close", 'invoicing'); ?>"> |
|
647 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
648 | 648 | <span aria-hidden="true">×</span> |
649 | 649 | <?php endif; ?> |
650 | 650 | </button> |
@@ -653,27 +653,27 @@ discard block |
||
653 | 653 | <div class="getpaid-edit-item-div"> |
654 | 654 | <input type="hidden" name="id" class="form-control form-control-sm item-id"> |
655 | 655 | <label class="form-group mb-3 w-100"> |
656 | - <span><?php esc_html_e( 'Name', 'invoicing' ); ?></span> |
|
657 | - <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name"> |
|
656 | + <span><?php esc_html_e('Name', 'invoicing'); ?></span> |
|
657 | + <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name"> |
|
658 | 658 | </label> |
659 | 659 | <label class="form-group mb-3 w-100"> |
660 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e( 'Amount', 'invoicing' ); ?></span> |
|
661 | - <span class="hide-if-amount"><?php esc_html_e( 'Price', 'invoicing' ); ?></span> |
|
662 | - <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price"> |
|
660 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e('Amount', 'invoicing'); ?></span> |
|
661 | + <span class="hide-if-amount"><?php esc_html_e('Price', 'invoicing'); ?></span> |
|
662 | + <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price"> |
|
663 | 663 | </label> |
664 | 664 | <label class="form-group mb-3 w-100 hide-if-amount"> |
665 | - <span><?php esc_html_e( 'Quantity', 'invoicing' ); ?></span> |
|
665 | + <span><?php esc_html_e('Quantity', 'invoicing'); ?></span> |
|
666 | 666 | <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity"> |
667 | 667 | </label> |
668 | 668 | <label class="form-group mb-3 w-100"> |
669 | - <span><?php esc_html_e( 'Item Description', 'invoicing' ); ?></span> |
|
670 | - <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea> |
|
669 | + <span><?php esc_html_e('Item Description', 'invoicing'); ?></span> |
|
670 | + <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea> |
|
671 | 671 | </label> |
672 | 672 | </div> |
673 | 673 | </div> |
674 | 674 | <div class="modal-footer"> |
675 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button> |
|
676 | - <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e( 'Save', 'invoicing' ); ?></button> |
|
675 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button> |
|
676 | + <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e('Save', 'invoicing'); ?></button> |
|
677 | 677 | </div> |
678 | 678 | </div> |
679 | 679 | </div> |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | */ |
16 | 16 | |
17 | 17 | if ( ! defined( 'ABSPATH' ) ) { |
18 | - exit; |
|
18 | + exit; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | if ( ! class_exists( 'AyeCode_Deactivation_Survey' ) ) { |
22 | - // include the class if needed |
|
23 | - include_once( dirname( __FILE__ ) . "/wp-deactivation-survey.php" ); |
|
22 | + // include the class if needed |
|
23 | + include_once( dirname( __FILE__ ) . "/wp-deactivation-survey.php" ); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -36,6 +36,6 @@ discard block |
||
36 | 36 | //}); |
37 | 37 | |
38 | 38 | AyeCode_Deactivation_Survey::instance(array( |
39 | - 'slug' => 'ayecode-deactivation-survey-testing', |
|
40 | - 'version' => '1.0.0' |
|
39 | + 'slug' => 'ayecode-deactivation-survey-testing', |
|
40 | + 'version' => '1.0.0' |
|
41 | 41 | )); |
42 | 42 | \ No newline at end of file |
@@ -14,13 +14,13 @@ |
||
14 | 14 | * Tested up to: 5.8 |
15 | 15 | */ |
16 | 16 | |
17 | -if ( ! defined( 'ABSPATH' ) ) { |
|
17 | +if (!defined('ABSPATH')) { |
|
18 | 18 | exit; |
19 | 19 | } |
20 | 20 | |
21 | -if ( ! class_exists( 'AyeCode_Deactivation_Survey' ) ) { |
|
21 | +if (!class_exists('AyeCode_Deactivation_Survey')) { |
|
22 | 22 | // include the class if needed |
23 | - include_once( dirname( __FILE__ ) . "/wp-deactivation-survey.php" ); |
|
23 | + include_once(dirname(__FILE__) . "/wp-deactivation-survey.php"); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 |
@@ -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 | 12 | ?> |
13 | 13 | <span>{{form_element.text}}</span> |
14 | 14 | <a target='_blank' href="#"> |
15 | - <?php echo esc_html( wpinv_get_ip() ); ?> <i class='fa fa-external-link-square' aria-hidden='true'></i> |
|
15 | + <?php echo esc_html(wpinv_get_ip()); ?> <i class='fa fa-external-link-square' aria-hidden='true'></i> |
|
16 | 16 | </a> |
@@ -6,35 +6,35 @@ discard block |
||
6 | 6 | |
7 | 7 | class ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5 |
8 | 8 | { |
9 | - public static $files = array ( |
|
9 | + public static $files = array( |
|
10 | 10 | 'e8d544c98e79f913e13eae1306ab635e' => __DIR__ . '/..' . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php', |
11 | 11 | '24583d3588ebda5228dd453cfaa070da' => __DIR__ . '/..' . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php', |
12 | 12 | '42671a413efb740d7040437ff2a982cd' => __DIR__ . '/..' . '/ayecode/wp-super-duper/sd-functions.php', |
13 | 13 | ); |
14 | 14 | |
15 | - public static $prefixLengthsPsr4 = array ( |
|
15 | + public static $prefixLengthsPsr4 = array( |
|
16 | 16 | 'M' => |
17 | - array ( |
|
17 | + array( |
|
18 | 18 | 'MaxMind\\Db\\' => 11, |
19 | 19 | ), |
20 | 20 | 'C' => |
21 | - array ( |
|
21 | + array( |
|
22 | 22 | 'Composer\\Installers\\' => 20, |
23 | 23 | ), |
24 | 24 | ); |
25 | 25 | |
26 | - public static $prefixDirsPsr4 = array ( |
|
26 | + public static $prefixDirsPsr4 = array( |
|
27 | 27 | 'MaxMind\\Db\\' => |
28 | - array ( |
|
28 | + array( |
|
29 | 29 | 0 => __DIR__ . '/..' . '/maxmind-db/reader/src/MaxMind/Db', |
30 | 30 | ), |
31 | 31 | 'Composer\\Installers\\' => |
32 | - array ( |
|
32 | + array( |
|
33 | 33 | 0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers', |
34 | 34 | ), |
35 | 35 | ); |
36 | 36 | |
37 | - public static $classMap = array ( |
|
37 | + public static $classMap = array( |
|
38 | 38 | 'AyeCode_Connect_Helper' => __DIR__ . '/..' . '/ayecode/ayecode-connect-helper/ayecode-connect-helper.php', |
39 | 39 | 'AyeCode_Deactivation_Survey' => __DIR__ . '/..' . '/ayecode/wp-deactivation-survey/wp-deactivation-survey.php', |
40 | 40 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public static function getInitializer(ClassLoader $loader) |
45 | 45 | { |
46 | - return \Closure::bind(function () use ($loader) { |
|
46 | + return \Closure::bind(function() use ($loader) { |
|
47 | 47 | $loader->prefixLengthsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixLengthsPsr4; |
48 | 48 | $loader->prefixDirsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixDirsPsr4; |
49 | 49 | $loader->classMap = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$classMap; |
@@ -312,9 +312,9 @@ |
||
312 | 312 | foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { |
313 | 313 | if (isset(self::$installedByVendor[$vendorDir])) { |
314 | 314 | $installed[] = self::$installedByVendor[$vendorDir]; |
315 | - } elseif (is_file($vendorDir.'/composer/installed.php')) { |
|
316 | - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; |
|
317 | - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
315 | + } elseif (is_file($vendorDir . '/composer/installed.php')) { |
|
316 | + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir . '/composer/installed.php'; |
|
317 | + if (null === self::$installed && strtr($vendorDir . '/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
318 | 318 | self::$installed = $installed[count($installed) - 1]; |
319 | 319 | } |
320 | 320 | } |
@@ -14,9 +14,9 @@ |
||
14 | 14 | } |
15 | 15 | if (!ini_get('display_errors')) { |
16 | 16 | if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { |
17 | - fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); |
|
17 | + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL . PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL . PHP_EOL); |
|
18 | 18 | } elseif (!headers_sent()) { |
19 | - echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; |
|
19 | + echo 'Composer detected issues in your platform:' . PHP_EOL . PHP_EOL . str_replace('You are running ' . PHP_VERSION . '.', '', implode(PHP_EOL, $issues)) . PHP_EOL . PHP_EOL; |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | trigger_error( |