pronamic /
wp-pronamic-ideal
| 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( 'Description', 'pronamic_ideal' ); ?> |
||
| 37 | </th> |
||
| 38 | <td> |
||
| 39 | <?php echo esc_html( $subscription->get_description() ); ?> |
||
| 40 | </td> |
||
| 41 | </tr> |
||
| 42 | <tr> |
||
| 43 | <th scope="row"> |
||
| 44 | <?php esc_html_e( 'Amount', 'pronamic_ideal' ); ?> |
||
| 45 | </th> |
||
| 46 | <td> |
||
| 47 | <?php |
||
| 48 | |||
| 49 | echo esc_html( $subscription->get_amount()->format_i18n() ); |
||
| 50 | |||
| 51 | ?> |
||
| 52 | </td> |
||
| 53 | </tr> |
||
| 54 | <tr> |
||
| 55 | <th scope="row"> |
||
| 56 | <?php echo esc_html_x( 'Interval', 'Recurring payment', 'pronamic_ideal' ); ?> |
||
| 57 | </th> |
||
| 58 | <td> |
||
| 59 | <?php echo esc_html( Util::format_interval( $subscription->get_interval(), $subscription->get_interval_period() ) ); ?> |
||
| 60 | </td> |
||
| 61 | </tr> |
||
| 62 | <tr> |
||
| 63 | <th scope="row"> |
||
| 64 | <?php echo esc_html_x( 'Frequency', 'Recurring payment', 'pronamic_ideal' ); ?> |
||
| 65 | </th> |
||
| 66 | <td> |
||
| 67 | <?php echo esc_html( Util::format_frequency( $subscription->get_frequency() ) ); ?> |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 68 | </td> |
||
| 69 | </tr> |
||
| 70 | <tr> |
||
| 71 | <th scope="row"> |
||
| 72 | <?php esc_html_e( 'Source', 'pronamic_ideal' ); ?> |
||
| 73 | </th> |
||
| 74 | <td> |
||
| 75 | <?php |
||
| 76 | |||
| 77 | echo $subscription->get_source_text(); // WPCS: XSS ok. |
||
| 78 | |||
| 79 | ?> |
||
| 80 | </td> |
||
| 81 | </tr> |
||
| 82 | </table> |
||
| 83 | |||
| 84 | <?php else : ?> |
||
| 85 | |||
| 86 | <p> |
||
| 87 | <?php esc_html_e( 'This payment is not related to a subscription.', 'pronamic_ideal' ); ?> |
||
| 88 | </p> |
||
| 89 | |||
| 90 | <?php endif; ?> |
||
| 91 |