@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Template that prints a single subscription's details |
4 | 4 | * |
@@ -9,19 +9,19 @@ discard block |
||
9 | 9 | * @var WPInv_Subscriptions_Widget $widget |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | + defined( 'ABSPATH' ) || exit; |
|
13 | 13 | |
14 | -do_action( 'getpaid_single_subscription_before_notices', $subscription ); |
|
14 | + do_action( 'getpaid_single_subscription_before_notices', $subscription ); |
|
15 | 15 | |
16 | -// Display errors and notices. |
|
17 | -wpinv_print_errors(); |
|
16 | + // Display errors and notices. |
|
17 | + wpinv_print_errors(); |
|
18 | 18 | |
19 | -$subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_invoice_id() ); |
|
20 | -$subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() ); |
|
19 | + $subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_invoice_id() ); |
|
20 | + $subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() ); |
|
21 | 21 | |
22 | -do_action( 'getpaid_before_single_subscription', $subscription, $subscription_groups ); |
|
22 | + do_action( 'getpaid_before_single_subscription', $subscription, $subscription_groups ); |
|
23 | 23 | |
24 | -?> |
|
24 | + ?> |
|
25 | 25 | |
26 | 26 | <h2 class="mb-1 h4"><?php esc_html_e( 'Subscription Details', 'invoicing' ); ?></h2> |
27 | 27 | <table class="table table-bordered"> |
@@ -38,59 +38,59 @@ discard block |
||
38 | 38 | <td style="width: 65%"> |
39 | 39 | <?php |
40 | 40 | |
41 | - switch ( $key ) { |
|
41 | + switch ( $key ) { |
|
42 | 42 | |
43 | - case 'status': |
|
44 | - echo esc_html( $subscription->get_status_label() ); |
|
45 | - break; |
|
43 | + case 'status': |
|
44 | + echo esc_html( $subscription->get_status_label() ); |
|
45 | + break; |
|
46 | 46 | |
47 | - case 'start_date': |
|
48 | - echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
49 | - break; |
|
47 | + case 'start_date': |
|
48 | + echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
49 | + break; |
|
50 | 50 | |
51 | - case 'expiry_date': |
|
52 | - echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) ); |
|
53 | - break; |
|
51 | + case 'expiry_date': |
|
52 | + echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) ); |
|
53 | + break; |
|
54 | 54 | |
55 | - case 'initial_amount': |
|
56 | - echo wp_kses_post( wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ) ); |
|
55 | + case 'initial_amount': |
|
56 | + echo wp_kses_post( wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ) ); |
|
57 | 57 | |
58 | - if ( $subscription->has_trial_period() ) { |
|
58 | + if ( $subscription->has_trial_period() ) { |
|
59 | 59 | |
60 | - echo "<small class='text-muted'> "; |
|
61 | - printf( |
|
62 | - esc_html_x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
63 | - esc_html( $subscription->get_trial_period() ) |
|
64 | - ); |
|
65 | - echo '</small>'; |
|
60 | + echo "<small class='text-muted'> "; |
|
61 | + printf( |
|
62 | + esc_html_x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
63 | + esc_html( $subscription->get_trial_period() ) |
|
64 | + ); |
|
65 | + echo '</small>'; |
|
66 | 66 | |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - break; |
|
69 | + break; |
|
70 | 70 | |
71 | - case 'recurring_amount': |
|
72 | - $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
73 | - $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
74 | - echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) ); |
|
75 | - break; |
|
71 | + case 'recurring_amount': |
|
72 | + $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
73 | + $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
74 | + echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) ); |
|
75 | + break; |
|
76 | 76 | |
77 | - case 'item': |
|
78 | - if ( empty( $subscription_group ) ) { |
|
79 | - echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
80 | - } else { |
|
81 | - $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
82 | - echo wp_kses_post( implode( ' | ', $markup ) ); |
|
83 | - } |
|
77 | + case 'item': |
|
78 | + if ( empty( $subscription_group ) ) { |
|
79 | + echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
80 | + } else { |
|
81 | + $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
82 | + echo wp_kses_post( implode( ' | ', $markup ) ); |
|
83 | + } |
|
84 | 84 | |
85 | - break; |
|
85 | + break; |
|
86 | 86 | |
87 | - case 'payments': |
|
88 | - $max_activations = (int) $subscription->get_bill_times(); |
|
89 | - echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '∞' : (int) $max_activations ); |
|
87 | + case 'payments': |
|
88 | + $max_activations = (int) $subscription->get_bill_times(); |
|
89 | + echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '∞' : (int) $max_activations ); |
|
90 | 90 | |
91 | - break; |
|
91 | + break; |
|
92 | 92 | |
93 | - } |
|
93 | + } |
|
94 | 94 | do_action( "getpaid_render_single_subscription_column_$key", $subscription ); |
95 | 95 | |
96 | 96 | ?> |