@@ -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 | ?> |