email-downloads.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Email Downloads.
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/emails/email-downloads.php.
  6. *
  7. * HOWEVER, on occasion WooCommerce will need to update template files and you
  8. * (the theme developer) will need to copy the new files to your theme to
  9. * maintain compatibility. We try to do this as little as possible, but it does
  10. * happen. When this occurs the version of the template file will be bumped and
  11. * the readme will list any important changes.
  12. *
  13. * @see https://docs.woocommerce.com/document/template-structure/
  14. * @package WooCommerce/Templates
  15. * @version 3.4.0
  16. */
  17. defined( 'ABSPATH' ) || exit;
  18. $text_align = is_rtl() ? 'right' : 'left';
  19. ?><h2 class="woocommerce-order-downloads__title"><?php esc_html_e( 'Downloads', 'woocommerce' ); ?></h2>
  20. <table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; margin-bottom: 40px;" border="1">
  21. <thead>
  22. <tr>
  23. <?php foreach ( $columns as $column_id => $column_name ) : ?>
  24. <th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php echo esc_html( $column_name ); ?></th>
  25. <?php endforeach; ?>
  26. </tr>
  27. </thead>
  28. <?php foreach ( $downloads as $download ) : ?>
  29. <tr>
  30. <?php foreach ( $columns as $column_id => $column_name ) : ?>
  31. <td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>;">
  32. <?php
  33. if ( has_action( 'woocommerce_email_downloads_column_' . $column_id ) ) {
  34. do_action( 'woocommerce_email_downloads_column_' . $column_id, $download, $plain_text );
  35. } else {
  36. switch ( $column_id ) {
  37. case 'download-product':
  38. ?>
  39. <a href="<?php echo esc_url( get_permalink( $download['product_id'] ) ); ?>"><?php echo wp_kses_post( $download['product_name'] ); ?></a>
  40. <?php
  41. break;
  42. case 'download-file':
  43. ?>
  44. <a href="<?php echo esc_url( $download['download_url'] ); ?>" class="woocommerce-MyAccount-downloads-file button alt"><?php echo esc_html( $download['download_name'] ); ?></a>
  45. <?php
  46. break;
  47. case 'download-expires':
  48. if ( ! empty( $download['access_expires'] ) ) {
  49. ?>
  50. <time datetime="<?php echo esc_attr( date( 'Y-m-d', strtotime( $download['access_expires'] ) ) ); ?>" title="<?php echo esc_attr( strtotime( $download['access_expires'] ) ); ?>"><?php echo esc_html( date_i18n( get_option( 'date_format' ), strtotime( $download['access_expires'] ) ) ); ?></time>
  51. <?php
  52. } else {
  53. esc_html_e( 'Never', 'woocommerce' );
  54. }
  55. break;
  56. }
  57. }
  58. ?>
  59. </td>
  60. <?php endforeach; ?>
  61. </tr>
  62. <?php endforeach; ?>
  63. </table>