@@ -20,35 +20,35 @@ |
||
20 | 20 | |
21 | 21 | switch ( $column ) : |
22 | 22 | |
23 | - case 'subscription': |
|
24 | - $subscription_id = (int) $subscription->get_id(); |
|
25 | - $url = esc_url( $subscription->get_view_url() ); |
|
26 | - $id_label = sprintf( |
|
27 | - esc_attr_x( '#%s', 'subscription id', 'invoicing' ), |
|
28 | - (int) $subscription->get_id() |
|
29 | - ); |
|
30 | - echo wp_kses_post( $widget->add_row_actions( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription ) ); |
|
31 | - break; |
|
32 | - |
|
33 | - case 'status': |
|
34 | - echo esc_html( $subscription->get_status_label() ); |
|
35 | - break; |
|
36 | - |
|
37 | - case 'renewal-date': |
|
38 | - $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() ); |
|
39 | - echo $subscription->is_active() ? esc_html( $renewal ) : '—'; |
|
40 | - break; |
|
41 | - |
|
42 | - case 'amount': |
|
43 | - $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
44 | - $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
45 | - echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" ); |
|
46 | - break; |
|
47 | - |
|
48 | - endswitch; |
|
49 | - |
|
50 | - do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription ); |
|
51 | - |
|
52 | - echo '</td>'; |
|
53 | - |
|
54 | -endforeach; |
|
23 | + case 'subscription': |
|
24 | + $subscription_id = (int) $subscription->get_id(); |
|
25 | + $url = esc_url( $subscription->get_view_url() ); |
|
26 | + $id_label = sprintf( |
|
27 | + esc_attr_x( '#%s', 'subscription id', 'invoicing' ), |
|
28 | + (int) $subscription->get_id() |
|
29 | + ); |
|
30 | + echo wp_kses_post( $widget->add_row_actions( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription ) ); |
|
31 | + break; |
|
32 | + |
|
33 | + case 'status': |
|
34 | + echo esc_html( $subscription->get_status_label() ); |
|
35 | + break; |
|
36 | + |
|
37 | + case 'renewal-date': |
|
38 | + $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() ); |
|
39 | + echo $subscription->is_active() ? esc_html( $renewal ) : '—'; |
|
40 | + break; |
|
41 | + |
|
42 | + case 'amount': |
|
43 | + $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
44 | + $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
45 | + echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" ); |
|
46 | + break; |
|
47 | + |
|
48 | + endswitch; |
|
49 | + |
|
50 | + do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription ); |
|
51 | + |
|
52 | + echo '</td>'; |
|
53 | + |
|
54 | + endforeach; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * Template that prints a single subscription's details |
@@ -10,19 +10,19 @@ discard block |
||
10 | 10 | * @var WPInv_Subscriptions_Widget $widget |
11 | 11 | */ |
12 | 12 | |
13 | -defined( 'ABSPATH' ) || exit; |
|
13 | + defined( 'ABSPATH' ) || exit; |
|
14 | 14 | |
15 | -do_action( 'getpaid_single_subscription_before_notices', $subscription ); |
|
15 | + do_action( 'getpaid_single_subscription_before_notices', $subscription ); |
|
16 | 16 | |
17 | -// Display errors and notices. |
|
18 | -wpinv_print_errors(); |
|
17 | + // Display errors and notices. |
|
18 | + wpinv_print_errors(); |
|
19 | 19 | |
20 | -$subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_invoice_id() ); |
|
21 | -$subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() ); |
|
20 | + $subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_invoice_id() ); |
|
21 | + $subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() ); |
|
22 | 22 | |
23 | -do_action( 'getpaid_before_single_subscription', $subscription, $subscription_groups ); |
|
23 | + do_action( 'getpaid_before_single_subscription', $subscription, $subscription_groups ); |
|
24 | 24 | |
25 | -?> |
|
25 | + ?> |
|
26 | 26 | |
27 | 27 | <h2 class="mb-1 h4"><?php esc_html_e( 'Subscription Details', 'invoicing' ); ?></h2> |
28 | 28 | <table class="table table-bordered"> |
@@ -39,59 +39,59 @@ discard block |
||
39 | 39 | <td style="width: 65%"> |
40 | 40 | <?php |
41 | 41 | |
42 | - switch ( $key ) { |
|
42 | + switch ( $key ) { |
|
43 | 43 | |
44 | - case 'status': |
|
45 | - echo esc_html( $subscription->get_status_label() ); |
|
46 | - break; |
|
44 | + case 'status': |
|
45 | + echo esc_html( $subscription->get_status_label() ); |
|
46 | + break; |
|
47 | 47 | |
48 | - case 'start_date': |
|
49 | - echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
50 | - break; |
|
48 | + case 'start_date': |
|
49 | + echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
50 | + break; |
|
51 | 51 | |
52 | - case 'expiry_date': |
|
53 | - echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) ); |
|
54 | - break; |
|
52 | + case 'expiry_date': |
|
53 | + echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) ); |
|
54 | + break; |
|
55 | 55 | |
56 | - case 'initial_amount': |
|
57 | - echo wp_kses_post( wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ) ); |
|
56 | + case 'initial_amount': |
|
57 | + echo wp_kses_post( wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ) ); |
|
58 | 58 | |
59 | - if ( $subscription->has_trial_period() ) { |
|
59 | + if ( $subscription->has_trial_period() ) { |
|
60 | 60 | |
61 | - echo "<small class='text-muted'> "; |
|
62 | - printf( |
|
63 | - esc_html_x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
64 | - esc_html( $subscription->get_trial_period() ) |
|
65 | - ); |
|
66 | - echo '</small>'; |
|
61 | + echo "<small class='text-muted'> "; |
|
62 | + printf( |
|
63 | + esc_html_x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
64 | + esc_html( $subscription->get_trial_period() ) |
|
65 | + ); |
|
66 | + echo '</small>'; |
|
67 | 67 | |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | - break; |
|
70 | + break; |
|
71 | 71 | |
72 | - case 'recurring_amount': |
|
73 | - $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
74 | - $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
75 | - echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) ); |
|
76 | - break; |
|
72 | + case 'recurring_amount': |
|
73 | + $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
74 | + $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
75 | + echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) ); |
|
76 | + break; |
|
77 | 77 | |
78 | - case 'item': |
|
79 | - if ( empty( $subscription_group ) ) { |
|
80 | - echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
81 | - } else { |
|
82 | - $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
83 | - echo wp_kses_post( implode( ' | ', $markup ) ); |
|
84 | - } |
|
78 | + case 'item': |
|
79 | + if ( empty( $subscription_group ) ) { |
|
80 | + echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
81 | + } else { |
|
82 | + $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
83 | + echo wp_kses_post( implode( ' | ', $markup ) ); |
|
84 | + } |
|
85 | 85 | |
86 | - break; |
|
86 | + break; |
|
87 | 87 | |
88 | - case 'payments': |
|
89 | - $max_activations = (int) $subscription->get_bill_times(); |
|
90 | - echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '∞' : (int) $max_activations ); |
|
88 | + case 'payments': |
|
89 | + $max_activations = (int) $subscription->get_bill_times(); |
|
90 | + echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '∞' : (int) $max_activations ); |
|
91 | 91 | |
92 | - break; |
|
92 | + break; |
|
93 | 93 | |
94 | - } |
|
94 | + } |
|
95 | 95 | do_action( "getpaid_render_single_subscription_column_$key", $subscription ); |
96 | 96 | |
97 | 97 | ?> |
@@ -577,40 +577,40 @@ discard block |
||
577 | 577 | |
578 | 578 | switch ( $key ) { |
579 | 579 | |
580 | - case 'total': |
|
581 | - echo '<strong>'; |
|
582 | - wpinv_the_price( $payment->get_total(), $payment->get_currency() ); |
|
583 | - echo '</strong>'; |
|
584 | - break; |
|
585 | - |
|
586 | - case 'relationship': |
|
587 | - echo $payment->is_renewal() ? esc_html__( 'Renewal Invoice', 'invoicing' ) : esc_html__( 'Initial Invoice', 'invoicing' ); |
|
588 | - break; |
|
589 | - |
|
590 | - case 'date': |
|
591 | - echo esc_html( getpaid_format_date_value( $payment->get_date_created() ) ); |
|
592 | - break; |
|
593 | - |
|
594 | - case 'status': |
|
595 | - $status = $payment->get_status_nicename(); |
|
596 | - if ( is_admin() ) { |
|
597 | - $status = $payment->get_status_label_html(); |
|
598 | - } |
|
599 | - |
|
600 | - echo wp_kses_post( $status ); |
|
601 | - break; |
|
602 | - |
|
603 | - case 'invoice': |
|
604 | - if ( ! is_admin() ) { |
|
605 | - $link = $payment->get_view_url(); |
|
606 | - } else { |
|
607 | - $link = get_edit_post_link( $payment->get_id() ); |
|
608 | - } |
|
609 | - |
|
610 | - $invoice = esc_html( $payment->get_number() ); |
|
611 | - |
|
612 | - echo wp_kses_post( "<a href='" . ( $link ? esc_url( $link ) : '#' ) . "'>$invoice</a>" ); |
|
613 | - break; |
|
580 | + case 'total': |
|
581 | + echo '<strong>'; |
|
582 | + wpinv_the_price( $payment->get_total(), $payment->get_currency() ); |
|
583 | + echo '</strong>'; |
|
584 | + break; |
|
585 | + |
|
586 | + case 'relationship': |
|
587 | + echo $payment->is_renewal() ? esc_html__( 'Renewal Invoice', 'invoicing' ) : esc_html__( 'Initial Invoice', 'invoicing' ); |
|
588 | + break; |
|
589 | + |
|
590 | + case 'date': |
|
591 | + echo esc_html( getpaid_format_date_value( $payment->get_date_created() ) ); |
|
592 | + break; |
|
593 | + |
|
594 | + case 'status': |
|
595 | + $status = $payment->get_status_nicename(); |
|
596 | + if ( is_admin() ) { |
|
597 | + $status = $payment->get_status_label_html(); |
|
598 | + } |
|
599 | + |
|
600 | + echo wp_kses_post( $status ); |
|
601 | + break; |
|
602 | + |
|
603 | + case 'invoice': |
|
604 | + if ( ! is_admin() ) { |
|
605 | + $link = $payment->get_view_url(); |
|
606 | + } else { |
|
607 | + $link = get_edit_post_link( $payment->get_id() ); |
|
608 | + } |
|
609 | + |
|
610 | + $invoice = esc_html( $payment->get_number() ); |
|
611 | + |
|
612 | + echo wp_kses_post( "<a href='" . ( $link ? esc_url( $link ) : '#' ) . "'>$invoice</a>" ); |
|
613 | + break; |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | echo '</td>'; |
@@ -705,37 +705,37 @@ discard block |
||
705 | 705 | |
706 | 706 | switch ( $key ) { |
707 | 707 | |
708 | - case 'item_name': |
|
709 | - $item_name = get_the_title( $subscription_group_item['item_id'] ); |
|
710 | - $item_name = empty( $item_name ) ? $subscription_group_item['item_name'] : $item_name; |
|
708 | + case 'item_name': |
|
709 | + $item_name = get_the_title( $subscription_group_item['item_id'] ); |
|
710 | + $item_name = empty( $item_name ) ? $subscription_group_item['item_name'] : $item_name; |
|
711 | 711 | |
712 | - if ( $invoice->get_template() == 'amount' || 1 == (float) $subscription_group_item['quantity'] ) { |
|
713 | - echo esc_html( $item_name ); |
|
714 | - } else { |
|
715 | - printf( '%1$s x %2$d', esc_html( $item_name ), (float) $subscription_group_item['quantity'] ); |
|
716 | - } |
|
712 | + if ( $invoice->get_template() == 'amount' || 1 == (float) $subscription_group_item['quantity'] ) { |
|
713 | + echo esc_html( $item_name ); |
|
714 | + } else { |
|
715 | + printf( '%1$s x %2$d', esc_html( $item_name ), (float) $subscription_group_item['quantity'] ); |
|
716 | + } |
|
717 | 717 | |
718 | - break; |
|
718 | + break; |
|
719 | 719 | |
720 | - case 'price': |
|
721 | - wpinv_the_price( $subscription_group_item['item_price'], $invoice->get_currency() ); |
|
722 | - break; |
|
720 | + case 'price': |
|
721 | + wpinv_the_price( $subscription_group_item['item_price'], $invoice->get_currency() ); |
|
722 | + break; |
|
723 | 723 | |
724 | - case 'tax': |
|
725 | - wpinv_the_price( $subscription_group_item['tax'], $invoice->get_currency() ); |
|
726 | - break; |
|
724 | + case 'tax': |
|
725 | + wpinv_the_price( $subscription_group_item['tax'], $invoice->get_currency() ); |
|
726 | + break; |
|
727 | 727 | |
728 | - case 'discount': |
|
729 | - wpinv_the_price( $subscription_group_item['discount'], $invoice->get_currency() ); |
|
730 | - break; |
|
728 | + case 'discount': |
|
729 | + wpinv_the_price( $subscription_group_item['discount'], $invoice->get_currency() ); |
|
730 | + break; |
|
731 | 731 | |
732 | - case 'initial': |
|
733 | - wpinv_the_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ); |
|
734 | - break; |
|
732 | + case 'initial': |
|
733 | + wpinv_the_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ); |
|
734 | + break; |
|
735 | 735 | |
736 | - case 'recurring': |
|
737 | - echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ) . '</strong>' ); |
|
738 | - break; |
|
736 | + case 'recurring': |
|
737 | + echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ) . '</strong>' ); |
|
738 | + break; |
|
739 | 739 | |
740 | 740 | } |
741 | 741 | |
@@ -759,29 +759,29 @@ discard block |
||
759 | 759 | |
760 | 760 | switch ( $key ) { |
761 | 761 | |
762 | - case 'item_name': |
|
763 | - echo esc_html( $subscription_group_fee['name'] ); |
|
764 | - break; |
|
762 | + case 'item_name': |
|
763 | + echo esc_html( $subscription_group_fee['name'] ); |
|
764 | + break; |
|
765 | 765 | |
766 | - case 'price': |
|
767 | - wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() ); |
|
768 | - break; |
|
766 | + case 'price': |
|
767 | + wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() ); |
|
768 | + break; |
|
769 | 769 | |
770 | - case 'tax': |
|
771 | - echo '—'; |
|
772 | - break; |
|
770 | + case 'tax': |
|
771 | + echo '—'; |
|
772 | + break; |
|
773 | 773 | |
774 | - case 'discount': |
|
775 | - echo '—'; |
|
776 | - break; |
|
774 | + case 'discount': |
|
775 | + echo '—'; |
|
776 | + break; |
|
777 | 777 | |
778 | - case 'initial': |
|
779 | - wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() ); |
|
780 | - break; |
|
778 | + case 'initial': |
|
779 | + wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() ); |
|
780 | + break; |
|
781 | 781 | |
782 | - case 'recurring': |
|
783 | - echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_fee['recurring_fee'], $invoice->get_currency() ) . '</strong>' ); |
|
784 | - break; |
|
782 | + case 'recurring': |
|
783 | + echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_fee['recurring_fee'], $invoice->get_currency() ) . '</strong>' ); |
|
784 | + break; |
|
785 | 785 | |
786 | 786 | } |
787 | 787 | |
@@ -886,39 +886,39 @@ discard block |
||
886 | 886 | |
887 | 887 | switch ( $key ) { |
888 | 888 | |
889 | - case 'status': |
|
890 | - echo wp_kses_post( $_suscription->get_status_label_html() ); |
|
891 | - break; |
|
892 | - |
|
893 | - case 'item': |
|
894 | - $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
895 | - echo wp_kses_post( implode( ' | ', $markup ) ); |
|
896 | - break; |
|
897 | - |
|
898 | - case 'renewals': |
|
899 | - $max_bills = $_suscription->get_bill_times(); |
|
900 | - echo ( (int) $_suscription->get_times_billed() ) . ' / ' . ( empty( $max_bills ) ? '∞' : (int) $max_bills ); |
|
901 | - break; |
|
902 | - |
|
903 | - case 'renewal_date': |
|
904 | - echo $_suscription->is_active() ? esc_html( getpaid_format_date_value( $_suscription->get_expiration() ) ) : '—'; |
|
905 | - break; |
|
906 | - |
|
907 | - case 'start_date': |
|
908 | - echo 'pending' == $_suscription->get_status() ? '—' : esc_html( getpaid_format_date_value( $_suscription->get_date_created() ) ); |
|
909 | - break; |
|
910 | - |
|
911 | - case 'subscription': |
|
912 | - $url = is_admin() ? admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $_suscription->get_id() ) ) : $_suscription->get_view_url(); |
|
913 | - printf( |
|
914 | - '%1$s#%2$s%3$s', |
|
915 | - '<a href="' . esc_url( $url ) . '">', |
|
916 | - '<strong>' . intval( $_suscription->get_id() ) . '</strong>', |
|
917 | - '</a>' |
|
918 | - ); |
|
919 | - |
|
920 | - echo wp_kses_post( WPInv_Subscriptions_List_Table::column_amount( $_suscription ) ); |
|
921 | - break; |
|
889 | + case 'status': |
|
890 | + echo wp_kses_post( $_suscription->get_status_label_html() ); |
|
891 | + break; |
|
892 | + |
|
893 | + case 'item': |
|
894 | + $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
895 | + echo wp_kses_post( implode( ' | ', $markup ) ); |
|
896 | + break; |
|
897 | + |
|
898 | + case 'renewals': |
|
899 | + $max_bills = $_suscription->get_bill_times(); |
|
900 | + echo ( (int) $_suscription->get_times_billed() ) . ' / ' . ( empty( $max_bills ) ? '∞' : (int) $max_bills ); |
|
901 | + break; |
|
902 | + |
|
903 | + case 'renewal_date': |
|
904 | + echo $_suscription->is_active() ? esc_html( getpaid_format_date_value( $_suscription->get_expiration() ) ) : '—'; |
|
905 | + break; |
|
906 | + |
|
907 | + case 'start_date': |
|
908 | + echo 'pending' == $_suscription->get_status() ? '—' : esc_html( getpaid_format_date_value( $_suscription->get_date_created() ) ); |
|
909 | + break; |
|
910 | + |
|
911 | + case 'subscription': |
|
912 | + $url = is_admin() ? admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $_suscription->get_id() ) ) : $_suscription->get_view_url(); |
|
913 | + printf( |
|
914 | + '%1$s#%2$s%3$s', |
|
915 | + '<a href="' . esc_url( $url ) . '">', |
|
916 | + '<strong>' . intval( $_suscription->get_id() ) . '</strong>', |
|
917 | + '</a>' |
|
918 | + ); |
|
919 | + |
|
920 | + echo wp_kses_post( WPInv_Subscriptions_List_Table::column_amount( $_suscription ) ); |
|
921 | + break; |
|
922 | 922 | |
923 | 923 | } |
924 | 924 |