@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
8 | +if (!defined('ABSPATH')) { |
|
9 | 9 | exit; // Exit if accessed directly |
10 | 10 | } |
11 | 11 | |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @param WP_Post $post |
21 | 21 | */ |
22 | - public static function output( $post ) { |
|
22 | + public static function output($post) { |
|
23 | 23 | |
24 | 24 | // Fetch the invoice. |
25 | - $invoice = new WPInv_Invoice( $post ); |
|
25 | + $invoice = new WPInv_Invoice($post); |
|
26 | 26 | |
27 | - do_action( 'wpinv_metabox_resend_invoice_before', $invoice ); |
|
27 | + do_action('wpinv_metabox_resend_invoice_before', $invoice); |
|
28 | 28 | |
29 | 29 | $invoice_actions = array( |
30 | 30 | 'resend-email' => array( |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | 'getpaid-nonce', |
39 | 39 | 'getpaid-nonce' |
40 | 40 | ), |
41 | - 'label' => __( 'Resend Invoice', 'invoicing' ), |
|
41 | + 'label' => __('Resend Invoice', 'invoicing'), |
|
42 | 42 | ) |
43 | 43 | ); |
44 | 44 | |
45 | - if ( $invoice->needs_payment() ) { |
|
45 | + if ($invoice->needs_payment()) { |
|
46 | 46 | |
47 | 47 | $invoice_actions['send-reminder'] = array( |
48 | 48 | 'url' => wp_nonce_url( |
@@ -55,29 +55,29 @@ discard block |
||
55 | 55 | 'getpaid-nonce', |
56 | 56 | 'getpaid-nonce' |
57 | 57 | ), |
58 | - 'label' => __( 'Send Reminder', 'invoicing' ), |
|
58 | + 'label' => __('Send Reminder', 'invoicing'), |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | - $invoice_actions = apply_filters( 'getpaid_edit_invoice_actions', $invoice_actions, $invoice ); |
|
63 | + $invoice_actions = apply_filters('getpaid_edit_invoice_actions', $invoice_actions, $invoice); |
|
64 | 64 | |
65 | - foreach ( $invoice_actions as $key => $action ) { |
|
65 | + foreach ($invoice_actions as $key => $action) { |
|
66 | 66 | |
67 | - if ( 'resend-email' === $key ) { |
|
68 | - echo wpautop( __( "This will send a copy of the invoice to the customer's email address.", 'invoicing' ) ); |
|
67 | + if ('resend-email' === $key) { |
|
68 | + echo wpautop(__("This will send a copy of the invoice to the customer's email address.", 'invoicing')); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | printf( |
72 | 72 | '<p class="wpi-meta-row wpi-%s"><a href="%s" class="button button-secondary">%s</a>', |
73 | - esc_attr( $key ), |
|
74 | - esc_url( $action['url'] ), |
|
75 | - esc_html( $action['label'] ) |
|
73 | + esc_attr($key), |
|
74 | + esc_url($action['url']), |
|
75 | + esc_html($action['label']) |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - do_action( 'wpinv_metabox_resend_invoice_after', $invoice ); |
|
80 | + do_action('wpinv_metabox_resend_invoice_after', $invoice); |
|
81 | 81 | |
82 | 82 | } |
83 | 83 |
@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | * Displays a list of all subscriptions rules |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
6 | +if (!defined('ABSPATH')) exit; |
|
7 | 7 | |
8 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
8 | +if (!class_exists('WP_List_Table')) { |
|
9 | 9 | include_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
10 | 10 | } |
11 | 11 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $this->prepare_query(); |
80 | 80 | |
81 | - $this->base_url = remove_query_arg( 'status' ); |
|
81 | + $this->base_url = remove_query_arg('status'); |
|
82 | 82 | |
83 | 83 | } |
84 | 84 | |
@@ -91,21 +91,21 @@ discard block |
||
91 | 91 | $query = array( |
92 | 92 | 'number' => $this->per_page, |
93 | 93 | 'paged' => $this->get_paged(), |
94 | - 'status' => ( isset( $_GET['status'] ) && array_key_exists( $_GET['status'], getpaid_get_subscription_statuses() ) ) ? $_GET['status'] : 'all', |
|
95 | - 'orderby' => ( isset( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'id', |
|
96 | - 'order' => ( isset( $_GET['order'] ) ) ? $_GET['order'] : 'DESC', |
|
94 | + 'status' => (isset($_GET['status']) && array_key_exists($_GET['status'], getpaid_get_subscription_statuses())) ? $_GET['status'] : 'all', |
|
95 | + 'orderby' => (isset($_GET['orderby'])) ? $_GET['orderby'] : 'id', |
|
96 | + 'order' => (isset($_GET['order'])) ? $_GET['order'] : 'DESC', |
|
97 | 97 | ); |
98 | 98 | |
99 | 99 | // Prepare class properties. |
100 | - $this->query = new GetPaid_Subscriptions_Query( $query ); |
|
100 | + $this->query = new GetPaid_Subscriptions_Query($query); |
|
101 | 101 | $this->total_count = $this->query->get_total(); |
102 | 102 | $this->current_total_count = $this->query->get_total(); |
103 | 103 | $this->items = $this->query->get_results(); |
104 | - $this->status_counts = getpaid_get_subscription_status_counts( $query ); |
|
104 | + $this->status_counts = getpaid_get_subscription_status_counts($query); |
|
105 | 105 | |
106 | - if ( 'all' != $query['status'] ) { |
|
107 | - unset( $query['status'] ); |
|
108 | - $this->total_count = getpaid_get_subscriptions( $query, 'count' ); |
|
106 | + if ('all' != $query['status']) { |
|
107 | + unset($query['status']); |
|
108 | + $this->total_count = getpaid_get_subscriptions($query, 'count'); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | } |
@@ -122,26 +122,26 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function get_views() { |
124 | 124 | |
125 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : 'all'; |
|
125 | + $current = isset($_GET['status']) ? $_GET['status'] : 'all'; |
|
126 | 126 | $views = array( |
127 | 127 | |
128 | 128 | 'all' => sprintf( |
129 | 129 | '<a href="%s" %s>%s <span class="count">(%d)</span></a>', |
130 | - esc_url( add_query_arg( 'status', false, $this->base_url ) ), |
|
130 | + esc_url(add_query_arg('status', false, $this->base_url)), |
|
131 | 131 | $current === 'all' ? ' class="current"' : '', |
132 | - __('All','invoicing' ), |
|
132 | + __('All', 'invoicing'), |
|
133 | 133 | $this->total_count |
134 | 134 | ) |
135 | 135 | |
136 | 136 | ); |
137 | 137 | |
138 | - foreach ( array_filter( $this->status_counts ) as $status => $count ) { |
|
138 | + foreach (array_filter($this->status_counts) as $status => $count) { |
|
139 | 139 | |
140 | - $views[ $status ] = sprintf( |
|
140 | + $views[$status] = sprintf( |
|
141 | 141 | '<a href="%s" %s>%s <span class="count">(%d)</span></a>', |
142 | - esc_url( add_query_arg( 'status', urlencode( $status ), $this->base_url ) ), |
|
142 | + esc_url(add_query_arg('status', urlencode($status), $this->base_url)), |
|
143 | 143 | $current === $status ? ' class="current"' : '', |
144 | - esc_html( getpaid_get_subscription_status_label( $status ) ), |
|
144 | + esc_html(getpaid_get_subscription_status_label($status)), |
|
145 | 145 | $count |
146 | 146 | ); |
147 | 147 | |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | * @since 1.0.0 |
159 | 159 | * @return string |
160 | 160 | */ |
161 | - public function column_default( $item, $column_name ) { |
|
162 | - return apply_filters( "getpaid_subscriptions_table_column_$column_name", $item->$column_name ); |
|
161 | + public function column_default($item, $column_name) { |
|
162 | + return apply_filters("getpaid_subscriptions_table_column_$column_name", $item->$column_name); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * @param WPInv_Subscription $item |
169 | 169 | * @return string |
170 | 170 | */ |
171 | - public function column_cb( $item ) { |
|
172 | - return sprintf( '<input type="checkbox" name="id[]" value="%s" />', esc_html( $item->get_id() ) ); |
|
171 | + public function column_cb($item) { |
|
172 | + return sprintf('<input type="checkbox" name="id[]" value="%s" />', esc_html($item->get_id())); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @since 1.0.0 |
180 | 180 | * @return string |
181 | 181 | */ |
182 | - public function column_status( $item ) { |
|
182 | + public function column_status($item) { |
|
183 | 183 | return $item->get_status_label_html(); |
184 | 184 | } |
185 | 185 | |
@@ -190,44 +190,44 @@ discard block |
||
190 | 190 | * @since 1.0.0 |
191 | 191 | * @return string |
192 | 192 | */ |
193 | - public function column_subscription( $item ) { |
|
193 | + public function column_subscription($item) { |
|
194 | 194 | |
195 | - $username = __( '(Missing User)', 'invoicing' ); |
|
195 | + $username = __('(Missing User)', 'invoicing'); |
|
196 | 196 | |
197 | - $user = get_userdata( $item->get_customer_id() ); |
|
198 | - if ( $user ) { |
|
197 | + $user = get_userdata($item->get_customer_id()); |
|
198 | + if ($user) { |
|
199 | 199 | |
200 | 200 | $username = sprintf( |
201 | 201 | '<a href="user-edit.php?user_id=%s">%s</a>', |
202 | - absint( $user->ID ), |
|
203 | - ! empty( $user->display_name ) ? esc_html( $user->display_name ) : sanitize_email( $user->user_email ) |
|
202 | + absint($user->ID), |
|
203 | + !empty($user->display_name) ? esc_html($user->display_name) : sanitize_email($user->user_email) |
|
204 | 204 | ); |
205 | 205 | |
206 | 206 | } |
207 | 207 | |
208 | 208 | // translators: $1: is opening link, $2: is subscription id number, $3: is closing link tag, $4: is user's name |
209 | 209 | $column_content = sprintf( |
210 | - _x( '%1$s#%2$s%3$s for %4$s', 'Subscription title on admin table. (e.g.: #211 for John Doe)', 'invoicing' ), |
|
211 | - '<a href="' . esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $item->get_id() ) ) ) . '">', |
|
212 | - '<strong>' . esc_attr( $item->get_id() ) . '</strong>', '</a>', |
|
210 | + _x('%1$s#%2$s%3$s for %4$s', 'Subscription title on admin table. (e.g.: #211 for John Doe)', 'invoicing'), |
|
211 | + '<a href="' . esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($item->get_id()))) . '">', |
|
212 | + '<strong>' . esc_attr($item->get_id()) . '</strong>', '</a>', |
|
213 | 213 | $username |
214 | 214 | ); |
215 | 215 | |
216 | 216 | $row_actions = array(); |
217 | 217 | |
218 | 218 | // View subscription. |
219 | - $view_url = esc_url( add_query_arg( 'id', $item->get_id(), admin_url( 'admin.php?page=wpinv-subscriptions' ) )); |
|
220 | - $row_actions['view'] = '<a href="' . $view_url . '">' . __( 'View Subscription', 'invoicing' ) . '</a>'; |
|
219 | + $view_url = esc_url(add_query_arg('id', $item->get_id(), admin_url('admin.php?page=wpinv-subscriptions'))); |
|
220 | + $row_actions['view'] = '<a href="' . $view_url . '">' . __('View Subscription', 'invoicing') . '</a>'; |
|
221 | 221 | |
222 | 222 | // View invoice. |
223 | - $invoice = get_post( $item->get_parent_invoice_id() ); |
|
223 | + $invoice = get_post($item->get_parent_invoice_id()); |
|
224 | 224 | |
225 | - if ( ! empty( $invoice ) ) { |
|
226 | - $invoice_url = get_edit_post_link( $invoice ); |
|
227 | - $row_actions['invoice'] = '<a href="' . $invoice_url . '">' . __( 'View Invoice', 'invoicing' ) . '</a>'; |
|
225 | + if (!empty($invoice)) { |
|
226 | + $invoice_url = get_edit_post_link($invoice); |
|
227 | + $row_actions['invoice'] = '<a href="' . $invoice_url . '">' . __('View Invoice', 'invoicing') . '</a>'; |
|
228 | 228 | } |
229 | 229 | |
230 | - $delete_url = esc_url( |
|
230 | + $delete_url = esc_url( |
|
231 | 231 | wp_nonce_url( |
232 | 232 | add_query_arg( |
233 | 233 | array( |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | 'getpaid-nonce' |
240 | 240 | ) |
241 | 241 | ); |
242 | - $row_actions['delete'] = '<a class="text-danger" href="' . $delete_url . '">' . __( 'Delete Subscription', 'invoicing' ) . '</a>'; |
|
242 | + $row_actions['delete'] = '<a class="text-danger" href="' . $delete_url . '">' . __('Delete Subscription', 'invoicing') . '</a>'; |
|
243 | 243 | |
244 | - $row_actions = $this->row_actions( apply_filters( 'getpaid_subscription_table_row_actions', $row_actions, $item ) ); |
|
244 | + $row_actions = $this->row_actions(apply_filters('getpaid_subscription_table_row_actions', $row_actions, $item)); |
|
245 | 245 | |
246 | - return "<strong>$column_content</strong>" . $this->column_amount( $item ) . $row_actions; |
|
246 | + return "<strong>$column_content</strong>" . $this->column_amount($item) . $row_actions; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | * @since 1.0.0 |
254 | 254 | * @return string |
255 | 255 | */ |
256 | - public function column_renewal_date( $item ) { |
|
257 | - return getpaid_format_date_value( $item->get_expiration() ); |
|
256 | + public function column_renewal_date($item) { |
|
257 | + return getpaid_format_date_value($item->get_expiration()); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | * @since 1.0.0 |
265 | 265 | * @return string |
266 | 266 | */ |
267 | - public function column_start_date( $item ) { |
|
268 | - return getpaid_format_date_value( $item->get_date_created() ); |
|
267 | + public function column_start_date($item) { |
|
268 | + return getpaid_format_date_value($item->get_date_created()); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | * @since 1.0.19 |
276 | 276 | * @return string |
277 | 277 | */ |
278 | - public static function column_amount( $item ) { |
|
279 | - $amount = getpaid_get_formatted_subscription_amount( $item ); |
|
278 | + public static function column_amount($item) { |
|
279 | + $amount = getpaid_get_formatted_subscription_amount($item); |
|
280 | 280 | return "<span class='text-muted form-text mt-2 mb-2'>$amount</span>"; |
281 | 281 | } |
282 | 282 | |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | * @since 1.0.0 |
288 | 288 | * @return string |
289 | 289 | */ |
290 | - public function column_renewals( $item ) { |
|
290 | + public function column_renewals($item) { |
|
291 | 291 | $max_bills = $item->get_bill_times(); |
292 | - return $item->get_times_billed() . ' / ' . ( empty( $max_bills ) ? "∞" : $max_bills ); |
|
292 | + return $item->get_times_billed() . ' / ' . (empty($max_bills) ? "∞" : $max_bills); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -299,15 +299,15 @@ discard block |
||
299 | 299 | * @since 1.0.0 |
300 | 300 | * @return string |
301 | 301 | */ |
302 | - public function column_item( $item ) { |
|
303 | - $subscription_group = getpaid_get_invoice_subscription_group( $item->get_parent_invoice_id(), $item->get_id() ); |
|
302 | + public function column_item($item) { |
|
303 | + $subscription_group = getpaid_get_invoice_subscription_group($item->get_parent_invoice_id(), $item->get_id()); |
|
304 | 304 | |
305 | - if ( empty( $subscription_group ) ) { |
|
306 | - return $this->generate_item_markup( $item->get_product_id() ); |
|
305 | + if (empty($subscription_group)) { |
|
306 | + return $this->generate_item_markup($item->get_product_id()); |
|
307 | 307 | } |
308 | 308 | |
309 | - $markup = array_map( array( $this, 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
310 | - return implode( ' | ', $markup ); |
|
309 | + $markup = array_map(array($this, 'generate_item_markup'), array_keys($subscription_group['items'])); |
|
310 | + return implode(' | ', $markup); |
|
311 | 311 | |
312 | 312 | } |
313 | 313 | |
@@ -318,16 +318,16 @@ discard block |
||
318 | 318 | * @since 1.0.0 |
319 | 319 | * @return string |
320 | 320 | */ |
321 | - public static function generate_item_markup( $item_id ) { |
|
322 | - $item = get_post( $item_id ); |
|
321 | + public static function generate_item_markup($item_id) { |
|
322 | + $item = get_post($item_id); |
|
323 | 323 | |
324 | - if ( ! empty( $item ) ) { |
|
325 | - $link = get_edit_post_link( $item ); |
|
326 | - $link = esc_url( $link ); |
|
327 | - $name = esc_html( get_the_title( $item ) ); |
|
324 | + if (!empty($item)) { |
|
325 | + $link = get_edit_post_link($item); |
|
326 | + $link = esc_url($link); |
|
327 | + $name = esc_html(get_the_title($item)); |
|
328 | 328 | return wpinv_current_user_can_manage_invoicing() ? "<a href='$link'>$name</a>" : $name; |
329 | 329 | } else { |
330 | - return sprintf( __( 'Item #%s', 'invoicing' ), $item_id ); |
|
330 | + return sprintf(__('Item #%s', 'invoicing'), $item_id); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @return int |
339 | 339 | */ |
340 | 340 | public function get_paged() { |
341 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
341 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | $hidden = array(); |
352 | 352 | $sortable = $this->get_sortable_columns(); |
353 | 353 | |
354 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
354 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
355 | 355 | |
356 | 356 | $this->set_pagination_args( |
357 | 357 | array( |
358 | 358 | 'total_items' => $this->current_total_count, |
359 | 359 | 'per_page' => $this->per_page, |
360 | - 'total_pages' => ceil( $this->current_total_count / $this->per_page ) |
|
360 | + 'total_pages' => ceil($this->current_total_count / $this->per_page) |
|
361 | 361 | ) |
362 | 362 | ); |
363 | 363 | } |
@@ -367,18 +367,18 @@ discard block |
||
367 | 367 | * |
368 | 368 | * @return array |
369 | 369 | */ |
370 | - public function get_columns(){ |
|
370 | + public function get_columns() { |
|
371 | 371 | $columns = array( |
372 | 372 | 'cb' => '<input type="checkbox" />', |
373 | - 'subscription' => __( 'Subscription', 'invoicing' ), |
|
374 | - 'start_date' => __( 'Start Date', 'invoicing' ), |
|
375 | - 'renewal_date' => __( 'Next Payment', 'invoicing' ), |
|
376 | - 'renewals' => __( 'Payments', 'invoicing' ), |
|
377 | - 'item' => __( 'Items', 'invoicing' ), |
|
378 | - 'status' => __( 'Status', 'invoicing' ), |
|
373 | + 'subscription' => __('Subscription', 'invoicing'), |
|
374 | + 'start_date' => __('Start Date', 'invoicing'), |
|
375 | + 'renewal_date' => __('Next Payment', 'invoicing'), |
|
376 | + 'renewals' => __('Payments', 'invoicing'), |
|
377 | + 'item' => __('Items', 'invoicing'), |
|
378 | + 'status' => __('Status', 'invoicing'), |
|
379 | 379 | ); |
380 | 380 | |
381 | - return apply_filters( 'manage_getpaid_subscriptions_table_columns', $columns ); |
|
381 | + return apply_filters('manage_getpaid_subscriptions_table_columns', $columns); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | /** |
@@ -388,15 +388,15 @@ discard block |
||
388 | 388 | */ |
389 | 389 | public function get_sortable_columns() { |
390 | 390 | $sortable = array( |
391 | - 'subscription' => array( 'id', true ), |
|
392 | - 'start_date' => array( 'created', true ), |
|
393 | - 'renewal_date' => array( 'expiration', true ), |
|
394 | - 'renewals' => array( 'bill_times', true ), |
|
395 | - 'item' => array( 'product_id', true ), |
|
396 | - 'status' => array( 'status', true ), |
|
391 | + 'subscription' => array('id', true), |
|
392 | + 'start_date' => array('created', true), |
|
393 | + 'renewal_date' => array('expiration', true), |
|
394 | + 'renewals' => array('bill_times', true), |
|
395 | + 'item' => array('product_id', true), |
|
396 | + 'status' => array('status', true), |
|
397 | 397 | ); |
398 | 398 | |
399 | - return apply_filters( 'manage_getpaid_subscriptions_sortable_table_columns', $sortable ); |
|
399 | + return apply_filters('manage_getpaid_subscriptions_sortable_table_columns', $sortable); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @return bool |
406 | 406 | */ |
407 | 407 | public function has_items() { |
408 | - return ! empty( $this->current_total_count ); |
|
408 | + return !empty($this->current_total_count); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Post types Admin Class |
@@ -21,74 +21,74 @@ discard block |
||
21 | 21 | GetPaid_Metaboxes::init(); |
22 | 22 | |
23 | 23 | // Filter the post updated messages. |
24 | - add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' ); |
|
24 | + add_filter('post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages'); |
|
25 | 25 | |
26 | 26 | // Filter post actions. |
27 | - add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2 ); |
|
28 | - add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2 ); |
|
27 | + add_filter('post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2); |
|
28 | + add_filter('post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2); |
|
29 | 29 | |
30 | 30 | // Invoice table columns. |
31 | - add_filter( 'manage_wpi_invoice_posts_columns', array( __CLASS__, 'invoice_columns' ), 100 ); |
|
32 | - add_action( 'manage_wpi_invoice_posts_custom_column', array( __CLASS__, 'display_invoice_columns' ), 10, 2 ); |
|
33 | - add_filter( 'bulk_actions-edit-wpi_invoice', array( __CLASS__, 'invoice_bulk_actions' ) ); |
|
34 | - add_filter( 'handle_bulk_actions-edit-wpi_invoice', array( __CLASS__, 'handle_invoice_bulk_actions' ), 10, 3 ); |
|
31 | + add_filter('manage_wpi_invoice_posts_columns', array(__CLASS__, 'invoice_columns'), 100); |
|
32 | + add_action('manage_wpi_invoice_posts_custom_column', array(__CLASS__, 'display_invoice_columns'), 10, 2); |
|
33 | + add_filter('bulk_actions-edit-wpi_invoice', array(__CLASS__, 'invoice_bulk_actions')); |
|
34 | + add_filter('handle_bulk_actions-edit-wpi_invoice', array(__CLASS__, 'handle_invoice_bulk_actions'), 10, 3); |
|
35 | 35 | |
36 | 36 | // Items table columns. |
37 | - add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 ); |
|
38 | - add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 ); |
|
39 | - add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 ); |
|
40 | - add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 ); |
|
41 | - add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 ); |
|
42 | - add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 ); |
|
37 | + add_filter('manage_wpi_item_posts_columns', array(__CLASS__, 'item_columns'), 100); |
|
38 | + add_filter('manage_edit-wpi_item_sortable_columns', array(__CLASS__, 'sortable_item_columns'), 20); |
|
39 | + add_action('manage_wpi_item_posts_custom_column', array(__CLASS__, 'display_item_columns'), 10, 2); |
|
40 | + add_action('restrict_manage_posts', array(__CLASS__, 'add_item_filters'), 100); |
|
41 | + add_action('parse_query', array(__CLASS__, 'filter_item_query'), 100); |
|
42 | + add_action('request', array(__CLASS__, 'reorder_items'), 100); |
|
43 | 43 | |
44 | 44 | // Payment forms columns. |
45 | - add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 ); |
|
46 | - add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 ); |
|
47 | - add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 ); |
|
45 | + add_filter('manage_wpi_payment_form_posts_columns', array(__CLASS__, 'payment_form_columns'), 100); |
|
46 | + add_action('manage_wpi_payment_form_posts_custom_column', array(__CLASS__, 'display_payment_form_columns'), 10, 2); |
|
47 | + add_filter('display_post_states', array(__CLASS__, 'filter_payment_form_state'), 10, 2); |
|
48 | 48 | |
49 | 49 | // Discount table columns. |
50 | - add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 ); |
|
51 | - add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 ); |
|
50 | + add_filter('manage_wpi_discount_posts_columns', array(__CLASS__, 'discount_columns'), 100); |
|
51 | + add_filter('bulk_actions-edit-wpi_discount', '__return_empty_array', 100); |
|
52 | 52 | |
53 | 53 | // Deleting posts. |
54 | - add_action( 'delete_post', array( __CLASS__, 'delete_post' ) ); |
|
55 | - add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 ); |
|
54 | + add_action('delete_post', array(__CLASS__, 'delete_post')); |
|
55 | + add_filter('display_post_states', array(__CLASS__, 'filter_discount_state'), 10, 2); |
|
56 | 56 | |
57 | - add_filter( 'display_post_states', array( __CLASS__, 'add_display_post_states' ), 10, 2 ); |
|
57 | + add_filter('display_post_states', array(__CLASS__, 'add_display_post_states'), 10, 2); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Post updated messages. |
62 | 62 | */ |
63 | - public static function post_updated_messages( $messages ) { |
|
63 | + public static function post_updated_messages($messages) { |
|
64 | 64 | global $post; |
65 | 65 | |
66 | 66 | $messages['wpi_discount'] = array( |
67 | 67 | 0 => '', |
68 | - 1 => __( 'Discount updated.', 'invoicing' ), |
|
69 | - 2 => __( 'Custom field updated.', 'invoicing' ), |
|
70 | - 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
71 | - 4 => __( 'Discount updated.', 'invoicing' ), |
|
72 | - 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
73 | - 6 => __( 'Discount updated.', 'invoicing' ), |
|
74 | - 7 => __( 'Discount saved.', 'invoicing' ), |
|
75 | - 8 => __( 'Discount submitted.', 'invoicing' ), |
|
76 | - 9 => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
77 | - 10 => __( 'Discount draft updated.', 'invoicing' ), |
|
68 | + 1 => __('Discount updated.', 'invoicing'), |
|
69 | + 2 => __('Custom field updated.', 'invoicing'), |
|
70 | + 3 => __('Custom field deleted.', 'invoicing'), |
|
71 | + 4 => __('Discount updated.', 'invoicing'), |
|
72 | + 5 => isset($_GET['revision']) ? wp_sprintf(__('Discount restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
73 | + 6 => __('Discount updated.', 'invoicing'), |
|
74 | + 7 => __('Discount saved.', 'invoicing'), |
|
75 | + 8 => __('Discount submitted.', 'invoicing'), |
|
76 | + 9 => wp_sprintf(__('Discount scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))), |
|
77 | + 10 => __('Discount draft updated.', 'invoicing'), |
|
78 | 78 | ); |
79 | 79 | |
80 | 80 | $messages['wpi_payment_form'] = array( |
81 | 81 | 0 => '', |
82 | - 1 => __( 'Payment Form updated.', 'invoicing' ), |
|
83 | - 2 => __( 'Custom field updated.', 'invoicing' ), |
|
84 | - 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
85 | - 4 => __( 'Payment Form updated.', 'invoicing' ), |
|
86 | - 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
87 | - 6 => __( 'Payment Form updated.', 'invoicing' ), |
|
88 | - 7 => __( 'Payment Form saved.', 'invoicing' ), |
|
89 | - 8 => __( 'Payment Form submitted.', 'invoicing' ), |
|
90 | - 9 => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
91 | - 10 => __( 'Payment Form draft updated.', 'invoicing' ), |
|
82 | + 1 => __('Payment Form updated.', 'invoicing'), |
|
83 | + 2 => __('Custom field updated.', 'invoicing'), |
|
84 | + 3 => __('Custom field deleted.', 'invoicing'), |
|
85 | + 4 => __('Payment Form updated.', 'invoicing'), |
|
86 | + 5 => isset($_GET['revision']) ? wp_sprintf(__('Payment Form restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
87 | + 6 => __('Payment Form updated.', 'invoicing'), |
|
88 | + 7 => __('Payment Form saved.', 'invoicing'), |
|
89 | + 8 => __('Payment Form submitted.', 'invoicing'), |
|
90 | + 9 => wp_sprintf(__('Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))), |
|
91 | + 10 => __('Payment Form draft updated.', 'invoicing'), |
|
92 | 92 | ); |
93 | 93 | |
94 | 94 | return $messages; |
@@ -98,19 +98,19 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * Post row actions. |
100 | 100 | */ |
101 | - public static function post_row_actions( $actions, $post ) { |
|
101 | + public static function post_row_actions($actions, $post) { |
|
102 | 102 | |
103 | - $post = get_post( $post ); |
|
103 | + $post = get_post($post); |
|
104 | 104 | |
105 | 105 | // We do not want to edit the default payment form. |
106 | - if ( 'wpi_payment_form' == $post->post_type ) { |
|
106 | + if ('wpi_payment_form' == $post->post_type) { |
|
107 | 107 | |
108 | - if ( $post->ID == wpinv_get_default_payment_form() ) { |
|
109 | - unset( $actions['trash'] ); |
|
110 | - unset( $actions['inline hide-if-no-js'] ); |
|
108 | + if ($post->ID == wpinv_get_default_payment_form()) { |
|
109 | + unset($actions['trash']); |
|
110 | + unset($actions['inline hide-if-no-js']); |
|
111 | 111 | } |
112 | 112 | |
113 | - $actions['duplicate'] = sprintf( |
|
113 | + $actions['duplicate'] = sprintf( |
|
114 | 114 | '<a href="%1$s">%2$s</a>', |
115 | 115 | esc_url( |
116 | 116 | wp_nonce_url( |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | 'getpaid-nonce' |
125 | 125 | ) |
126 | 126 | ), |
127 | - esc_html( __( 'Duplicate', 'invoicing' ) ) |
|
127 | + esc_html(__('Duplicate', 'invoicing')) |
|
128 | 128 | ); |
129 | 129 | |
130 | 130 | } |
@@ -140,31 +140,31 @@ discard block |
||
140 | 140 | * @param WP_Post $post |
141 | 141 | * @return array $actions actions without edit option |
142 | 142 | */ |
143 | - public static function filter_invoice_row_actions( $actions, $post ) { |
|
143 | + public static function filter_invoice_row_actions($actions, $post) { |
|
144 | 144 | |
145 | - if ( getpaid_is_invoice_post_type( $post->post_type ) ) { |
|
145 | + if (getpaid_is_invoice_post_type($post->post_type)) { |
|
146 | 146 | |
147 | 147 | $actions = array(); |
148 | - $invoice = new WPInv_Invoice( $post ); |
|
148 | + $invoice = new WPInv_Invoice($post); |
|
149 | 149 | |
150 | - $actions['edit'] = sprintf( |
|
150 | + $actions['edit'] = sprintf( |
|
151 | 151 | '<a href="%1$s">%2$s</a>', |
152 | - esc_url( get_edit_post_link( $invoice->get_id() ) ), |
|
153 | - esc_html( __( 'Edit', 'invoicing' ) ) |
|
152 | + esc_url(get_edit_post_link($invoice->get_id())), |
|
153 | + esc_html(__('Edit', 'invoicing')) |
|
154 | 154 | ); |
155 | 155 | |
156 | - if ( ! $invoice->is_draft() ) { |
|
156 | + if (!$invoice->is_draft()) { |
|
157 | 157 | |
158 | - $actions['view'] = sprintf( |
|
158 | + $actions['view'] = sprintf( |
|
159 | 159 | '<a href="%1$s">%2$s</a>', |
160 | - esc_url( $invoice->get_view_url() ), |
|
160 | + esc_url($invoice->get_view_url()), |
|
161 | 161 | sprintf( |
162 | - esc_html( __( 'View %s', 'invoicing' ) ), |
|
163 | - getpaid_get_post_type_label( $invoice->get_post_type(), false ) |
|
162 | + esc_html(__('View %s', 'invoicing')), |
|
163 | + getpaid_get_post_type_label($invoice->get_post_type(), false) |
|
164 | 164 | ) |
165 | 165 | ); |
166 | 166 | |
167 | - $actions['send'] = sprintf( |
|
167 | + $actions['send'] = sprintf( |
|
168 | 168 | '<a href="%1$s">%2$s</a>', |
169 | 169 | esc_url( |
170 | 170 | wp_nonce_url( |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | 'getpaid-nonce' |
179 | 179 | ) |
180 | 180 | ), |
181 | - esc_html( __( 'Send to Customer', 'invoicing' ) ) |
|
181 | + esc_html(__('Send to Customer', 'invoicing')) |
|
182 | 182 | ); |
183 | 183 | |
184 | 184 | } |
@@ -191,42 +191,42 @@ discard block |
||
191 | 191 | /** |
192 | 192 | * Returns an array of invoice table columns. |
193 | 193 | */ |
194 | - public static function invoice_columns( $columns ) { |
|
194 | + public static function invoice_columns($columns) { |
|
195 | 195 | |
196 | 196 | $columns = array( |
197 | 197 | 'cb' => $columns['cb'], |
198 | - 'number' => __( 'Invoice', 'invoicing' ), |
|
199 | - 'customer' => __( 'Customer', 'invoicing' ), |
|
200 | - 'invoice_date' => __( 'Created', 'invoicing' ), |
|
201 | - 'payment_date' => __( 'Completed', 'invoicing' ), |
|
202 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
203 | - 'recurring' => __( 'Recurring', 'invoicing' ), |
|
204 | - 'status' => __( 'Status', 'invoicing' ), |
|
198 | + 'number' => __('Invoice', 'invoicing'), |
|
199 | + 'customer' => __('Customer', 'invoicing'), |
|
200 | + 'invoice_date' => __('Created', 'invoicing'), |
|
201 | + 'payment_date' => __('Completed', 'invoicing'), |
|
202 | + 'amount' => __('Amount', 'invoicing'), |
|
203 | + 'recurring' => __('Recurring', 'invoicing'), |
|
204 | + 'status' => __('Status', 'invoicing'), |
|
205 | 205 | ); |
206 | 206 | |
207 | - return apply_filters( 'wpi_invoice_table_columns', $columns ); |
|
207 | + return apply_filters('wpi_invoice_table_columns', $columns); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
211 | 211 | * Displays invoice table columns. |
212 | 212 | */ |
213 | - public static function display_invoice_columns( $column_name, $post_id ) { |
|
213 | + public static function display_invoice_columns($column_name, $post_id) { |
|
214 | 214 | |
215 | - $invoice = new WPInv_Invoice( $post_id ); |
|
215 | + $invoice = new WPInv_Invoice($post_id); |
|
216 | 216 | |
217 | - switch ( $column_name ) { |
|
217 | + switch ($column_name) { |
|
218 | 218 | |
219 | 219 | case 'invoice_date' : |
220 | - $date_time = esc_attr( $invoice->get_created_date() ); |
|
221 | - $date = getpaid_format_date_value( $date_time, "—", true ); |
|
220 | + $date_time = esc_attr($invoice->get_created_date()); |
|
221 | + $date = getpaid_format_date_value($date_time, "—", true); |
|
222 | 222 | echo "<span title='$date_time'>$date</span>"; |
223 | 223 | break; |
224 | 224 | |
225 | 225 | case 'payment_date' : |
226 | 226 | |
227 | - if ( $invoice->is_paid() ) { |
|
228 | - $date_time = esc_attr( $invoice->get_completed_date() ); |
|
229 | - $date = getpaid_format_date_value( $date_time, "—", true ); |
|
227 | + if ($invoice->is_paid()) { |
|
228 | + $date_time = esc_attr($invoice->get_completed_date()); |
|
229 | + $date = getpaid_format_date_value($date_time, "—", true); |
|
230 | 230 | echo "<span title='$date_time'>$date</span>"; |
231 | 231 | } else { |
232 | 232 | echo "—"; |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | case 'amount' : |
238 | 238 | |
239 | 239 | $amount = $invoice->get_total(); |
240 | - $formated_amount = wpinv_price( $amount, $invoice->get_currency() ); |
|
240 | + $formated_amount = wpinv_price($amount, $invoice->get_currency()); |
|
241 | 241 | |
242 | - if ( $invoice->is_refunded() ) { |
|
243 | - $refunded_amount = wpinv_price( 0, $invoice->get_currency() ); |
|
242 | + if ($invoice->is_refunded()) { |
|
243 | + $refunded_amount = wpinv_price(0, $invoice->get_currency()); |
|
244 | 244 | echo "<del>$formated_amount</del> <ins>$refunded_amount</ins>"; |
245 | 245 | } else { |
246 | 246 | |
247 | 247 | $discount = $invoice->get_total_discount(); |
248 | 248 | |
249 | - if ( ! empty( $discount ) ) { |
|
250 | - $new_amount = wpinv_price( $amount + $discount, $invoice->get_currency() ); |
|
249 | + if (!empty($discount)) { |
|
250 | + $new_amount = wpinv_price($amount + $discount, $invoice->get_currency()); |
|
251 | 251 | echo "<del>$new_amount</del> <ins>$formated_amount</ins>"; |
252 | 252 | } else { |
253 | 253 | echo $formated_amount; |
@@ -258,13 +258,13 @@ discard block |
||
258 | 258 | break; |
259 | 259 | |
260 | 260 | case 'status' : |
261 | - $status = esc_html( $invoice->get_status() ); |
|
262 | - $status_label = esc_html( $invoice->get_status_nicename() ); |
|
261 | + $status = esc_html($invoice->get_status()); |
|
262 | + $status_label = esc_html($invoice->get_status_nicename()); |
|
263 | 263 | |
264 | 264 | // If it is paid, show the gateway title. |
265 | - if ( $invoice->is_paid() ) { |
|
266 | - $gateway = esc_html( $invoice->get_gateway_title() ); |
|
267 | - $gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), $gateway ); |
|
265 | + if ($invoice->is_paid()) { |
|
266 | + $gateway = esc_html($invoice->get_gateway_title()); |
|
267 | + $gateway = wp_sprintf(esc_attr__('Paid via %s', 'invoicing'), $gateway); |
|
268 | 268 | |
269 | 269 | echo "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>"; |
270 | 270 | } else { |
@@ -272,22 +272,22 @@ discard block |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | // If it is not paid, display the overdue and view status. |
275 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
275 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
276 | 276 | |
277 | 277 | // Invoice view status. |
278 | - if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) { |
|
279 | - echo ' <i class="fa fa-eye wpi-help-tip" title="'. esc_attr__( 'Viewed by Customer', 'invoicing' ).'"></i>'; |
|
278 | + if (wpinv_is_invoice_viewed($invoice->get_id())) { |
|
279 | + echo ' <i class="fa fa-eye wpi-help-tip" title="' . esc_attr__('Viewed by Customer', 'invoicing') . '"></i>'; |
|
280 | 280 | } else { |
281 | - echo ' <i class="fa fa-eye-slash wpi-help-tip" title="'. esc_attr__( 'Not Viewed by Customer', 'invoicing' ).'"></i>'; |
|
281 | + echo ' <i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__('Not Viewed by Customer', 'invoicing') . '"></i>'; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // Display the overview status. |
285 | - if ( wpinv_get_option( 'overdue_active' ) ) { |
|
285 | + if (wpinv_get_option('overdue_active')) { |
|
286 | 286 | $due_date = $invoice->get_due_date(); |
287 | - $fomatted = getpaid_format_date( $due_date ); |
|
287 | + $fomatted = getpaid_format_date($due_date); |
|
288 | 288 | |
289 | - if ( ! empty( $fomatted ) ) { |
|
290 | - $date = wp_sprintf( __( 'Due %s', 'invoicing' ), $fomatted ); |
|
289 | + if (!empty($fomatted)) { |
|
290 | + $date = wp_sprintf(__('Due %s', 'invoicing'), $fomatted); |
|
291 | 291 | echo "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>"; |
292 | 292 | } |
293 | 293 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | |
299 | 299 | case 'recurring': |
300 | 300 | |
301 | - if ( $invoice->is_recurring() ) { |
|
301 | + if ($invoice->is_recurring()) { |
|
302 | 302 | echo '<i class="fa fa-check" style="color:#43850a;"></i>'; |
303 | 303 | } else { |
304 | 304 | echo '<i class="fa fa-times" style="color:#616161;"></i>'; |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | |
308 | 308 | case 'number' : |
309 | 309 | |
310 | - $edit_link = esc_url( get_edit_post_link( $invoice->get_id() ) ); |
|
311 | - $invoice_number = esc_html( $invoice->get_number() ); |
|
312 | - $invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' ); |
|
310 | + $edit_link = esc_url(get_edit_post_link($invoice->get_id())); |
|
311 | + $invoice_number = esc_html($invoice->get_number()); |
|
312 | + $invoice_details = esc_attr__('View Invoice Details', 'invoicing'); |
|
313 | 313 | |
314 | 314 | echo "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>"; |
315 | 315 | |
@@ -319,13 +319,13 @@ discard block |
||
319 | 319 | |
320 | 320 | $customer_name = $invoice->get_user_full_name(); |
321 | 321 | |
322 | - if ( empty( $customer_name ) ) { |
|
322 | + if (empty($customer_name)) { |
|
323 | 323 | $customer_name = $invoice->get_email(); |
324 | 324 | } |
325 | 325 | |
326 | - if ( ! empty( $customer_name ) ) { |
|
327 | - $customer_details = esc_attr__( 'View Customer Details', 'invoicing' ); |
|
328 | - $view_link = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) ); |
|
326 | + if (!empty($customer_name)) { |
|
327 | + $customer_details = esc_attr__('View Customer Details', 'invoicing'); |
|
328 | + $view_link = esc_url(add_query_arg('user_id', $invoice->get_user_id(), admin_url('user-edit.php'))); |
|
329 | 329 | echo "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>"; |
330 | 330 | } else { |
331 | 331 | echo '<div>—</div>'; |
@@ -340,27 +340,27 @@ discard block |
||
340 | 340 | /** |
341 | 341 | * Displays invoice bulk actions. |
342 | 342 | */ |
343 | - public static function invoice_bulk_actions( $actions ) { |
|
344 | - $actions['resend-invoice'] = __( 'Send to Customer', 'invoicing' ); |
|
343 | + public static function invoice_bulk_actions($actions) { |
|
344 | + $actions['resend-invoice'] = __('Send to Customer', 'invoicing'); |
|
345 | 345 | return $actions; |
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
349 | 349 | * Processes invoice bulk actions. |
350 | 350 | */ |
351 | - public static function handle_invoice_bulk_actions( $redirect_url, $action, $post_ids ) { |
|
351 | + public static function handle_invoice_bulk_actions($redirect_url, $action, $post_ids) { |
|
352 | 352 | |
353 | - if ( $action == 'resend-invoice' ) { |
|
353 | + if ($action == 'resend-invoice') { |
|
354 | 354 | |
355 | 355 | $success = false; |
356 | - foreach ( $post_ids as $post_id ) { |
|
357 | - $success = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $post_id ), true ); |
|
356 | + foreach ($post_ids as $post_id) { |
|
357 | + $success = getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($post_id), true); |
|
358 | 358 | } |
359 | 359 | |
360 | - if ( $success ) { |
|
361 | - getpaid_admin()->show_success( __( 'Invoices were successfully sent', 'invoicing' ) ); |
|
360 | + if ($success) { |
|
361 | + getpaid_admin()->show_success(__('Invoices were successfully sent', 'invoicing')); |
|
362 | 362 | } else { |
363 | - getpaid_admin()->show_error( __( 'Could not send some invoices', 'invoicing' ) ); |
|
363 | + getpaid_admin()->show_error(__('Could not send some invoices', 'invoicing')); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | } |
@@ -372,50 +372,50 @@ discard block |
||
372 | 372 | /** |
373 | 373 | * Returns an array of payment forms table columns. |
374 | 374 | */ |
375 | - public static function payment_form_columns( $columns ) { |
|
375 | + public static function payment_form_columns($columns) { |
|
376 | 376 | |
377 | 377 | $columns = array( |
378 | 378 | 'cb' => $columns['cb'], |
379 | - 'title' => __( 'Name', 'invoicing' ), |
|
380 | - 'shortcode' => __( 'Shortcode', 'invoicing' ), |
|
381 | - 'earnings' => __( 'Revenue', 'invoicing' ), |
|
382 | - 'refunds' => __( 'Refunded', 'invoicing' ), |
|
383 | - 'items' => __( 'Items', 'invoicing' ), |
|
384 | - 'date' => __( 'Date', 'invoicing' ), |
|
379 | + 'title' => __('Name', 'invoicing'), |
|
380 | + 'shortcode' => __('Shortcode', 'invoicing'), |
|
381 | + 'earnings' => __('Revenue', 'invoicing'), |
|
382 | + 'refunds' => __('Refunded', 'invoicing'), |
|
383 | + 'items' => __('Items', 'invoicing'), |
|
384 | + 'date' => __('Date', 'invoicing'), |
|
385 | 385 | ); |
386 | 386 | |
387 | - return apply_filters( 'wpi_payment_form_table_columns', $columns ); |
|
387 | + return apply_filters('wpi_payment_form_table_columns', $columns); |
|
388 | 388 | |
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
392 | 392 | * Displays payment form table columns. |
393 | 393 | */ |
394 | - public static function display_payment_form_columns( $column_name, $post_id ) { |
|
394 | + public static function display_payment_form_columns($column_name, $post_id) { |
|
395 | 395 | |
396 | 396 | // Retrieve the payment form. |
397 | - $form = new GetPaid_Payment_Form( $post_id ); |
|
397 | + $form = new GetPaid_Payment_Form($post_id); |
|
398 | 398 | |
399 | - switch ( $column_name ) { |
|
399 | + switch ($column_name) { |
|
400 | 400 | |
401 | 401 | case 'earnings' : |
402 | - echo wpinv_price( $form->get_earned() ); |
|
402 | + echo wpinv_price($form->get_earned()); |
|
403 | 403 | break; |
404 | 404 | |
405 | 405 | case 'refunds' : |
406 | - echo wpinv_price( $form->get_refunded() ); |
|
406 | + echo wpinv_price($form->get_refunded()); |
|
407 | 407 | break; |
408 | 408 | |
409 | 409 | case 'refunds' : |
410 | - echo wpinv_price( $form->get_refunded() ); |
|
410 | + echo wpinv_price($form->get_refunded()); |
|
411 | 411 | break; |
412 | 412 | |
413 | 413 | case 'shortcode' : |
414 | 414 | |
415 | - if ( $form->is_default() ) { |
|
415 | + if ($form->is_default()) { |
|
416 | 416 | echo '—'; |
417 | 417 | } else { |
418 | - echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>'; |
|
418 | + echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr($form->get_id()) . ']" style="width: 100%;" readonly/>'; |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | break; |
@@ -424,29 +424,29 @@ discard block |
||
424 | 424 | |
425 | 425 | $items = $form->get_items(); |
426 | 426 | |
427 | - if ( $form->is_default() || empty( $items ) ) { |
|
427 | + if ($form->is_default() || empty($items)) { |
|
428 | 428 | echo '—'; |
429 | 429 | return; |
430 | 430 | } |
431 | 431 | |
432 | 432 | $_items = array(); |
433 | 433 | |
434 | - foreach ( $items as $item ) { |
|
434 | + foreach ($items as $item) { |
|
435 | 435 | $url = $item->get_edit_url(); |
436 | 436 | |
437 | - if ( empty( $url ) ) { |
|
438 | - $_items[] = esc_html( $item->get_name() ); |
|
437 | + if (empty($url)) { |
|
438 | + $_items[] = esc_html($item->get_name()); |
|
439 | 439 | } else { |
440 | 440 | $_items[] = sprintf( |
441 | 441 | '<a href="%s">%s</a>', |
442 | - esc_url( $url ), |
|
443 | - esc_html( $item->get_name() ) |
|
442 | + esc_url($url), |
|
443 | + esc_html($item->get_name()) |
|
444 | 444 | ); |
445 | 445 | } |
446 | 446 | |
447 | 447 | } |
448 | 448 | |
449 | - echo implode( '<br>', $_items ); |
|
449 | + echo implode('<br>', $_items); |
|
450 | 450 | |
451 | 451 | break; |
452 | 452 | |
@@ -457,10 +457,10 @@ discard block |
||
457 | 457 | /** |
458 | 458 | * Filters post states. |
459 | 459 | */ |
460 | - public static function filter_payment_form_state( $post_states, $post ) { |
|
460 | + public static function filter_payment_form_state($post_states, $post) { |
|
461 | 461 | |
462 | - if ( 'wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID ) { |
|
463 | - $post_states[ 'default_form' ] = __( 'Default Payment Form', 'invoicing' ); |
|
462 | + if ('wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID) { |
|
463 | + $post_states['default_form'] = __('Default Payment Form', 'invoicing'); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | return $post_states; |
@@ -470,35 +470,35 @@ discard block |
||
470 | 470 | /** |
471 | 471 | * Returns an array of coupon table columns. |
472 | 472 | */ |
473 | - public static function discount_columns( $columns ) { |
|
473 | + public static function discount_columns($columns) { |
|
474 | 474 | |
475 | 475 | $columns = array( |
476 | 476 | 'cb' => $columns['cb'], |
477 | - 'title' => __( 'Name', 'invoicing' ), |
|
478 | - 'code' => __( 'Code', 'invoicing' ), |
|
479 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
480 | - 'usage' => __( 'Usage / Limit', 'invoicing' ), |
|
481 | - 'start_date' => __( 'Start Date', 'invoicing' ), |
|
482 | - 'expiry_date' => __( 'Expiry Date', 'invoicing' ), |
|
477 | + 'title' => __('Name', 'invoicing'), |
|
478 | + 'code' => __('Code', 'invoicing'), |
|
479 | + 'amount' => __('Amount', 'invoicing'), |
|
480 | + 'usage' => __('Usage / Limit', 'invoicing'), |
|
481 | + 'start_date' => __('Start Date', 'invoicing'), |
|
482 | + 'expiry_date' => __('Expiry Date', 'invoicing'), |
|
483 | 483 | ); |
484 | 484 | |
485 | - return apply_filters( 'wpi_discount_table_columns', $columns ); |
|
485 | + return apply_filters('wpi_discount_table_columns', $columns); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | /** |
489 | 489 | * Filters post states. |
490 | 490 | */ |
491 | - public static function filter_discount_state( $post_states, $post ) { |
|
491 | + public static function filter_discount_state($post_states, $post) { |
|
492 | 492 | |
493 | - if ( 'wpi_discount' == $post->post_type ) { |
|
493 | + if ('wpi_discount' == $post->post_type) { |
|
494 | 494 | |
495 | - $discount = new WPInv_Discount( $post ); |
|
495 | + $discount = new WPInv_Discount($post); |
|
496 | 496 | |
497 | 497 | $status = $discount->is_expired() ? 'expired' : $discount->get_status(); |
498 | 498 | |
499 | - if ( $status != 'publish' ) { |
|
499 | + if ($status != 'publish') { |
|
500 | 500 | return array( |
501 | - 'discount_status' => wpinv_discount_status( $status ), |
|
501 | + 'discount_status' => wpinv_discount_status($status), |
|
502 | 502 | ); |
503 | 503 | } |
504 | 504 | |
@@ -513,30 +513,30 @@ discard block |
||
513 | 513 | /** |
514 | 514 | * Returns an array of items table columns. |
515 | 515 | */ |
516 | - public static function item_columns( $columns ) { |
|
516 | + public static function item_columns($columns) { |
|
517 | 517 | |
518 | 518 | $columns = array( |
519 | 519 | 'cb' => $columns['cb'], |
520 | - 'title' => __( 'Name', 'invoicing' ), |
|
521 | - 'price' => __( 'Price', 'invoicing' ), |
|
522 | - 'vat_rule' => __( 'VAT rule', 'invoicing' ), |
|
523 | - 'vat_class' => __( 'VAT class', 'invoicing' ), |
|
524 | - 'type' => __( 'Type', 'invoicing' ), |
|
525 | - 'shortcode' => __( 'Shortcode', 'invoicing' ), |
|
520 | + 'title' => __('Name', 'invoicing'), |
|
521 | + 'price' => __('Price', 'invoicing'), |
|
522 | + 'vat_rule' => __('VAT rule', 'invoicing'), |
|
523 | + 'vat_class' => __('VAT class', 'invoicing'), |
|
524 | + 'type' => __('Type', 'invoicing'), |
|
525 | + 'shortcode' => __('Shortcode', 'invoicing'), |
|
526 | 526 | ); |
527 | 527 | |
528 | - if ( ! wpinv_use_taxes() ) { |
|
529 | - unset( $columns['vat_rule'] ); |
|
530 | - unset( $columns['vat_class'] ); |
|
528 | + if (!wpinv_use_taxes()) { |
|
529 | + unset($columns['vat_rule']); |
|
530 | + unset($columns['vat_class']); |
|
531 | 531 | } |
532 | 532 | |
533 | - return apply_filters( 'wpi_item_table_columns', $columns ); |
|
533 | + return apply_filters('wpi_item_table_columns', $columns); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | /** |
537 | 537 | * Returns an array of sortable items table columns. |
538 | 538 | */ |
539 | - public static function sortable_item_columns( $columns ) { |
|
539 | + public static function sortable_item_columns($columns) { |
|
540 | 540 | |
541 | 541 | return array_merge( |
542 | 542 | $columns, |
@@ -553,49 +553,49 @@ discard block |
||
553 | 553 | /** |
554 | 554 | * Displays items table columns. |
555 | 555 | */ |
556 | - public static function display_item_columns( $column_name, $post_id ) { |
|
556 | + public static function display_item_columns($column_name, $post_id) { |
|
557 | 557 | |
558 | - $item = new WPInv_Item( $post_id ); |
|
558 | + $item = new WPInv_Item($post_id); |
|
559 | 559 | |
560 | - switch ( $column_name ) { |
|
560 | + switch ($column_name) { |
|
561 | 561 | |
562 | 562 | case 'price' : |
563 | 563 | |
564 | - if ( ! $item->is_recurring() ) { |
|
564 | + if (!$item->is_recurring()) { |
|
565 | 565 | echo $item->get_the_price(); |
566 | 566 | break; |
567 | 567 | } |
568 | 568 | |
569 | 569 | $price = wp_sprintf( |
570 | - __( '%s / %s', 'invoicing' ), |
|
570 | + __('%s / %s', 'invoicing'), |
|
571 | 571 | $item->get_the_price(), |
572 | - getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' ) |
|
572 | + getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '') |
|
573 | 573 | ); |
574 | 574 | |
575 | - if ( $item->get_the_price() == $item->get_the_initial_price() ) { |
|
575 | + if ($item->get_the_price() == $item->get_the_initial_price()) { |
|
576 | 576 | echo $price; |
577 | 577 | break; |
578 | 578 | } |
579 | 579 | |
580 | 580 | echo $item->get_the_initial_price(); |
581 | 581 | |
582 | - echo '<span class="meta">' . wp_sprintf( __( 'then %s', 'invoicing' ), $price ) .'</span>'; |
|
582 | + echo '<span class="meta">' . wp_sprintf(__('then %s', 'invoicing'), $price) . '</span>'; |
|
583 | 583 | break; |
584 | 584 | |
585 | 585 | case 'vat_rule' : |
586 | - echo getpaid_get_tax_rule_label( $item->get_vat_rule() ); |
|
586 | + echo getpaid_get_tax_rule_label($item->get_vat_rule()); |
|
587 | 587 | break; |
588 | 588 | |
589 | 589 | case 'vat_class' : |
590 | - echo getpaid_get_tax_class_label( $item->get_vat_class() ); |
|
590 | + echo getpaid_get_tax_class_label($item->get_vat_class()); |
|
591 | 591 | break; |
592 | 592 | |
593 | 593 | case 'shortcode' : |
594 | - echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>'; |
|
594 | + echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr($item->get_id()) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>'; |
|
595 | 595 | break; |
596 | 596 | |
597 | 597 | case 'type' : |
598 | - echo wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>'; |
|
598 | + echo wpinv_item_type($item->get_id()) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>'; |
|
599 | 599 | break; |
600 | 600 | |
601 | 601 | } |
@@ -605,21 +605,21 @@ discard block |
||
605 | 605 | /** |
606 | 606 | * Lets users filter items using taxes. |
607 | 607 | */ |
608 | - public static function add_item_filters( $post_type ) { |
|
608 | + public static function add_item_filters($post_type) { |
|
609 | 609 | |
610 | 610 | // Abort if we're not dealing with items. |
611 | - if ( $post_type != 'wpi_item' ) { |
|
611 | + if ($post_type != 'wpi_item') { |
|
612 | 612 | return; |
613 | 613 | } |
614 | 614 | |
615 | 615 | // Filter by vat rules. |
616 | - if ( wpinv_use_taxes() ) { |
|
616 | + if (wpinv_use_taxes()) { |
|
617 | 617 | |
618 | 618 | // Sanitize selected vat rule. |
619 | 619 | $vat_rule = ''; |
620 | 620 | $vat_rules = getpaid_get_tax_rules(); |
621 | - if ( isset( $_GET['vat_rule'] ) ) { |
|
622 | - $vat_rule = $_GET['vat_rule']; |
|
621 | + if (isset($_GET['vat_rule'])) { |
|
622 | + $vat_rule = $_GET['vat_rule']; |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | // Filter by VAT rule. |
@@ -627,13 +627,13 @@ discard block |
||
627 | 627 | array( |
628 | 628 | 'options' => array_merge( |
629 | 629 | array( |
630 | - '' => __( 'All VAT rules', 'invoicing' ) |
|
630 | + '' => __('All VAT rules', 'invoicing') |
|
631 | 631 | ), |
632 | 632 | $vat_rules |
633 | 633 | ), |
634 | 634 | 'name' => 'vat_rule', |
635 | 635 | 'id' => 'vat_rule', |
636 | - 'selected' => in_array( $vat_rule, array_keys( $vat_rules ) ) ? $vat_rule : '', |
|
636 | + 'selected' => in_array($vat_rule, array_keys($vat_rules)) ? $vat_rule : '', |
|
637 | 637 | 'show_option_all' => false, |
638 | 638 | 'show_option_none' => false, |
639 | 639 | ) |
@@ -644,21 +644,21 @@ discard block |
||
644 | 644 | // Sanitize selected vat rule. |
645 | 645 | $vat_class = ''; |
646 | 646 | $vat_classes = getpaid_get_tax_classes(); |
647 | - if ( isset( $_GET['vat_class'] ) ) { |
|
648 | - $vat_class = $_GET['vat_class']; |
|
647 | + if (isset($_GET['vat_class'])) { |
|
648 | + $vat_class = $_GET['vat_class']; |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | echo wpinv_html_select( |
652 | 652 | array( |
653 | 653 | 'options' => array_merge( |
654 | 654 | array( |
655 | - '' => __( 'All VAT classes', 'invoicing' ) |
|
655 | + '' => __('All VAT classes', 'invoicing') |
|
656 | 656 | ), |
657 | 657 | $vat_classes |
658 | 658 | ), |
659 | 659 | 'name' => 'vat_class', |
660 | 660 | 'id' => 'vat_class', |
661 | - 'selected' => in_array( $vat_class, array_keys( $vat_classes ) ) ? $vat_class : '', |
|
661 | + 'selected' => in_array($vat_class, array_keys($vat_classes)) ? $vat_class : '', |
|
662 | 662 | 'show_option_all' => false, |
663 | 663 | 'show_option_none' => false, |
664 | 664 | ) |
@@ -667,22 +667,22 @@ discard block |
||
667 | 667 | } |
668 | 668 | |
669 | 669 | // Filter by item type. |
670 | - $type = ''; |
|
671 | - if ( isset( $_GET['type'] ) ) { |
|
672 | - $type = $_GET['type']; |
|
670 | + $type = ''; |
|
671 | + if (isset($_GET['type'])) { |
|
672 | + $type = $_GET['type']; |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | echo wpinv_html_select( |
676 | 676 | array( |
677 | 677 | 'options' => array_merge( |
678 | 678 | array( |
679 | - '' => __( 'All item types', 'invoicing' ) |
|
679 | + '' => __('All item types', 'invoicing') |
|
680 | 680 | ), |
681 | 681 | wpinv_get_item_types() |
682 | 682 | ), |
683 | 683 | 'name' => 'type', |
684 | 684 | 'id' => 'type', |
685 | - 'selected' => in_array( $type, wpinv_item_types() ) ? $type : '', |
|
685 | + 'selected' => in_array($type, wpinv_item_types()) ? $type : '', |
|
686 | 686 | 'show_option_all' => false, |
687 | 687 | 'show_option_none' => false, |
688 | 688 | ) |
@@ -693,45 +693,45 @@ discard block |
||
693 | 693 | /** |
694 | 694 | * Filters the item query. |
695 | 695 | */ |
696 | - public static function filter_item_query( $query ) { |
|
696 | + public static function filter_item_query($query) { |
|
697 | 697 | |
698 | 698 | // modify the query only if it admin and main query. |
699 | - if ( ! ( is_admin() && $query->is_main_query() ) ){ |
|
699 | + if (!(is_admin() && $query->is_main_query())) { |
|
700 | 700 | return $query; |
701 | 701 | } |
702 | 702 | |
703 | 703 | // we want to modify the query for our items. |
704 | - if ( empty( $query->query['post_type'] ) || 'wpi_item' != $query->query['post_type'] ){ |
|
704 | + if (empty($query->query['post_type']) || 'wpi_item' != $query->query['post_type']) { |
|
705 | 705 | return $query; |
706 | 706 | } |
707 | 707 | |
708 | - if ( empty( $query->query_vars['meta_query'] ) ) { |
|
708 | + if (empty($query->query_vars['meta_query'])) { |
|
709 | 709 | $query->query_vars['meta_query'] = array(); |
710 | 710 | } |
711 | 711 | |
712 | 712 | // Filter vat rule type |
713 | - if ( ! empty( $_GET['vat_rule'] ) ) { |
|
713 | + if (!empty($_GET['vat_rule'])) { |
|
714 | 714 | $query->query_vars['meta_query'][] = array( |
715 | 715 | 'key' => '_wpinv_vat_rule', |
716 | - 'value' => sanitize_text_field( $_GET['vat_rule'] ), |
|
716 | + 'value' => sanitize_text_field($_GET['vat_rule']), |
|
717 | 717 | 'compare' => '=' |
718 | 718 | ); |
719 | 719 | } |
720 | 720 | |
721 | 721 | // Filter vat class |
722 | - if ( ! empty( $_GET['vat_class'] ) ) { |
|
722 | + if (!empty($_GET['vat_class'])) { |
|
723 | 723 | $query->query_vars['meta_query'][] = array( |
724 | 724 | 'key' => '_wpinv_vat_class', |
725 | - 'value' => sanitize_text_field( $_GET['vat_class'] ), |
|
725 | + 'value' => sanitize_text_field($_GET['vat_class']), |
|
726 | 726 | 'compare' => '=' |
727 | 727 | ); |
728 | 728 | } |
729 | 729 | |
730 | 730 | // Filter item type |
731 | - if ( ! empty( $_GET['type'] ) ) { |
|
731 | + if (!empty($_GET['type'])) { |
|
732 | 732 | $query->query_vars['meta_query'][] = array( |
733 | 733 | 'key' => '_wpinv_type', |
734 | - 'value' => sanitize_text_field( $_GET['type'] ), |
|
734 | + 'value' => sanitize_text_field($_GET['type']), |
|
735 | 735 | 'compare' => '=' |
736 | 736 | ); |
737 | 737 | } |
@@ -741,15 +741,15 @@ discard block |
||
741 | 741 | /** |
742 | 742 | * Reorders items. |
743 | 743 | */ |
744 | - public static function reorder_items( $vars ) { |
|
744 | + public static function reorder_items($vars) { |
|
745 | 745 | global $typenow; |
746 | 746 | |
747 | - if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) { |
|
747 | + if ('wpi_item' !== $typenow || empty($vars['orderby'])) { |
|
748 | 748 | return $vars; |
749 | 749 | } |
750 | 750 | |
751 | 751 | // By item type. |
752 | - if ( 'type' == $vars['orderby'] ) { |
|
752 | + if ('type' == $vars['orderby']) { |
|
753 | 753 | return array_merge( |
754 | 754 | $vars, |
755 | 755 | array( |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | } |
761 | 761 | |
762 | 762 | // By vat class. |
763 | - if ( 'vat_class' == $vars['orderby'] ) { |
|
763 | + if ('vat_class' == $vars['orderby']) { |
|
764 | 764 | return array_merge( |
765 | 765 | $vars, |
766 | 766 | array( |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | } |
772 | 772 | |
773 | 773 | // By vat rule. |
774 | - if ( 'vat_rule' == $vars['orderby'] ) { |
|
774 | + if ('vat_rule' == $vars['orderby']) { |
|
775 | 775 | return array_merge( |
776 | 776 | $vars, |
777 | 777 | array( |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | } |
783 | 783 | |
784 | 784 | // By price. |
785 | - if ( 'price' == $vars['orderby'] ) { |
|
785 | + if ('price' == $vars['orderby']) { |
|
786 | 786 | return array_merge( |
787 | 787 | $vars, |
788 | 788 | array( |
@@ -799,27 +799,27 @@ discard block |
||
799 | 799 | /** |
800 | 800 | * Fired when deleting a post. |
801 | 801 | */ |
802 | - public static function delete_post( $post_id ) { |
|
802 | + public static function delete_post($post_id) { |
|
803 | 803 | |
804 | - switch ( get_post_type( $post_id ) ) { |
|
804 | + switch (get_post_type($post_id)) { |
|
805 | 805 | |
806 | 806 | case 'wpi_item' : |
807 | - do_action( "getpaid_before_delete_item", new WPInv_Item( $post_id ) ); |
|
807 | + do_action("getpaid_before_delete_item", new WPInv_Item($post_id)); |
|
808 | 808 | break; |
809 | 809 | |
810 | 810 | case 'wpi_payment_form' : |
811 | - do_action( "getpaid_before_delete_payment_form", new GetPaid_Payment_Form( $post_id ) ); |
|
811 | + do_action("getpaid_before_delete_payment_form", new GetPaid_Payment_Form($post_id)); |
|
812 | 812 | break; |
813 | 813 | |
814 | 814 | case 'wpi_discount' : |
815 | - do_action( "getpaid_before_delete_discount", new WPInv_Discount( $post_id ) ); |
|
815 | + do_action("getpaid_before_delete_discount", new WPInv_Discount($post_id)); |
|
816 | 816 | break; |
817 | 817 | |
818 | 818 | case 'wpi_invoice' : |
819 | - $invoice = new WPInv_Invoice( $post_id ); |
|
820 | - do_action( "getpaid_before_delete_invoice", $invoice ); |
|
821 | - $invoice->get_data_store()->delete_items( $invoice ); |
|
822 | - $invoice->get_data_store()->delete_special_fields( $invoice ); |
|
819 | + $invoice = new WPInv_Invoice($post_id); |
|
820 | + do_action("getpaid_before_delete_invoice", $invoice); |
|
821 | + $invoice->get_data_store()->delete_items($invoice); |
|
822 | + $invoice->get_data_store()->delete_special_fields($invoice); |
|
823 | 823 | break; |
824 | 824 | } |
825 | 825 | } |
@@ -832,29 +832,29 @@ discard block |
||
832 | 832 | * |
833 | 833 | * @return mixed |
834 | 834 | */ |
835 | - public static function add_display_post_states( $post_states, $post ) { |
|
835 | + public static function add_display_post_states($post_states, $post) { |
|
836 | 836 | |
837 | - if ( wpinv_get_option( 'success_page', 0 ) == $post->ID ) { |
|
838 | - $post_states['getpaid_success_page'] = __( 'GetPaid Receipt Page', 'invoicing' ); |
|
837 | + if (wpinv_get_option('success_page', 0) == $post->ID) { |
|
838 | + $post_states['getpaid_success_page'] = __('GetPaid Receipt Page', 'invoicing'); |
|
839 | 839 | } |
840 | 840 | |
841 | - foreach ( getpaid_get_invoice_post_types() as $post_type => $label ) { |
|
841 | + foreach (getpaid_get_invoice_post_types() as $post_type => $label) { |
|
842 | 842 | |
843 | - if ( wpinv_get_option( "{$post_type}_history_page", 0 ) == $post->ID ) { |
|
843 | + if (wpinv_get_option("{$post_type}_history_page", 0) == $post->ID) { |
|
844 | 844 | $post_states["getpaid_{$post_type}_history_page"] = sprintf( |
845 | - __( 'GetPaid %s History Page', 'invoicing' ), |
|
845 | + __('GetPaid %s History Page', 'invoicing'), |
|
846 | 846 | $label |
847 | 847 | ); |
848 | 848 | } |
849 | 849 | |
850 | 850 | } |
851 | 851 | |
852 | - if ( wpinv_get_option( 'invoice_subscription_page', 0 ) == $post->ID ) { |
|
853 | - $post_states['getpaid_invoice_subscription_page'] = __( 'GetPaid Subscription Page', 'invoicing' ); |
|
852 | + if (wpinv_get_option('invoice_subscription_page', 0) == $post->ID) { |
|
853 | + $post_states['getpaid_invoice_subscription_page'] = __('GetPaid Subscription Page', 'invoicing'); |
|
854 | 854 | } |
855 | 855 | |
856 | - if ( wpinv_get_option( 'checkout_page', 0 ) == $post->ID ) { |
|
857 | - $post_states['getpaid_checkout_page'] = __( 'GetPaid Checkout Page', 'invoicing' ); |
|
856 | + if (wpinv_get_option('checkout_page', 0) == $post->ID) { |
|
857 | + $post_states['getpaid_checkout_page'] = __('GetPaid Checkout Page', 'invoicing'); |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | return $post_states; |
@@ -5,10 +5,10 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Exit if accessed directly |
8 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
8 | +if (!defined('ABSPATH')) exit; |
|
9 | 9 | |
10 | 10 | // Load WP_List_Table if not loaded |
11 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
11 | +if (!class_exists('WP_List_Table')) { |
|
12 | 12 | require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
13 | 13 | } |
14 | 14 | |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | public function __construct() { |
43 | 43 | |
44 | 44 | // Set parent defaults |
45 | - parent::__construct( array( |
|
45 | + parent::__construct(array( |
|
46 | 46 | 'singular' => 'id', |
47 | 47 | 'plural' => 'ids', |
48 | 48 | 'ajax' => false, |
49 | - ) ); |
|
49 | + )); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return string Column Name |
74 | 74 | */ |
75 | - public function column_default( $item, $column_name ) { |
|
76 | - $value = esc_html( get_user_meta( $item->ID, '_wpinv_' . $column_name, true ) ); |
|
77 | - return apply_filters( 'wpinv_customers_table_column' . $column_name, $value, $item ); |
|
75 | + public function column_default($item, $column_name) { |
|
76 | + $value = esc_html(get_user_meta($item->ID, '_wpinv_' . $column_name, true)); |
|
77 | + return apply_filters('wpinv_customers_table_column' . $column_name, $value, $item); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return string Column Name |
88 | 88 | */ |
89 | - public function column_country( $user ) { |
|
90 | - $country = wpinv_sanitize_country( $user->_wpinv_country ); |
|
91 | - if ( $country ) { |
|
92 | - $country = wpinv_country_name( $country ); |
|
89 | + public function column_country($user) { |
|
90 | + $country = wpinv_sanitize_country($user->_wpinv_country); |
|
91 | + if ($country) { |
|
92 | + $country = wpinv_country_name($country); |
|
93 | 93 | } |
94 | - return esc_html( $country ); |
|
94 | + return esc_html($country); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return string Column Name |
105 | 105 | */ |
106 | - public function column_state( $user ) { |
|
107 | - $country = wpinv_sanitize_country( $user->_wpinv_country ); |
|
106 | + public function column_state($user) { |
|
107 | + $country = wpinv_sanitize_country($user->_wpinv_country); |
|
108 | 108 | $state = $user->_wpinv_state; |
109 | - if ( $state ) { |
|
110 | - $state = wpinv_state_name( $state, $country ); |
|
109 | + if ($state) { |
|
110 | + $state = wpinv_state_name($state, $country); |
|
111 | 111 | } |
112 | 112 | |
113 | - return esc_html( $state ); |
|
113 | + return esc_html($state); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return string Column Name |
124 | 124 | */ |
125 | - public function column_signup( $user ) { |
|
126 | - return getpaid_format_date_value( $user->user_registered ); |
|
125 | + public function column_signup($user) { |
|
126 | + return getpaid_format_date_value($user->user_registered); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return string Column Name |
137 | 137 | */ |
138 | - public function column_total( $user ) { |
|
139 | - return wpinv_price( $this->column_total_raw( $user ) ); |
|
138 | + public function column_total($user) { |
|
139 | + return wpinv_price($this->column_total_raw($user)); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return float |
150 | 150 | */ |
151 | - public function column_total_raw( $user ) { |
|
151 | + public function column_total_raw($user) { |
|
152 | 152 | |
153 | 153 | $args = array( |
154 | 154 | 'data' => array( |
@@ -164,17 +164,17 @@ discard block |
||
164 | 164 | |
165 | 165 | 'author' => array( |
166 | 166 | 'type' => 'post_data', |
167 | - 'value' => absint( $user->ID ), |
|
167 | + 'value' => absint($user->ID), |
|
168 | 168 | 'key' => 'posts.post_author', |
169 | 169 | 'operator' => '=', |
170 | 170 | ), |
171 | 171 | |
172 | 172 | ), |
173 | 173 | 'query_type' => 'get_var', |
174 | - 'invoice_status' => array( 'wpi-renewal', 'wpi-processing', 'publish' ), |
|
174 | + 'invoice_status' => array('wpi-renewal', 'wpi-processing', 'publish'), |
|
175 | 175 | ); |
176 | 176 | |
177 | - return wpinv_round_amount( GetPaid_Reports_Helper::get_invoice_report_data( $args ) ); |
|
177 | + return wpinv_round_amount(GetPaid_Reports_Helper::get_invoice_report_data($args)); |
|
178 | 178 | |
179 | 179 | } |
180 | 180 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return string Column Name |
189 | 189 | */ |
190 | - public function column_invoices( $user ) { |
|
190 | + public function column_invoices($user) { |
|
191 | 191 | |
192 | 192 | $args = array( |
193 | 193 | 'data' => array( |
@@ -204,17 +204,17 @@ discard block |
||
204 | 204 | |
205 | 205 | 'author' => array( |
206 | 206 | 'type' => 'post_data', |
207 | - 'value' => absint( $user->ID ), |
|
207 | + 'value' => absint($user->ID), |
|
208 | 208 | 'key' => 'posts.post_author', |
209 | 209 | 'operator' => '=', |
210 | 210 | ), |
211 | 211 | |
212 | 212 | ), |
213 | 213 | 'query_type' => 'get_var', |
214 | - 'invoice_status' => array_keys( wpinv_get_invoice_statuses() ), |
|
214 | + 'invoice_status' => array_keys(wpinv_get_invoice_statuses()), |
|
215 | 215 | ); |
216 | 216 | |
217 | - return absint( GetPaid_Reports_Helper::get_invoice_report_data( $args ) ); |
|
217 | + return absint(GetPaid_Reports_Helper::get_invoice_report_data($args)); |
|
218 | 218 | |
219 | 219 | } |
220 | 220 | |
@@ -224,15 +224,15 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @param int $item The user id. |
226 | 226 | */ |
227 | - public function single_row( $item ) { |
|
228 | - $item = get_user_by( 'id', $item ); |
|
227 | + public function single_row($item) { |
|
228 | + $item = get_user_by('id', $item); |
|
229 | 229 | |
230 | - if ( empty( $item ) ) { |
|
230 | + if (empty($item)) { |
|
231 | 231 | return; |
232 | 232 | } |
233 | 233 | |
234 | 234 | echo '<tr>'; |
235 | - $this->single_row_columns( $item ); |
|
235 | + $this->single_row_columns($item); |
|
236 | 236 | echo '</tr>'; |
237 | 237 | } |
238 | 238 | |
@@ -242,30 +242,30 @@ discard block |
||
242 | 242 | * @param WP_User $customer customer. |
243 | 243 | * @return string |
244 | 244 | */ |
245 | - public function column_name( $customer ) { |
|
245 | + public function column_name($customer) { |
|
246 | 246 | |
247 | 247 | // Customer view URL. |
248 | - $view_url = esc_url( add_query_arg( 'user_id', $customer->ID, admin_url( 'user-edit.php' ) ) ); |
|
248 | + $view_url = esc_url(add_query_arg('user_id', $customer->ID, admin_url('user-edit.php'))); |
|
249 | 249 | $row_actions = $this->row_actions( |
250 | 250 | array( |
251 | - 'view' => '<a href="' . $view_url . '#getpaid-fieldset-billing">' . __( 'Edit Details', 'invoicing' ) . '</a>', |
|
251 | + 'view' => '<a href="' . $view_url . '#getpaid-fieldset-billing">' . __('Edit Details', 'invoicing') . '</a>', |
|
252 | 252 | ) |
253 | 253 | ); |
254 | 254 | |
255 | 255 | // Get user's address. |
256 | - $address = wpinv_get_user_address( $customer->ID ); |
|
256 | + $address = wpinv_get_user_address($customer->ID); |
|
257 | 257 | |
258 | 258 | // Customer email address. |
259 | - $email = sanitize_email( $customer->user_email ); |
|
259 | + $email = sanitize_email($customer->user_email); |
|
260 | 260 | |
261 | 261 | // Customer's avatar. |
262 | - $avatar = esc_url( get_avatar_url( $email ) ); |
|
262 | + $avatar = esc_url(get_avatar_url($email)); |
|
263 | 263 | $avatar = "<img src='$avatar' height='32' width='32'/>"; |
264 | 264 | |
265 | 265 | // Customer's name. |
266 | - $name = esc_html( "{$address['first_name']} {$address['last_name']}" ); |
|
266 | + $name = esc_html("{$address['first_name']} {$address['last_name']}"); |
|
267 | 267 | |
268 | - if ( ! empty( $name ) ) { |
|
268 | + if (!empty($name)) { |
|
269 | 269 | $name = "<div style='overflow: hidden;height: 18px;'>$name</div>"; |
270 | 270 | } |
271 | 271 | |
@@ -284,19 +284,19 @@ discard block |
||
284 | 284 | public function get_columns() { |
285 | 285 | |
286 | 286 | $columns = array( |
287 | - 'name' => __( 'Name', 'invoicing' ), |
|
288 | - 'country' => __( 'Country', 'invoicing' ), |
|
289 | - 'state' => __( 'State', 'invoicing' ), |
|
290 | - 'city' => __( 'City', 'invoicing' ), |
|
291 | - 'zip' => __( 'ZIP', 'invoicing' ), |
|
292 | - 'address' => __( 'Address', 'invoicing' ), |
|
293 | - 'phone' => __( 'Phone', 'invoicing' ), |
|
294 | - 'company' => __( 'Company', 'invoicing' ), |
|
295 | - 'invoices' => __( 'Invoices', 'invoicing' ), |
|
296 | - 'total' => __( 'Total Spend', 'invoicing' ), |
|
297 | - 'signup' => __( 'Date created', 'invoicing' ), |
|
287 | + 'name' => __('Name', 'invoicing'), |
|
288 | + 'country' => __('Country', 'invoicing'), |
|
289 | + 'state' => __('State', 'invoicing'), |
|
290 | + 'city' => __('City', 'invoicing'), |
|
291 | + 'zip' => __('ZIP', 'invoicing'), |
|
292 | + 'address' => __('Address', 'invoicing'), |
|
293 | + 'phone' => __('Phone', 'invoicing'), |
|
294 | + 'company' => __('Company', 'invoicing'), |
|
295 | + 'invoices' => __('Invoices', 'invoicing'), |
|
296 | + 'total' => __('Total Spend', 'invoicing'), |
|
297 | + 'signup' => __('Date created', 'invoicing'), |
|
298 | 298 | ); |
299 | - return apply_filters( 'wpinv_customers_table_columns', $columns ); |
|
299 | + return apply_filters('wpinv_customers_table_columns', $columns); |
|
300 | 300 | |
301 | 301 | } |
302 | 302 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @return int Current page number |
308 | 308 | */ |
309 | 309 | public function get_paged() { |
310 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
310 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @since 1.0.19 |
317 | 317 | * @return void |
318 | 318 | */ |
319 | - public function bulk_actions( $which = '' ) { |
|
319 | + public function bulk_actions($which = '') { |
|
320 | 320 | return array(); |
321 | 321 | } |
322 | 322 | |
@@ -328,23 +328,23 @@ discard block |
||
328 | 328 | |
329 | 329 | $post_types = ''; |
330 | 330 | |
331 | - foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) { |
|
332 | - $post_types .= $wpdb->prepare( "post_type=%s OR ", $post_type ); |
|
331 | + foreach (array_keys(getpaid_get_invoice_post_types()) as $post_type) { |
|
332 | + $post_types .= $wpdb->prepare("post_type=%s OR ", $post_type); |
|
333 | 333 | } |
334 | 334 | |
335 | - $post_types = rtrim( $post_types, ' OR' ); |
|
335 | + $post_types = rtrim($post_types, ' OR'); |
|
336 | 336 | |
337 | 337 | // Maybe search. |
338 | - if ( ! empty( $_POST['s'] ) ) { |
|
338 | + if (!empty($_POST['s'])) { |
|
339 | 339 | $users = get_users( |
340 | 340 | array( |
341 | - 'search' => '*' . sanitize_text_field( urldecode( $_POST['s'] ) ) . '*', |
|
342 | - 'search_columns' => array( 'user_login', 'user_email', 'display_name' ), |
|
341 | + 'search' => '*' . sanitize_text_field(urldecode($_POST['s'])) . '*', |
|
342 | + 'search_columns' => array('user_login', 'user_email', 'display_name'), |
|
343 | 343 | 'fields' => 'ID', |
344 | 344 | ) |
345 | 345 | ); |
346 | 346 | |
347 | - $users = implode( ', ', $users ); |
|
347 | + $users = implode(', ', $users); |
|
348 | 348 | $post_types = "($post_types) AND ( post_author IN ( $users ) )"; |
349 | 349 | } |
350 | 350 | |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | ); |
359 | 359 | |
360 | 360 | $this->items = $customers; |
361 | - $this->total = (int) $wpdb->get_var( "SELECT COUNT( DISTINCT( post_author ) ) FROM $wpdb->posts WHERE $post_types" ); |
|
361 | + $this->total = (int) $wpdb->get_var("SELECT COUNT( DISTINCT( post_author ) ) FROM $wpdb->posts WHERE $post_types"); |
|
362 | 362 | |
363 | 363 | } |
364 | 364 | |
@@ -372,14 +372,14 @@ discard block |
||
372 | 372 | $columns = $this->get_columns(); |
373 | 373 | $hidden = array(); // No hidden columns |
374 | 374 | $sortable = $this->get_sortable_columns(); |
375 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
375 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
376 | 376 | $this->prepare_query(); |
377 | 377 | |
378 | 378 | $this->set_pagination_args( |
379 | 379 | array( |
380 | 380 | 'total_items' => $this->total, |
381 | 381 | 'per_page' => $this->per_page, |
382 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
382 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
383 | 383 | ) |
384 | 384 | ); |
385 | 385 |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | -add_action( 'manage_wpi_discount_posts_custom_column', 'wpinv_discount_custom_column' ); |
|
8 | -function wpinv_discount_custom_column( $column ) { |
|
7 | +add_action('manage_wpi_discount_posts_custom_column', 'wpinv_discount_custom_column'); |
|
8 | +function wpinv_discount_custom_column($column) { |
|
9 | 9 | global $post; |
10 | 10 | |
11 | - $discount = new WPInv_Discount( $post ); |
|
11 | + $discount = new WPInv_Discount($post); |
|
12 | 12 | |
13 | - switch ( $column ) { |
|
13 | + switch ($column) { |
|
14 | 14 | case 'code' : |
15 | 15 | echo $discount->get_code(); |
16 | 16 | break; |
@@ -21,31 +21,31 @@ discard block |
||
21 | 21 | echo $discount->get_usage(); |
22 | 22 | break; |
23 | 23 | case 'start_date' : |
24 | - echo getpaid_format_date_value( $discount->get_start_date() ); |
|
24 | + echo getpaid_format_date_value($discount->get_start_date()); |
|
25 | 25 | break; |
26 | 26 | case 'expiry_date' : |
27 | - echo getpaid_format_date_value( $discount->get_expiration_date(), __( 'Never', 'invoicing' ) ); |
|
27 | + echo getpaid_format_date_value($discount->get_expiration_date(), __('Never', 'invoicing')); |
|
28 | 28 | break; |
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -add_filter( 'post_row_actions', 'wpinv_post_row_actions', 90, 2 ); |
|
33 | -function wpinv_post_row_actions( $actions, $post ) { |
|
34 | - $post_type = !empty( $post->post_type ) ? $post->post_type : ''; |
|
32 | +add_filter('post_row_actions', 'wpinv_post_row_actions', 90, 2); |
|
33 | +function wpinv_post_row_actions($actions, $post) { |
|
34 | + $post_type = !empty($post->post_type) ? $post->post_type : ''; |
|
35 | 35 | |
36 | - if ( $post_type == 'wpi_discount' ) { |
|
37 | - $actions = wpinv_discount_row_actions( $post, $actions ); |
|
36 | + if ($post_type == 'wpi_discount') { |
|
37 | + $actions = wpinv_discount_row_actions($post, $actions); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return $actions; |
41 | 41 | } |
42 | 42 | |
43 | -function wpinv_discount_row_actions( $discount, $row_actions ) { |
|
44 | - $row_actions = array(); |
|
45 | - $edit_link = get_edit_post_link( $discount->ID ); |
|
46 | - $row_actions['edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit', 'invoicing' ) . '</a>'; |
|
43 | +function wpinv_discount_row_actions($discount, $row_actions) { |
|
44 | + $row_actions = array(); |
|
45 | + $edit_link = get_edit_post_link($discount->ID); |
|
46 | + $row_actions['edit'] = '<a href="' . esc_url($edit_link) . '">' . __('Edit', 'invoicing') . '</a>'; |
|
47 | 47 | |
48 | - if ( in_array( strtolower( $discount->post_status ), array( 'publish' ) ) ) { |
|
48 | + if (in_array(strtolower($discount->post_status), array('publish'))) { |
|
49 | 49 | |
50 | 50 | $url = wp_nonce_url( |
51 | 51 | add_query_arg( |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | 'getpaid-nonce', |
58 | 58 | 'getpaid-nonce' |
59 | 59 | ); |
60 | - $anchor = __( 'Deactivate', 'invoicing' ); |
|
61 | - $title = esc_attr__( 'Are you sure you want to deactivate this discount?', 'invoicing' ); |
|
60 | + $anchor = __('Deactivate', 'invoicing'); |
|
61 | + $title = esc_attr__('Are you sure you want to deactivate this discount?', 'invoicing'); |
|
62 | 62 | $row_actions['deactivate'] = "<a href='$url' onclick='return confirm(\"$title\")'>$anchor</a>"; |
63 | 63 | |
64 | - } else if( in_array( strtolower( $discount->post_status ), array( 'pending', 'draft' ) ) ) { |
|
64 | + } else if (in_array(strtolower($discount->post_status), array('pending', 'draft'))) { |
|
65 | 65 | |
66 | - $url = wp_nonce_url( |
|
66 | + $url = wp_nonce_url( |
|
67 | 67 | add_query_arg( |
68 | 68 | array( |
69 | 69 | 'getpaid-admin-action' => 'activate_discount', |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | 'getpaid-nonce', |
74 | 74 | 'getpaid-nonce' |
75 | 75 | ); |
76 | - $anchor = __( 'Activate', 'invoicing' ); |
|
77 | - $title = esc_attr__( 'Are you sure you want to activate this discount?', 'invoicing' ); |
|
76 | + $anchor = __('Activate', 'invoicing'); |
|
77 | + $title = esc_attr__('Are you sure you want to activate this discount?', 'invoicing'); |
|
78 | 78 | $row_actions['activate'] = "<a href='$url' onclick='return confirm(\"$title\")'>$anchor</a>"; |
79 | 79 | |
80 | 80 | } |
81 | 81 | |
82 | - $url = esc_url( |
|
82 | + $url = esc_url( |
|
83 | 83 | wp_nonce_url( |
84 | 84 | add_query_arg( |
85 | 85 | array( |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | 'getpaid-nonce' |
92 | 92 | ) |
93 | 93 | ); |
94 | - $anchor = __( 'Delete', 'invoicing' ); |
|
95 | - $title = esc_attr__( 'Are you sure you want to delete this discount?', 'invoicing' ); |
|
94 | + $anchor = __('Delete', 'invoicing'); |
|
95 | + $title = esc_attr__('Are you sure you want to delete this discount?', 'invoicing'); |
|
96 | 96 | $row_actions['delete'] = "<a href='$url' onclick='return confirm(\"$title\")'>$anchor</a>"; |
97 | 97 | |
98 | - $row_actions = apply_filters( 'wpinv_discount_row_actions', $row_actions, $discount ); |
|
98 | + $row_actions = apply_filters('wpinv_discount_row_actions', $row_actions, $discount); |
|
99 | 99 | |
100 | 100 | return $row_actions; |
101 | 101 | } |
@@ -103,68 +103,68 @@ discard block |
||
103 | 103 | function wpinv_restrict_manage_posts() { |
104 | 104 | global $typenow; |
105 | 105 | |
106 | - if( 'wpi_discount' == $typenow ) { |
|
106 | + if ('wpi_discount' == $typenow) { |
|
107 | 107 | wpinv_discount_filters(); |
108 | 108 | } |
109 | 109 | } |
110 | -add_action( 'restrict_manage_posts', 'wpinv_restrict_manage_posts', 10 ); |
|
110 | +add_action('restrict_manage_posts', 'wpinv_restrict_manage_posts', 10); |
|
111 | 111 | |
112 | 112 | function wpinv_discount_filters() { |
113 | 113 | |
114 | 114 | ?> |
115 | 115 | <select name="discount_type" id="dropdown_wpinv_discount_type"> |
116 | - <option value=""><?php _e( 'Show all types', 'invoicing' ); ?></option> |
|
116 | + <option value=""><?php _e('Show all types', 'invoicing'); ?></option> |
|
117 | 117 | <?php |
118 | 118 | $types = wpinv_get_discount_types(); |
119 | 119 | |
120 | - foreach ( $types as $name => $type ) { |
|
121 | - echo '<option value="' . esc_attr( $name ) . '"'; |
|
120 | + foreach ($types as $name => $type) { |
|
121 | + echo '<option value="' . esc_attr($name) . '"'; |
|
122 | 122 | |
123 | - if ( isset( $_GET['discount_type'] ) ) |
|
124 | - selected( $name, $_GET['discount_type'] ); |
|
123 | + if (isset($_GET['discount_type'])) |
|
124 | + selected($name, $_GET['discount_type']); |
|
125 | 125 | |
126 | - echo '>' . esc_html__( $type, 'invoicing' ) . '</option>'; |
|
126 | + echo '>' . esc_html__($type, 'invoicing') . '</option>'; |
|
127 | 127 | } |
128 | 128 | ?> |
129 | 129 | </select> |
130 | 130 | <?php |
131 | 131 | } |
132 | 132 | |
133 | -function wpinv_request( $vars ) { |
|
133 | +function wpinv_request($vars) { |
|
134 | 134 | global $typenow, $wp_post_statuses; |
135 | 135 | |
136 | - if ( getpaid_is_invoice_post_type( $typenow ) ) { |
|
137 | - if ( ! isset( $vars['post_status'] ) ) { |
|
138 | - $post_statuses = wpinv_get_invoice_statuses( false, false, $typenow ); |
|
136 | + if (getpaid_is_invoice_post_type($typenow)) { |
|
137 | + if (!isset($vars['post_status'])) { |
|
138 | + $post_statuses = wpinv_get_invoice_statuses(false, false, $typenow); |
|
139 | 139 | |
140 | - foreach ( $post_statuses as $status => $value ) { |
|
141 | - if ( isset( $wp_post_statuses[ $status ] ) && false === $wp_post_statuses[ $status ]->show_in_admin_all_list ) { |
|
142 | - unset( $post_statuses[ $status ] ); |
|
140 | + foreach ($post_statuses as $status => $value) { |
|
141 | + if (isset($wp_post_statuses[$status]) && false === $wp_post_statuses[$status]->show_in_admin_all_list) { |
|
142 | + unset($post_statuses[$status]); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | - $vars['post_status'] = array_keys( $post_statuses ); |
|
146 | + $vars['post_status'] = array_keys($post_statuses); |
|
147 | 147 | } |
148 | 148 | |
149 | - } else if ( 'wpi_discount' == $typenow ) { |
|
150 | - $meta_query = !empty( $vars['meta_query'] ) ? $vars['meta_query'] : array(); |
|
149 | + } else if ('wpi_discount' == $typenow) { |
|
150 | + $meta_query = !empty($vars['meta_query']) ? $vars['meta_query'] : array(); |
|
151 | 151 | // Filter vat rule type |
152 | - if ( isset( $_GET['discount_type'] ) && $_GET['discount_type'] !== '' ) { |
|
152 | + if (isset($_GET['discount_type']) && $_GET['discount_type'] !== '') { |
|
153 | 153 | $meta_query[] = array( |
154 | 154 | 'key' => '_wpi_discount_type', |
155 | - 'value' => sanitize_key( urldecode( $_GET['discount_type'] ) ), |
|
155 | + 'value' => sanitize_key(urldecode($_GET['discount_type'])), |
|
156 | 156 | 'compare' => '=' |
157 | 157 | ); |
158 | 158 | } |
159 | 159 | |
160 | - if ( !empty( $meta_query ) ) { |
|
160 | + if (!empty($meta_query)) { |
|
161 | 161 | $vars['meta_query'] = $meta_query; |
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | 165 | return $vars; |
166 | 166 | } |
167 | -add_filter( 'request', 'wpinv_request' ); |
|
167 | +add_filter('request', 'wpinv_request'); |
|
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Create a page and store the ID in an option. |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | * @param int $post_parent (default: 0) Parent for the new page |
177 | 177 | * @return int page ID |
178 | 178 | */ |
179 | -function wpinv_create_page( $slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0 ) { |
|
179 | +function wpinv_create_page($slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0) { |
|
180 | 180 | global $wpdb; |
181 | 181 | |
182 | - $option_value = wpinv_get_option( $option ); |
|
182 | + $option_value = wpinv_get_option($option); |
|
183 | 183 | |
184 | - if ( ! empty( $option_value ) && ( $page_object = get_post( $option_value ) ) ) { |
|
185 | - if ( 'page' === $page_object->post_type && ! in_array( $page_object->post_status, array( 'pending', 'trash', 'future', 'auto-draft' ) ) ) { |
|
184 | + if (!empty($option_value) && ($page_object = get_post($option_value))) { |
|
185 | + if ('page' === $page_object->post_type && !in_array($page_object->post_status, array('pending', 'trash', 'future', 'auto-draft'))) { |
|
186 | 186 | // Valid page is already in place |
187 | 187 | return $page_object->ID; |
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | - if(!empty($post_parent)){ |
|
191 | + if (!empty($post_parent)) { |
|
192 | 192 | $page = get_page_by_path($post_parent); |
193 | 193 | if ($page) { |
194 | 194 | $post_parent = $page->ID; |
@@ -197,40 +197,40 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - if ( strlen( $page_content ) > 0 ) { |
|
200 | + if (strlen($page_content) > 0) { |
|
201 | 201 | // Search for an existing page with the specified page content (typically a shortcode) |
202 | - $valid_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) ); |
|
202 | + $valid_page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_content LIKE %s LIMIT 1;", "%{$page_content}%")); |
|
203 | 203 | } else { |
204 | 204 | // Search for an existing page with the specified page slug |
205 | - $valid_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_name = %s LIMIT 1;", $slug ) ); |
|
205 | + $valid_page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_name = %s LIMIT 1;", $slug)); |
|
206 | 206 | } |
207 | 207 | |
208 | - $valid_page_found = apply_filters( 'wpinv_create_page_id', $valid_page_found, $slug, $page_content ); |
|
208 | + $valid_page_found = apply_filters('wpinv_create_page_id', $valid_page_found, $slug, $page_content); |
|
209 | 209 | |
210 | - if ( $valid_page_found ) { |
|
211 | - if ( $option ) { |
|
212 | - wpinv_update_option( $option, $valid_page_found ); |
|
210 | + if ($valid_page_found) { |
|
211 | + if ($option) { |
|
212 | + wpinv_update_option($option, $valid_page_found); |
|
213 | 213 | } |
214 | 214 | return $valid_page_found; |
215 | 215 | } |
216 | 216 | |
217 | 217 | // Search for a matching valid trashed page |
218 | - if ( strlen( $page_content ) > 0 ) { |
|
218 | + if (strlen($page_content) > 0) { |
|
219 | 219 | // Search for an existing page with the specified page content (typically a shortcode) |
220 | - $trashed_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) ); |
|
220 | + $trashed_page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_content LIKE %s LIMIT 1;", "%{$page_content}%")); |
|
221 | 221 | } else { |
222 | 222 | // Search for an existing page with the specified page slug |
223 | - $trashed_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_name = %s LIMIT 1;", $slug ) ); |
|
223 | + $trashed_page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_name = %s LIMIT 1;", $slug)); |
|
224 | 224 | } |
225 | 225 | |
226 | - if ( $trashed_page_found ) { |
|
226 | + if ($trashed_page_found) { |
|
227 | 227 | $page_id = $trashed_page_found; |
228 | 228 | $page_data = array( |
229 | 229 | 'ID' => $page_id, |
230 | 230 | 'post_status' => 'publish', |
231 | 231 | 'post_parent' => $post_parent, |
232 | 232 | ); |
233 | - wp_update_post( $page_data ); |
|
233 | + wp_update_post($page_data); |
|
234 | 234 | } else { |
235 | 235 | $page_data = array( |
236 | 236 | 'post_status' => 'publish', |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | 'post_parent' => $post_parent, |
243 | 243 | 'comment_status' => 'closed', |
244 | 244 | ); |
245 | - $page_id = wp_insert_post( $page_data ); |
|
245 | + $page_id = wp_insert_post($page_data); |
|
246 | 246 | } |
247 | 247 | |
248 | - if ( $option ) { |
|
249 | - wpinv_update_option( $option, (int) $page_id ); |
|
248 | + if ($option) { |
|
249 | + wpinv_update_option($option, (int) $page_id); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | return $page_id; |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @return array |
261 | 261 | */ |
262 | -function wpinv_add_aui_screens($screen_ids){ |
|
262 | +function wpinv_add_aui_screens($screen_ids) { |
|
263 | 263 | |
264 | 264 | // load on these pages if set |
265 | - $screen_ids = array_merge( $screen_ids, wpinv_get_screen_ids() ); |
|
265 | + $screen_ids = array_merge($screen_ids, wpinv_get_screen_ids()); |
|
266 | 266 | |
267 | 267 | return $screen_ids; |
268 | 268 | } |
269 | -add_filter('aui_screen_ids','wpinv_add_aui_screens'); |
|
270 | 269 | \ No newline at end of file |
270 | +add_filter('aui_screen_ids', 'wpinv_add_aui_screens'); |
|
271 | 271 | \ No newline at end of file |
@@ -4,29 +4,29 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | $gateways = wpinv_get_payment_gateways(); |
10 | -ksort( $gateways ); |
|
10 | +ksort($gateways); |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | <div class="table-responsive"> |
14 | 14 | <table id="wpinv_gateways_select" class="table border bg-white form-table"> |
15 | - <caption><?php echo esc_html_e( 'This table displays installed payment methods.', 'invoicing' ); ?></caption> |
|
15 | + <caption><?php echo esc_html_e('This table displays installed payment methods.', 'invoicing'); ?></caption> |
|
16 | 16 | |
17 | 17 | <thead> |
18 | 18 | <tr class="table-light"> |
19 | 19 | |
20 | 20 | <th scope="col" class="border-bottom border-top text-left"> |
21 | - <?php _e( 'Payment Method', 'invoicing' ); ?> |
|
21 | + <?php _e('Payment Method', 'invoicing'); ?> |
|
22 | 22 | </th> |
23 | 23 | |
24 | 24 | <th scope="col" class="border-bottom border-top text-center"> |
25 | - <?php _e( 'Enabled', 'invoicing' ); ?> |
|
25 | + <?php _e('Enabled', 'invoicing'); ?> |
|
26 | 26 | </th> |
27 | 27 | |
28 | 28 | <th scope="col" class="border-bottom border-top text-center"> |
29 | - <?php _e( 'Supports Subscriptions', 'invoicing' ); ?> |
|
29 | + <?php _e('Supports Subscriptions', 'invoicing'); ?> |
|
30 | 30 | </th> |
31 | 31 | |
32 | 32 | <th scope="col" class="border-bottom border-top text-right" style="width:32px"> </th> |
@@ -35,15 +35,15 @@ discard block |
||
35 | 35 | </thead> |
36 | 36 | |
37 | 37 | <tbody> |
38 | - <?php foreach ( $gateways as $id => $gateway ) : ?> |
|
38 | + <?php foreach ($gateways as $id => $gateway) : ?> |
|
39 | 39 | <tr> |
40 | 40 | <td class="getpaid-payment-method text-left"> |
41 | - <a style="color: #0073aa;" href="<?php echo esc_url( add_query_arg( 'section', $id ) ); ?>" class="font-weight-bold"><?php echo esc_html( $gateway['admin_label'] ); ?></a> |
|
41 | + <a style="color: #0073aa;" href="<?php echo esc_url(add_query_arg('section', $id)); ?>" class="font-weight-bold"><?php echo esc_html($gateway['admin_label']); ?></a> |
|
42 | 42 | </td> |
43 | 43 | <td class="getpaid-payment-method-enabled text-center"> |
44 | 44 | <?php |
45 | 45 | |
46 | - if ( wpinv_is_gateway_active( $id ) ) { |
|
46 | + if (wpinv_is_gateway_active($id)) { |
|
47 | 47 | echo "<i class='text-success fa fa-check'></i>"; |
48 | 48 | } else { |
49 | 49 | echo "<i class='text-dark fa fa-times'></i>"; |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | <td class="getpaid-payment-method-subscription text-center"> |
55 | 55 | <?php |
56 | 56 | |
57 | - $supports = apply_filters( "wpinv_{$id}_support_subscription", false ); |
|
58 | - $supports = apply_filters( 'getapid_gateway_supports_subscription', $supports, $id ); |
|
57 | + $supports = apply_filters("wpinv_{$id}_support_subscription", false); |
|
58 | + $supports = apply_filters('getapid_gateway_supports_subscription', $supports, $id); |
|
59 | 59 | |
60 | - if ( $supports ) { |
|
60 | + if ($supports) { |
|
61 | 61 | echo "<i class='text-success fa fa-check'></i>"; |
62 | 62 | } else { |
63 | 63 | echo "<i class='text-dark fa fa-times'></i>"; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | </td> |
68 | 68 | |
69 | 69 | <td class="getpaid-payment-method-action text-right"> |
70 | - <a class="button button-secondary" href="<?php echo esc_url( add_query_arg( 'section', $id ) ); ?>"><?php _e( 'Manage', 'invoicing' ); ?></a> |
|
70 | + <a class="button button-secondary" href="<?php echo esc_url(add_query_arg('section', $id)); ?>"><?php _e('Manage', 'invoicing'); ?></a> |
|
71 | 71 | </td> |
72 | 72 | |
73 | 73 | </tr> |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | <tfoot> |
78 | 78 | <tr class="table-light"> |
79 | 79 | <td colspan="4" class="border-top"> |
80 | - <a class="button button-secondary getpaid-install-gateways" href="<?php echo esc_url( admin_url( 'admin.php?page=wpi-addons&tab=gateways' ) ); ?>"> |
|
81 | - <span><?php _e( 'Add Payment Methods', 'invoicing' ); ?></span> |
|
80 | + <a class="button button-secondary getpaid-install-gateways" href="<?php echo esc_url(admin_url('admin.php?page=wpi-addons&tab=gateways')); ?>"> |
|
81 | + <span><?php _e('Add Payment Methods', 'invoicing'); ?></span> |
|
82 | 82 | </a> |
83 | 83 | </td> |
84 | 84 | </tr> |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @var array $tax_rate |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | ?> |
12 | 12 | |
@@ -18,54 +18,54 @@ discard block |
||
18 | 18 | $country = aui()->select( |
19 | 19 | array( |
20 | 20 | 'options' => array_merge( |
21 | - array( '' => __( 'All Countries', 'invoicing' ) ), |
|
21 | + array('' => __('All Countries', 'invoicing')), |
|
22 | 22 | wpinv_get_country_list() |
23 | 23 | ), |
24 | 24 | 'name' => "tax_rates[$key][country]", |
25 | - 'id' => uniqid( 'tax_rate_country' ), |
|
26 | - 'value' => esc_html( $tax_rate['country'] ), |
|
27 | - 'label' => __( 'Country', 'invoicing' ), |
|
25 | + 'id' => uniqid('tax_rate_country'), |
|
26 | + 'value' => esc_html($tax_rate['country']), |
|
27 | + 'label' => __('Country', 'invoicing'), |
|
28 | 28 | 'class' => 'wpinv_country', |
29 | 29 | 'no_wrap' => true, |
30 | 30 | ) |
31 | 31 | ); |
32 | 32 | |
33 | - echo str_replace( 'custom-select', '', $country ); |
|
33 | + echo str_replace('custom-select', '', $country); |
|
34 | 34 | ?> |
35 | 35 | </td> |
36 | 36 | |
37 | 37 | <td class="wpinv_tax_state"> |
38 | 38 | |
39 | 39 | <label class="w-100"> |
40 | - <span class="screen-reader-text"><?php _e( 'States', 'invoicing' ); ?></span> |
|
41 | - <input type="text" placeholder="<?php esc_attr_e( 'Apply to whole country', 'invoicing' ); ?>" name="tax_rates[<?php echo esc_attr( $key ) ?>][state]" value="<?php echo empty( $tax_rate['global'] ) ? esc_attr( $tax_rate['state'] ) : ''; ?>"/> |
|
40 | + <span class="screen-reader-text"><?php _e('States', 'invoicing'); ?></span> |
|
41 | + <input type="text" placeholder="<?php esc_attr_e('Apply to whole country', 'invoicing'); ?>" name="tax_rates[<?php echo esc_attr($key) ?>][state]" value="<?php echo empty($tax_rate['global']) ? esc_attr($tax_rate['state']) : ''; ?>"/> |
|
42 | 42 | </label> |
43 | 43 | |
44 | 44 | </td> |
45 | 45 | |
46 | 46 | <td class="wpinv_standard_rate"> |
47 | 47 | <label class="w-100"> |
48 | - <span class="screen-reader-text"><?php _e( 'Standard Rate', 'invoicing' ); ?></span> |
|
49 | - <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr( $key ) ?>][rate]" value="<?php echo wpinv_sanitize_amount( $tax_rate['rate'] ); ?>"/> |
|
48 | + <span class="screen-reader-text"><?php _e('Standard Rate', 'invoicing'); ?></span> |
|
49 | + <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr($key) ?>][rate]" value="<?php echo wpinv_sanitize_amount($tax_rate['rate']); ?>"/> |
|
50 | 50 | </label> |
51 | 51 | </td> |
52 | 52 | |
53 | 53 | <td class="wpinv_reduced_rate"> |
54 | 54 | <label class="w-100"> |
55 | - <span class="screen-reader-text"><?php _e( 'Reduced Rate', 'invoicing' ); ?></span> |
|
56 | - <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr( $key ) ?>][reduced_rate]" value="<?php echo wpinv_sanitize_amount( $tax_rate['reduced_rate'] ); ?>"/> |
|
55 | + <span class="screen-reader-text"><?php _e('Reduced Rate', 'invoicing'); ?></span> |
|
56 | + <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr($key) ?>][reduced_rate]" value="<?php echo wpinv_sanitize_amount($tax_rate['reduced_rate']); ?>"/> |
|
57 | 57 | </label> |
58 | 58 | </td> |
59 | 59 | |
60 | 60 | <td class="wpinv_tax_name"> |
61 | 61 | <label class="w-100"> |
62 | - <span class="screen-reader-text"><?php _e( 'Tax Name', 'invoicing' ); ?></span> |
|
63 | - <input type="text" name="tax_rates[<?php echo esc_attr( $key ) ?>][name]" value="<?php echo esc_attr( $tax_rate['name'] ); ?>"/> |
|
62 | + <span class="screen-reader-text"><?php _e('Tax Name', 'invoicing'); ?></span> |
|
63 | + <input type="text" name="tax_rates[<?php echo esc_attr($key) ?>][name]" value="<?php echo esc_attr($tax_rate['name']); ?>"/> |
|
64 | 64 | </label> |
65 | 65 | </td> |
66 | 66 | |
67 | 67 | <td class="wpinv_tax_remove"> |
68 | - <button type="button" class="close wpinv_remove_tax_rate" aria-label="<?php esc_attr_e( 'Delete', 'invoicing' ); ?>" title="<?php esc_attr_e( 'Delete', 'invoicing' ); ?>"> |
|
68 | + <button type="button" class="close wpinv_remove_tax_rate" aria-label="<?php esc_attr_e('Delete', 'invoicing'); ?>" title="<?php esc_attr_e('Delete', 'invoicing'); ?>"> |
|
69 | 69 | <span aria-hidden="true">×</span> |
70 | 70 | </button> |
71 | 71 | </td> |
@@ -7,36 +7,36 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Cart table columns. |
13 | 13 | $columns = array( |
14 | - 'name' => __( 'Item', 'invoicing' ), |
|
15 | - 'price' => __( 'Price', 'invoicing' ), |
|
16 | - 'quantity' => __( 'Qty', 'invoicing' ), |
|
17 | - 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
14 | + 'name' => __('Item', 'invoicing'), |
|
15 | + 'price' => __('Price', 'invoicing'), |
|
16 | + 'quantity' => __('Qty', 'invoicing'), |
|
17 | + 'subtotal' => __('Subtotal', 'invoicing'), |
|
18 | 18 | ); |
19 | 19 | |
20 | -if ( ! empty( $form->invoice ) ) { |
|
21 | - $columns = getpaid_invoice_item_columns( $form->invoice ); |
|
20 | +if (!empty($form->invoice)) { |
|
21 | + $columns = getpaid_invoice_item_columns($form->invoice); |
|
22 | 22 | } |
23 | 23 | |
24 | -if ( isset( $columns['tax_rate'] ) ) { |
|
25 | - unset( $columns['tax_rate'] ); |
|
24 | +if (isset($columns['tax_rate'])) { |
|
25 | + unset($columns['tax_rate']); |
|
26 | 26 | } |
27 | 27 | |
28 | -$columns = apply_filters( 'getpaid_payment_form_cart_table_columns', $columns, $form ); |
|
28 | +$columns = apply_filters('getpaid_payment_form_cart_table_columns', $columns, $form); |
|
29 | 29 | |
30 | -do_action( 'getpaid_before_payment_form_cart', $form ); |
|
30 | +do_action('getpaid_before_payment_form_cart', $form); |
|
31 | 31 | |
32 | 32 | ?> |
33 | 33 | <div class="getpaid-payment-form-items-cart border form-group"> |
34 | 34 | |
35 | 35 | <div class="getpaid-payment-form-items-cart-header font-weight-bold bg-light border-bottom py-2 px-3"> |
36 | 36 | <div class="form-row"> |
37 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
38 | - <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?>"> |
|
39 | - <span><?php echo esc_html( $label ); ?></span> |
|
37 | + <?php foreach ($columns as $key => $label) : ?> |
|
38 | + <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?>"> |
|
39 | + <span><?php echo esc_html($label); ?></span> |
|
40 | 40 | </div> |
41 | 41 | <?php endforeach; ?> |
42 | 42 | </div> |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | <?php |
46 | 46 | |
47 | 47 | // Display the item totals. |
48 | - foreach ( $form->get_items() as $item ) { |
|
49 | - wpinv_get_template( 'payment-forms/cart-item.php', compact( 'form', 'item', 'columns' ) ); |
|
48 | + foreach ($form->get_items() as $item) { |
|
49 | + wpinv_get_template('payment-forms/cart-item.php', compact('form', 'item', 'columns')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // Display the cart totals. |
53 | - wpinv_get_template( 'payment-forms/cart-totals.php', compact( 'form' ) ); |
|
53 | + wpinv_get_template('payment-forms/cart-totals.php', compact('form')); |
|
54 | 54 | |
55 | 55 | ?> |
56 | 56 | </div> |
57 | 57 | |
58 | 58 | <?php |
59 | 59 | |
60 | -do_action( 'getpaid_after_payment_form_cart', $form ); |
|
60 | +do_action('getpaid_after_payment_form_cart', $form); |
@@ -7,35 +7,35 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Ensure that we have options. |
13 | -if ( empty( $options ) ) { |
|
13 | +if (empty($options)) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Prepare price options. |
18 | -$options = getpaid_convert_price_string_to_options( $options ); |
|
19 | -$keys = array_keys( $options ); |
|
20 | -$value = empty( $options ) ? '' : $keys[0]; |
|
18 | +$options = getpaid_convert_price_string_to_options($options); |
|
19 | +$keys = array_keys($options); |
|
20 | +$value = empty($options) ? '' : $keys[0]; |
|
21 | 21 | |
22 | 22 | // Prepare id. |
23 | -$id = esc_attr( $id ); |
|
23 | +$id = esc_attr($id); |
|
24 | 24 | |
25 | -$select_type = empty( $select_type ) ? 'select' : $select_type; |
|
25 | +$select_type = empty($select_type) ? 'select' : $select_type; |
|
26 | 26 | |
27 | 27 | // Item select; |
28 | -if ( $select_type == 'select' ) { |
|
28 | +if ($select_type == 'select') { |
|
29 | 29 | echo aui()->select( |
30 | 30 | array( |
31 | 31 | 'name' => $id, |
32 | - 'id' => $id . uniqid( '_' ), |
|
33 | - 'placeholder'=> empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
32 | + 'id' => $id . uniqid('_'), |
|
33 | + 'placeholder'=> empty($placeholder) ? '' : esc_attr($placeholder), |
|
34 | 34 | 'value' => $value, |
35 | - 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
35 | + 'label' => empty($label) ? '' : esc_html($label), |
|
36 | 36 | 'label_type' => 'vertical', |
37 | 37 | 'class' => 'getpaid-price-select-dropdown getpaid-refresh-on-change', |
38 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
38 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
39 | 39 | 'options' => $options, |
40 | 40 | ) |
41 | 41 | ); |
@@ -43,18 +43,18 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | // Item radios; |
46 | -if ( $select_type == 'radios' ) { |
|
46 | +if ($select_type == 'radios') { |
|
47 | 47 | echo aui()->radio( |
48 | 48 | array( |
49 | - 'name' => esc_attr( $id ), |
|
50 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
51 | - 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
49 | + 'name' => esc_attr($id), |
|
50 | + 'id' => esc_attr($id) . uniqid('_'), |
|
51 | + 'label' => empty($label) ? '' : esc_html($label), |
|
52 | 52 | 'label_type' => 'vertical', |
53 | 53 | 'class' => 'getpaid-price-select-radio getpaid-refresh-on-change w-100', |
54 | 54 | 'value' => $value, |
55 | 55 | 'inline' => false, |
56 | 56 | 'options' => $options, |
57 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
57 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
58 | 58 | ) |
59 | 59 | ); |
60 | 60 | return; |
@@ -62,30 +62,30 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | // Display the label. |
65 | -if ( ! empty( $label ) ) { |
|
66 | - $label = esc_html( $label ); |
|
65 | +if (!empty($label)) { |
|
66 | + $label = esc_html($label); |
|
67 | 67 | echo "<label>$label</label>"; |
68 | 68 | } |
69 | 69 | |
70 | 70 | // Item buttons; |
71 | -if ( $select_type == 'buttons' || $select_type == 'circles' ) { |
|
71 | +if ($select_type == 'buttons' || $select_type == 'circles') { |
|
72 | 72 | |
73 | 73 | $class = 'getpaid-price-buttons'; |
74 | 74 | |
75 | - if ( $select_type == 'circles' ) { |
|
75 | + if ($select_type == 'circles') { |
|
76 | 76 | $class .= ' getpaid-price-circles'; |
77 | 77 | } |
78 | 78 | echo "<div class='$class'>"; |
79 | 79 | |
80 | - foreach ( $options as $price => $label ) { |
|
81 | - $label = esc_html( $label ); |
|
82 | - $price = esc_attr( $price ); |
|
83 | - $_id = $id . uniqid( '_' ); |
|
84 | - $checked = checked( $price, $value, false ); |
|
80 | + foreach ($options as $price => $label) { |
|
81 | + $label = esc_html($label); |
|
82 | + $price = esc_attr($price); |
|
83 | + $_id = $id . uniqid('_'); |
|
84 | + $checked = checked($price, $value, false); |
|
85 | 85 | |
86 | 86 | $class = 'rounded'; |
87 | 87 | |
88 | - if ( $select_type == 'circles' ) { |
|
88 | + if ($select_type == 'circles') { |
|
89 | 89 | $class = ''; |
90 | 90 | } |
91 | 91 | echo " |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | // Item checkboxes; |
104 | -if ( $select_type == 'checkboxes' ) { |
|
104 | +if ($select_type == 'checkboxes') { |
|
105 | 105 | echo '<div class="form-group">'; |
106 | 106 | |
107 | - foreach ( $options as $price => $label ) { |
|
108 | - $label = esc_html( $label ); |
|
109 | - $price = esc_attr( $price ); |
|
110 | - $checked = checked( $price, $value, false ); |
|
107 | + foreach ($options as $price => $label) { |
|
108 | + $label = esc_html($label); |
|
109 | + $price = esc_attr($price); |
|
110 | + $checked = checked($price, $value, false); |
|
111 | 111 | echo " |
112 | 112 | <label class='d-block'> |
113 | 113 | <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change w-auto' name='{$id}[]' value='$price' $checked /> |
@@ -120,6 +120,6 @@ discard block |
||
120 | 120 | |
121 | 121 | } |
122 | 122 | |
123 | -if ( ! empty( $description ) ) { |
|
123 | +if (!empty($description)) { |
|
124 | 124 | echo "<small class='form-text text-muted'>$description</small>"; |
125 | 125 | } |