1 | <?php |
||||
2 | /** |
||||
3 | * Meta Box Payment Subscription |
||||
4 | * |
||||
5 | * @author Pronamic <[email protected]> |
||||
6 | * @copyright 2005-2019 Pronamic |
||||
7 | * @license GPL-3.0-or-later |
||||
8 | * @package Pronamic\WordPress\Pay |
||||
9 | */ |
||||
10 | |||||
11 | use Pronamic\WordPress\Pay\Util; |
||||
12 | |||||
13 | $post_id = get_the_ID(); |
||||
14 | |||||
15 | if ( empty( $post_id ) ) { |
||||
16 | return; |
||||
17 | } |
||||
18 | |||||
19 | $payment = get_pronamic_payment( $post_id ); |
||||
20 | |||||
21 | $subscription = $payment->get_subscription(); |
||||
22 | |||||
23 | if ( $subscription ) : ?> |
||||
24 | |||||
25 | <table class="form-table"> |
||||
26 | <tr> |
||||
27 | <th scope="row"> |
||||
28 | <?php esc_html_e( 'Subscription', 'pronamic_ideal' ); ?> |
||||
29 | </th> |
||||
30 | <td> |
||||
31 | <?php edit_post_link( get_the_title( $subscription->post->ID ), '', '', $subscription->post->ID ); ?> |
||||
32 | </td> |
||||
33 | </tr> |
||||
34 | <tr> |
||||
35 | <th scope="row"> |
||||
36 | <?php esc_html_e( 'Status', 'pronamic_ideal' ); ?> |
||||
37 | </th> |
||||
38 | <td> |
||||
39 | <?php |
||||
40 | |||||
41 | $status_object = get_post_status_object( get_post_status( $subscription->post->ID ) ); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
42 | |||||
43 | if ( isset( $status_object, $status_object->label ) ) { |
||||
44 | echo esc_html( $status_object->label ); |
||||
45 | } else { |
||||
46 | echo '—'; |
||||
47 | } |
||||
48 | |||||
49 | ?> |
||||
50 | </td> |
||||
51 | </tr> |
||||
52 | <tr> |
||||
53 | <th scope="row"> |
||||
54 | <?php esc_html_e( 'Description', 'pronamic_ideal' ); ?> |
||||
55 | </th> |
||||
56 | <td> |
||||
57 | <?php echo esc_html( $subscription->get_description() ); ?> |
||||
58 | </td> |
||||
59 | </tr> |
||||
60 | <tr> |
||||
61 | <th scope="row"> |
||||
62 | <?php esc_html_e( 'Amount', 'pronamic_ideal' ); ?> |
||||
63 | </th> |
||||
64 | <td> |
||||
65 | <?php |
||||
66 | |||||
67 | echo esc_html( $subscription->get_total_amount()->format_i18n() ); |
||||
68 | |||||
69 | ?> |
||||
70 | </td> |
||||
71 | </tr> |
||||
72 | <tr> |
||||
73 | <th scope="row"> |
||||
74 | <?php echo esc_html_x( 'Interval', 'Recurring payment', 'pronamic_ideal' ); ?> |
||||
75 | </th> |
||||
76 | <td> |
||||
77 | <?php echo esc_html( Util::format_interval( $subscription->get_interval(), $subscription->get_interval_period() ) ); ?> |
||||
78 | </td> |
||||
79 | </tr> |
||||
80 | <tr> |
||||
81 | <th scope="row"> |
||||
82 | <?php echo esc_html_x( 'Frequency', 'Recurring payment', 'pronamic_ideal' ); ?> |
||||
83 | </th> |
||||
84 | <td> |
||||
85 | <?php echo esc_html( Util::format_frequency( $subscription->get_frequency() ) ); ?> |
||||
0 ignored issues
–
show
$subscription->get_frequency() of type string is incompatible with the type integer expected by parameter $frequency of Pronamic\WordPress\Pay\Util::format_frequency() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
86 | </td> |
||||
87 | </tr> |
||||
88 | <tr> |
||||
89 | <th scope="row"> |
||||
90 | <?php esc_html_e( 'Source', 'pronamic_ideal' ); ?> |
||||
91 | </th> |
||||
92 | <td> |
||||
93 | <?php |
||||
94 | |||||
95 | echo $subscription->get_source_text(); // WPCS: XSS ok. |
||||
96 | |||||
97 | ?> |
||||
98 | </td> |
||||
99 | </tr> |
||||
100 | </table> |
||||
101 | |||||
102 | <?php else : ?> |
||||
103 | |||||
104 | <p> |
||||
105 | <?php esc_html_e( 'This payment is not related to a subscription.', 'pronamic_ideal' ); ?> |
||||
106 | </p> |
||||
107 | |||||
108 | <?php endif; ?> |
||||
109 |