@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | function wpinv_subscriptions_page() { |
16 | 16 | |
17 | - ?> |
|
17 | + ?> |
|
18 | 18 | |
19 | 19 | <div class="wrap"> |
20 | 20 | <h1><?php echo esc_html( get_admin_page_title() ); ?></h1> |
@@ -22,27 +22,27 @@ discard block |
||
22 | 22 | |
23 | 23 | <?php |
24 | 24 | |
25 | - // Verify user permissions. |
|
26 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
25 | + // Verify user permissions. |
|
26 | + if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
27 | 27 | |
28 | - echo aui()->alert( |
|
29 | - array( |
|
30 | - 'type' => 'danger', |
|
31 | - 'content' => __( 'You are not permitted to view this page.', 'invoicing' ), |
|
32 | - ) |
|
33 | - ); |
|
28 | + echo aui()->alert( |
|
29 | + array( |
|
30 | + 'type' => 'danger', |
|
31 | + 'content' => __( 'You are not permitted to view this page.', 'invoicing' ), |
|
32 | + ) |
|
33 | + ); |
|
34 | 34 | |
35 | - } else if ( ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) ) { |
|
35 | + } else if ( ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) ) { |
|
36 | 36 | |
37 | - // Display a single subscription. |
|
38 | - wpinv_recurring_subscription_details(); |
|
39 | - } else { |
|
37 | + // Display a single subscription. |
|
38 | + wpinv_recurring_subscription_details(); |
|
39 | + } else { |
|
40 | 40 | |
41 | - // Display a list of available subscriptions. |
|
42 | - getpaid_print_subscriptions_list(); |
|
43 | - } |
|
41 | + // Display a list of available subscriptions. |
|
42 | + getpaid_print_subscriptions_list(); |
|
43 | + } |
|
44 | 44 | |
45 | - ?> |
|
45 | + ?> |
|
46 | 46 | |
47 | 47 | </div> |
48 | 48 | </div> |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function getpaid_print_subscriptions_list() { |
61 | 61 | |
62 | - $subscribers_table = new WPInv_Subscriptions_List_Table(); |
|
63 | - $subscribers_table->prepare_items(); |
|
62 | + $subscribers_table = new WPInv_Subscriptions_List_Table(); |
|
63 | + $subscribers_table->prepare_items(); |
|
64 | 64 | |
65 | - ?> |
|
65 | + ?> |
|
66 | 66 | <form id="subscribers-filter" class="bsui" method="get"> |
67 | 67 | <input type="hidden" name="page" value="wpinv-subscriptions" /> |
68 | 68 | <?php $subscribers_table->views(); ?> |
@@ -80,27 +80,27 @@ discard block |
||
80 | 80 | */ |
81 | 81 | function wpinv_recurring_subscription_details() { |
82 | 82 | |
83 | - // Fetch the subscription. |
|
84 | - $sub = new WPInv_Subscription( (int) $_GET['id'] ); |
|
85 | - if ( ! $sub->get_id() ) { |
|
83 | + // Fetch the subscription. |
|
84 | + $sub = new WPInv_Subscription( (int) $_GET['id'] ); |
|
85 | + if ( ! $sub->get_id() ) { |
|
86 | 86 | |
87 | - echo aui()->alert( |
|
88 | - array( |
|
89 | - 'type' => 'danger', |
|
90 | - 'content' => __( 'Subscription not found.', 'invoicing' ), |
|
91 | - ) |
|
92 | - ); |
|
87 | + echo aui()->alert( |
|
88 | + array( |
|
89 | + 'type' => 'danger', |
|
90 | + 'content' => __( 'Subscription not found.', 'invoicing' ), |
|
91 | + ) |
|
92 | + ); |
|
93 | 93 | |
94 | - return; |
|
95 | - } |
|
94 | + return; |
|
95 | + } |
|
96 | 96 | |
97 | - // Use metaboxes to display the subscription details. |
|
98 | - add_meta_box( 'getpaid_admin_subscription_details_metabox', __( 'Subscription Details', 'invoicing' ), 'getpaid_admin_subscription_details_metabox', get_current_screen(), 'normal' ); |
|
99 | - add_meta_box( 'getpaid_admin_subscription_update_metabox', __( 'Change Status', 'invoicing' ), 'getpaid_admin_subscription_update_metabox', get_current_screen(), 'side' ); |
|
100 | - add_meta_box( 'getpaid_admin_subscription_invoice_details_metabox', __( 'Invoices', 'invoicing' ), 'getpaid_admin_subscription_invoice_details_metabox', get_current_screen(), 'advanced' ); |
|
101 | - do_action( 'getpaid_admin_single_subscription_register_metabox', $sub ); |
|
97 | + // Use metaboxes to display the subscription details. |
|
98 | + add_meta_box( 'getpaid_admin_subscription_details_metabox', __( 'Subscription Details', 'invoicing' ), 'getpaid_admin_subscription_details_metabox', get_current_screen(), 'normal' ); |
|
99 | + add_meta_box( 'getpaid_admin_subscription_update_metabox', __( 'Change Status', 'invoicing' ), 'getpaid_admin_subscription_update_metabox', get_current_screen(), 'side' ); |
|
100 | + add_meta_box( 'getpaid_admin_subscription_invoice_details_metabox', __( 'Invoices', 'invoicing' ), 'getpaid_admin_subscription_invoice_details_metabox', get_current_screen(), 'advanced' ); |
|
101 | + do_action( 'getpaid_admin_single_subscription_register_metabox', $sub ); |
|
102 | 102 | |
103 | - ?> |
|
103 | + ?> |
|
104 | 104 | |
105 | 105 | <form method="post" action="<?php echo admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $sub->get_id() ) ); ?>"> |
106 | 106 | |
@@ -140,41 +140,41 @@ discard block |
||
140 | 140 | */ |
141 | 141 | function getpaid_admin_subscription_details_metabox( $sub ) { |
142 | 142 | |
143 | - // Prepare subscription detail columns. |
|
144 | - $fields = apply_filters( |
|
145 | - 'getpaid_subscription_admin_page_fields', |
|
146 | - array( |
|
147 | - 'subscription' => __( 'Subscription', 'invoicing' ), |
|
148 | - 'customer' => __( 'Customer', 'invoicing' ), |
|
149 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
150 | - 'start_date' => __( 'Start Date', 'invoicing' ), |
|
151 | - 'renews_on' => __( 'Next Payment', 'invoicing' ), |
|
152 | - 'renewals' => __( 'Payments', 'invoicing' ), |
|
153 | - 'item' => __( 'Item', 'invoicing' ), |
|
154 | - 'gateway' => __( 'Payment Method', 'invoicing' ), |
|
155 | - 'profile_id' => __( 'Profile ID', 'invoicing' ), |
|
156 | - 'status' => __( 'Status', 'invoicing' ), |
|
157 | - ) |
|
158 | - ); |
|
159 | - |
|
160 | - if ( ! $sub->is_active() ) { |
|
161 | - |
|
162 | - if ( isset( $fields['renews_on'] ) ) { |
|
163 | - unset( $fields['renews_on'] ); |
|
164 | - } |
|
165 | - |
|
166 | - if ( isset( $fields['gateway'] ) ) { |
|
167 | - unset( $fields['gateway'] ); |
|
168 | - } |
|
143 | + // Prepare subscription detail columns. |
|
144 | + $fields = apply_filters( |
|
145 | + 'getpaid_subscription_admin_page_fields', |
|
146 | + array( |
|
147 | + 'subscription' => __( 'Subscription', 'invoicing' ), |
|
148 | + 'customer' => __( 'Customer', 'invoicing' ), |
|
149 | + 'amount' => __( 'Amount', 'invoicing' ), |
|
150 | + 'start_date' => __( 'Start Date', 'invoicing' ), |
|
151 | + 'renews_on' => __( 'Next Payment', 'invoicing' ), |
|
152 | + 'renewals' => __( 'Payments', 'invoicing' ), |
|
153 | + 'item' => __( 'Item', 'invoicing' ), |
|
154 | + 'gateway' => __( 'Payment Method', 'invoicing' ), |
|
155 | + 'profile_id' => __( 'Profile ID', 'invoicing' ), |
|
156 | + 'status' => __( 'Status', 'invoicing' ), |
|
157 | + ) |
|
158 | + ); |
|
159 | + |
|
160 | + if ( ! $sub->is_active() ) { |
|
161 | + |
|
162 | + if ( isset( $fields['renews_on'] ) ) { |
|
163 | + unset( $fields['renews_on'] ); |
|
164 | + } |
|
165 | + |
|
166 | + if ( isset( $fields['gateway'] ) ) { |
|
167 | + unset( $fields['gateway'] ); |
|
168 | + } |
|
169 | 169 | |
170 | - } |
|
170 | + } |
|
171 | 171 | |
172 | - $profile_id = $sub->get_profile_id(); |
|
173 | - if ( empty( $profile_id ) && isset( $fields['profile_id'] ) ) { |
|
174 | - unset( $fields['profile_id'] ); |
|
175 | - } |
|
172 | + $profile_id = $sub->get_profile_id(); |
|
173 | + if ( empty( $profile_id ) && isset( $fields['profile_id'] ) ) { |
|
174 | + unset( $fields['profile_id'] ); |
|
175 | + } |
|
176 | 176 | |
177 | - ?> |
|
177 | + ?> |
|
178 | 178 | |
179 | 179 | <table class="table table-borderless" style="font-size: 14px;"> |
180 | 180 | <tbody> |
@@ -208,20 +208,20 @@ discard block |
||
208 | 208 | */ |
209 | 209 | function getpaid_admin_subscription_metabox_display_customer( $subscription ) { |
210 | 210 | |
211 | - $username = __( '(Missing User)', 'invoicing' ); |
|
211 | + $username = __( '(Missing User)', 'invoicing' ); |
|
212 | 212 | |
213 | - $user = get_userdata( $subscription->get_customer_id() ); |
|
214 | - if ( $user ) { |
|
213 | + $user = get_userdata( $subscription->get_customer_id() ); |
|
214 | + if ( $user ) { |
|
215 | 215 | |
216 | - $username = sprintf( |
|
217 | - '<a href="user-edit.php?user_id=%s">%s</a>', |
|
218 | - absint( $user->ID ), |
|
219 | - ! empty( $user->display_name ) ? sanitize_text_field( $user->display_name ) : sanitize_email( $user->user_email ) |
|
220 | - ); |
|
216 | + $username = sprintf( |
|
217 | + '<a href="user-edit.php?user_id=%s">%s</a>', |
|
218 | + absint( $user->ID ), |
|
219 | + ! empty( $user->display_name ) ? sanitize_text_field( $user->display_name ) : sanitize_email( $user->user_email ) |
|
220 | + ); |
|
221 | 221 | |
222 | - } |
|
222 | + } |
|
223 | 223 | |
224 | - echo $username; |
|
224 | + echo $username; |
|
225 | 225 | } |
226 | 226 | add_action( 'getpaid_subscription_admin_display_customer', 'getpaid_admin_subscription_metabox_display_customer' ); |
227 | 227 | |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | * @param WPInv_Subscription $subscription |
232 | 232 | */ |
233 | 233 | function getpaid_admin_subscription_metabox_display_amount( $subscription ) { |
234 | - $amount = sanitize_text_field( getpaid_get_formatted_subscription_amount( $subscription ) ); |
|
235 | - echo "<span>$amount</span>"; |
|
234 | + $amount = sanitize_text_field( getpaid_get_formatted_subscription_amount( $subscription ) ); |
|
235 | + echo "<span>$amount</span>"; |
|
236 | 236 | } |
237 | 237 | add_action( 'getpaid_subscription_admin_display_amount', 'getpaid_admin_subscription_metabox_display_amount' ); |
238 | 238 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param WPInv_Subscription $subscription |
243 | 243 | */ |
244 | 244 | function getpaid_admin_subscription_metabox_display_id( $subscription ) { |
245 | - echo '#' . absint( $subscription->get_id() ); |
|
245 | + echo '#' . absint( $subscription->get_id() ); |
|
246 | 246 | } |
247 | 247 | add_action( 'getpaid_subscription_admin_display_subscription', 'getpaid_admin_subscription_metabox_display_id' ); |
248 | 248 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @param WPInv_Subscription $subscription |
253 | 253 | */ |
254 | 254 | function getpaid_admin_subscription_metabox_display_start_date( $subscription ) { |
255 | - echo getpaid_format_date_value( $subscription->get_date_created() ); |
|
255 | + echo getpaid_format_date_value( $subscription->get_date_created() ); |
|
256 | 256 | } |
257 | 257 | add_action( 'getpaid_subscription_admin_display_start_date', 'getpaid_admin_subscription_metabox_display_start_date' ); |
258 | 258 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @param WPInv_Subscription $subscription |
263 | 263 | */ |
264 | 264 | function getpaid_admin_subscription_metabox_display_renews_on( $subscription ) { |
265 | - echo getpaid_format_date_value( $subscription->get_expiration() ); |
|
265 | + echo getpaid_format_date_value( $subscription->get_expiration() ); |
|
266 | 266 | } |
267 | 267 | add_action( 'getpaid_subscription_admin_display_renews_on', 'getpaid_admin_subscription_metabox_display_renews_on' ); |
268 | 268 | |
@@ -272,8 +272,8 @@ discard block |
||
272 | 272 | * @param WPInv_Subscription $subscription |
273 | 273 | */ |
274 | 274 | function getpaid_admin_subscription_metabox_display_renewals( $subscription ) { |
275 | - $max_bills = $subscription->get_bill_times(); |
|
276 | - echo $subscription->get_times_billed() . ' / ' . ( empty( $max_bills ) ? "∞" : $max_bills ); |
|
275 | + $max_bills = $subscription->get_bill_times(); |
|
276 | + echo $subscription->get_times_billed() . ' / ' . ( empty( $max_bills ) ? "∞" : $max_bills ); |
|
277 | 277 | } |
278 | 278 | add_action( 'getpaid_subscription_admin_display_renewals', 'getpaid_admin_subscription_metabox_display_renewals' ); |
279 | 279 | /** |
@@ -283,16 +283,16 @@ discard block |
||
283 | 283 | */ |
284 | 284 | function getpaid_admin_subscription_metabox_display_item( $subscription ) { |
285 | 285 | |
286 | - $item = get_post( $subscription->get_product_id() ); |
|
286 | + $item = get_post( $subscription->get_product_id() ); |
|
287 | 287 | |
288 | - if ( ! empty( $item ) ) { |
|
289 | - $link = get_edit_post_link( $item ); |
|
290 | - $link = esc_url( $link ); |
|
291 | - $name = esc_html( get_the_title( $item ) ); |
|
292 | - echo "<a href='$link'>$name</a>"; |
|
293 | - } else { |
|
294 | - echo sprintf( __( 'Item #%s', 'invoicing' ), $subscription->get_product_id() ); |
|
295 | - } |
|
288 | + if ( ! empty( $item ) ) { |
|
289 | + $link = get_edit_post_link( $item ); |
|
290 | + $link = esc_url( $link ); |
|
291 | + $name = esc_html( get_the_title( $item ) ); |
|
292 | + echo "<a href='$link'>$name</a>"; |
|
293 | + } else { |
|
294 | + echo sprintf( __( 'Item #%s', 'invoicing' ), $subscription->get_product_id() ); |
|
295 | + } |
|
296 | 296 | |
297 | 297 | } |
298 | 298 | add_action( 'getpaid_subscription_admin_display_item', 'getpaid_admin_subscription_metabox_display_item' ); |
@@ -304,13 +304,13 @@ discard block |
||
304 | 304 | */ |
305 | 305 | function getpaid_admin_subscription_metabox_display_gateway( $subscription ) { |
306 | 306 | |
307 | - $gateway = $subscription->get_gateway(); |
|
307 | + $gateway = $subscription->get_gateway(); |
|
308 | 308 | |
309 | - if ( ! empty( $gateway ) ) { |
|
310 | - echo sanitize_text_field( wpinv_get_gateway_admin_label( $gateway ) ); |
|
311 | - } else { |
|
312 | - echo "—"; |
|
313 | - } |
|
309 | + if ( ! empty( $gateway ) ) { |
|
310 | + echo sanitize_text_field( wpinv_get_gateway_admin_label( $gateway ) ); |
|
311 | + } else { |
|
312 | + echo "—"; |
|
313 | + } |
|
314 | 314 | |
315 | 315 | } |
316 | 316 | add_action( 'getpaid_subscription_admin_display_gateway', 'getpaid_admin_subscription_metabox_display_gateway' ); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @param WPInv_Subscription $subscription |
322 | 322 | */ |
323 | 323 | function getpaid_admin_subscription_metabox_display_status( $subscription ) { |
324 | - echo $subscription->get_status_label_html(); |
|
324 | + echo $subscription->get_status_label_html(); |
|
325 | 325 | } |
326 | 326 | add_action( 'getpaid_subscription_admin_display_status', 'getpaid_admin_subscription_metabox_display_status' ); |
327 | 327 | |
@@ -332,14 +332,14 @@ discard block |
||
332 | 332 | */ |
333 | 333 | function getpaid_admin_subscription_metabox_display_profile_id( $subscription ) { |
334 | 334 | |
335 | - $profile_id = $subscription->get_profile_id(); |
|
335 | + $profile_id = $subscription->get_profile_id(); |
|
336 | 336 | |
337 | - if ( ! empty( $profile_id ) ) { |
|
338 | - $profile_id = sanitize_text_field( $profile_id ); |
|
339 | - echo apply_filters( 'getpaid_subscription_profile_id_display', $profile_id, $subscription ); |
|
340 | - } else { |
|
341 | - echo "—"; |
|
342 | - } |
|
337 | + if ( ! empty( $profile_id ) ) { |
|
338 | + $profile_id = sanitize_text_field( $profile_id ); |
|
339 | + echo apply_filters( 'getpaid_subscription_profile_id_display', $profile_id, $subscription ); |
|
340 | + } else { |
|
341 | + echo "—"; |
|
342 | + } |
|
343 | 343 | |
344 | 344 | } |
345 | 345 | add_action( 'getpaid_subscription_admin_display_profile_id', 'getpaid_admin_subscription_metabox_display_profile_id' ); |
@@ -351,39 +351,39 @@ discard block |
||
351 | 351 | */ |
352 | 352 | function getpaid_admin_subscription_update_metabox( $subscription ) { |
353 | 353 | |
354 | - ?> |
|
354 | + ?> |
|
355 | 355 | <div class="mt-3"> |
356 | 356 | |
357 | 357 | <?php |
358 | - echo aui()->select( |
|
359 | - array( |
|
360 | - 'options' => getpaid_get_subscription_statuses(), |
|
361 | - 'name' => 'subscription_status', |
|
362 | - 'id' => 'subscription_status_update_select', |
|
363 | - 'required' => true, |
|
364 | - 'no_wrap' => false, |
|
365 | - 'label' => __( 'Subscription Status', 'invoicing' ), |
|
366 | - 'help_text' => __( 'Updating the status will trigger related actions and hooks', 'invoicing' ), |
|
367 | - 'select2' => true, |
|
368 | - 'value' => $subscription->get_status( 'edit' ), |
|
369 | - ) |
|
370 | - ); |
|
371 | - ?> |
|
358 | + echo aui()->select( |
|
359 | + array( |
|
360 | + 'options' => getpaid_get_subscription_statuses(), |
|
361 | + 'name' => 'subscription_status', |
|
362 | + 'id' => 'subscription_status_update_select', |
|
363 | + 'required' => true, |
|
364 | + 'no_wrap' => false, |
|
365 | + 'label' => __( 'Subscription Status', 'invoicing' ), |
|
366 | + 'help_text' => __( 'Updating the status will trigger related actions and hooks', 'invoicing' ), |
|
367 | + 'select2' => true, |
|
368 | + 'value' => $subscription->get_status( 'edit' ), |
|
369 | + ) |
|
370 | + ); |
|
371 | + ?> |
|
372 | 372 | |
373 | 373 | <div class="mt-2 px-3 py-2 bg-light border-top" style="margin: -12px;"> |
374 | 374 | |
375 | 375 | <?php |
376 | - submit_button( __( 'Update', 'invoicing' ), 'primary', 'submit', false ); |
|
376 | + submit_button( __( 'Update', 'invoicing' ), 'primary', 'submit', false ); |
|
377 | 377 | |
378 | - $url = esc_url( wp_nonce_url( add_query_arg( 'getpaid-admin-action', 'subscription_manual_renew' ), 'getpaid-nonce', 'getpaid-nonce' ) ); |
|
379 | - $anchor = __( 'Renew Subscription', 'invoicing' ); |
|
380 | - $title = esc_attr__( 'Are you sure you want to extend the subscription and generate a new invoice that will be automatically marked as paid?', 'invoicing' ); |
|
378 | + $url = esc_url( wp_nonce_url( add_query_arg( 'getpaid-admin-action', 'subscription_manual_renew' ), 'getpaid-nonce', 'getpaid-nonce' ) ); |
|
379 | + $anchor = __( 'Renew Subscription', 'invoicing' ); |
|
380 | + $title = esc_attr__( 'Are you sure you want to extend the subscription and generate a new invoice that will be automatically marked as paid?', 'invoicing' ); |
|
381 | 381 | |
382 | - if ( $subscription->is_active() ) { |
|
383 | - echo "<a href='$url' class='float-right text-muted' onclick='return confirm(\"$title\")'>$anchor</a>"; |
|
384 | - } |
|
382 | + if ( $subscription->is_active() ) { |
|
383 | + echo "<a href='$url' class='float-right text-muted' onclick='return confirm(\"$title\")'>$anchor</a>"; |
|
384 | + } |
|
385 | 385 | |
386 | - echo '</div></div>'; |
|
386 | + echo '</div></div>'; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -393,33 +393,33 @@ discard block |
||
393 | 393 | */ |
394 | 394 | function getpaid_admin_subscription_invoice_details_metabox( $subscription ) { |
395 | 395 | |
396 | - $columns = apply_filters( |
|
397 | - 'getpaid_subscription_related_invoices_columns', |
|
398 | - array( |
|
399 | - 'invoice' => __( 'Invoice', 'invoicing' ), |
|
400 | - 'relationship' => __( 'Relationship', 'invoicing' ), |
|
401 | - 'date' => __( 'Date', 'invoicing' ), |
|
402 | - 'status' => __( 'Status', 'invoicing' ), |
|
403 | - 'total' => __( 'Total', 'invoicing' ), |
|
404 | - ), |
|
405 | - $subscription |
|
406 | - ); |
|
407 | - |
|
408 | - // Prepare the invoices. |
|
409 | - $payments = $subscription->get_child_payments(); |
|
410 | - $parent = $subscription->get_parent_invoice(); |
|
411 | - |
|
412 | - if ( $parent->get_id() ) { |
|
413 | - $payments = array_merge( array( $parent ), $payments ); |
|
414 | - } |
|
396 | + $columns = apply_filters( |
|
397 | + 'getpaid_subscription_related_invoices_columns', |
|
398 | + array( |
|
399 | + 'invoice' => __( 'Invoice', 'invoicing' ), |
|
400 | + 'relationship' => __( 'Relationship', 'invoicing' ), |
|
401 | + 'date' => __( 'Date', 'invoicing' ), |
|
402 | + 'status' => __( 'Status', 'invoicing' ), |
|
403 | + 'total' => __( 'Total', 'invoicing' ), |
|
404 | + ), |
|
405 | + $subscription |
|
406 | + ); |
|
407 | + |
|
408 | + // Prepare the invoices. |
|
409 | + $payments = $subscription->get_child_payments(); |
|
410 | + $parent = $subscription->get_parent_invoice(); |
|
411 | + |
|
412 | + if ( $parent->get_id() ) { |
|
413 | + $payments = array_merge( array( $parent ), $payments ); |
|
414 | + } |
|
415 | 415 | |
416 | - $table_class = 'w-100 bg-white'; |
|
416 | + $table_class = 'w-100 bg-white'; |
|
417 | 417 | |
418 | - if ( ! is_admin() ) { |
|
419 | - $table_class = 'table table-bordered table-striped'; |
|
420 | - } |
|
418 | + if ( ! is_admin() ) { |
|
419 | + $table_class = 'table table-bordered table-striped'; |
|
420 | + } |
|
421 | 421 | |
422 | - ?> |
|
422 | + ?> |
|
423 | 423 | <div class="m-0" style="overflow: auto;"> |
424 | 424 | |
425 | 425 | <table class="<?php echo $table_class; ?>"> |
@@ -427,13 +427,13 @@ discard block |
||
427 | 427 | <thead> |
428 | 428 | <tr> |
429 | 429 | <?php |
430 | - foreach ( $columns as $key => $label ) { |
|
431 | - $key = esc_attr( $key ); |
|
432 | - $label = sanitize_text_field( $label ); |
|
430 | + foreach ( $columns as $key => $label ) { |
|
431 | + $key = esc_attr( $key ); |
|
432 | + $label = sanitize_text_field( $label ); |
|
433 | 433 | |
434 | - echo "<th class='subscription-invoice-field-$key bg-light p-2 text-left color-dark'>$label</th>"; |
|
435 | - } |
|
436 | - ?> |
|
434 | + echo "<th class='subscription-invoice-field-$key bg-light p-2 text-left color-dark'>$label</th>"; |
|
435 | + } |
|
436 | + ?> |
|
437 | 437 | </tr> |
438 | 438 | </thead> |
439 | 439 | |
@@ -449,66 +449,66 @@ discard block |
||
449 | 449 | |
450 | 450 | <?php |
451 | 451 | |
452 | - foreach( $payments as $payment ) : |
|
452 | + foreach( $payments as $payment ) : |
|
453 | 453 | |
454 | - // Ensure that we have an invoice. |
|
455 | - $payment = new WPInv_Invoice( $payment ); |
|
454 | + // Ensure that we have an invoice. |
|
455 | + $payment = new WPInv_Invoice( $payment ); |
|
456 | 456 | |
457 | - // Abort if the invoice is invalid. |
|
458 | - if ( ! $payment->get_id() ) { |
|
459 | - continue; |
|
460 | - } |
|
457 | + // Abort if the invoice is invalid. |
|
458 | + if ( ! $payment->get_id() ) { |
|
459 | + continue; |
|
460 | + } |
|
461 | 461 | |
462 | - echo '<tr>'; |
|
462 | + echo '<tr>'; |
|
463 | 463 | |
464 | - foreach ( array_keys( $columns ) as $key ) { |
|
464 | + foreach ( array_keys( $columns ) as $key ) { |
|
465 | 465 | |
466 | - echo '<td class="p-2 text-left">'; |
|
466 | + echo '<td class="p-2 text-left">'; |
|
467 | 467 | |
468 | - switch( $key ) { |
|
468 | + switch( $key ) { |
|
469 | 469 | |
470 | - case 'total': |
|
471 | - echo '<strong>' . wpinv_price( wpinv_format_amount( wpinv_sanitize_amount( $payment->get_total() ) ), $payment->get_currency() ) . '</strong>'; |
|
472 | - break; |
|
470 | + case 'total': |
|
471 | + echo '<strong>' . wpinv_price( wpinv_format_amount( wpinv_sanitize_amount( $payment->get_total() ) ), $payment->get_currency() ) . '</strong>'; |
|
472 | + break; |
|
473 | 473 | |
474 | - case 'relationship': |
|
475 | - echo $payment->is_renewal() ? __( 'Renewal Invoice', 'invoicing' ) : __( 'Initial Invoice', 'invoicing' ); |
|
476 | - break; |
|
474 | + case 'relationship': |
|
475 | + echo $payment->is_renewal() ? __( 'Renewal Invoice', 'invoicing' ) : __( 'Initial Invoice', 'invoicing' ); |
|
476 | + break; |
|
477 | 477 | |
478 | - case 'date': |
|
479 | - echo getpaid_format_date_value( $payment->get_date_created() ); |
|
480 | - break; |
|
478 | + case 'date': |
|
479 | + echo getpaid_format_date_value( $payment->get_date_created() ); |
|
480 | + break; |
|
481 | 481 | |
482 | - case 'status': |
|
482 | + case 'status': |
|
483 | 483 | |
484 | - $status = $payment->get_status_nicename(); |
|
485 | - if ( is_admin() ) { |
|
486 | - $status = $payment->get_status_label_html(); |
|
487 | - } |
|
484 | + $status = $payment->get_status_nicename(); |
|
485 | + if ( is_admin() ) { |
|
486 | + $status = $payment->get_status_label_html(); |
|
487 | + } |
|
488 | 488 | |
489 | - echo $status; |
|
490 | - break; |
|
489 | + echo $status; |
|
490 | + break; |
|
491 | 491 | |
492 | - case 'invoice': |
|
493 | - $link = esc_url( get_edit_post_link( $payment->get_id() ) ); |
|
492 | + case 'invoice': |
|
493 | + $link = esc_url( get_edit_post_link( $payment->get_id() ) ); |
|
494 | 494 | |
495 | - if ( ! is_admin() ) { |
|
496 | - $link = esc_url( $payment->get_view_url() ); |
|
497 | - } |
|
495 | + if ( ! is_admin() ) { |
|
496 | + $link = esc_url( $payment->get_view_url() ); |
|
497 | + } |
|
498 | 498 | |
499 | - $invoice = sanitize_text_field( $payment->get_number() ); |
|
500 | - echo "<a href='$link'>$invoice</a>"; |
|
501 | - break; |
|
502 | - } |
|
499 | + $invoice = sanitize_text_field( $payment->get_number() ); |
|
500 | + echo "<a href='$link'>$invoice</a>"; |
|
501 | + break; |
|
502 | + } |
|
503 | 503 | |
504 | - echo '</td>'; |
|
504 | + echo '</td>'; |
|
505 | 505 | |
506 | - } |
|
506 | + } |
|
507 | 507 | |
508 | - echo '</tr>'; |
|
508 | + echo '</tr>'; |
|
509 | 509 | |
510 | - endforeach; |
|
511 | - ?> |
|
510 | + endforeach; |
|
511 | + ?> |
|
512 | 512 | |
513 | 513 | </tbody> |
514 | 514 |