2012-11-27 16:22:47 +00:00
< ? php
2014-09-20 20:05:06 +00:00
if ( ! defined ( 'ABSPATH' ) ) {
2016-11-18 17:13:02 +00:00
exit ;
2014-09-20 20:05:06 +00:00
}
2012-10-16 09:11:50 +00:00
?>
< div class = " wc-metabox closed " >
< h3 class = " fixed " >
2017-11-21 17:50:30 +00:00
< button type = " button " data - permission_id = " <?php echo esc_attr( $download->get_id () ); ?> " rel = " <?php echo esc_attr( $download->get_product_id () ) . ',' . esc_attr( $download->get_download_id () ); ?> " class = " revoke_access button " >< ? php esc_html_e ( 'Revoke access' , 'woocommerce' ); ?> </button>
2016-11-04 15:41:51 +00:00
< div class = " handlediv " aria - label = " <?php esc_attr_e( 'Click to toggle', 'woocommerce' ); ?> " ></ div >
2017-01-06 12:45:26 +00:00
< strong >< ? php
printf (
'#%s — %s — %s: %s — ' ,
esc_html ( $product -> get_id () ),
esc_html ( apply_filters ( 'woocommerce_admin_download_permissions_title' , $product -> get_name (), $download -> get_product_id (), $download -> get_order_id (), $download -> get_order_key (), $download -> get_download_id () ) ),
esc_html ( $file_count ),
esc_html ( wc_get_filename_from_url ( $product -> get_file_download_path ( $download -> get_download_id () ) ) )
);
2017-01-06 14:09:36 +00:00
printf ( _n ( 'Downloaded %s time' , 'Downloaded %s times' , $download -> get_download_count (), 'woocommerce' ), esc_html ( $download -> get_download_count () ) )
2017-11-21 17:50:30 +00:00
?> </strong>
2012-10-16 09:11:50 +00:00
</ h3 >
< table cellpadding = " 0 " cellspacing = " 0 " class = " wc-metabox-content " >
< tbody >
< tr >
< td >
2017-11-13 16:24:33 +00:00
< label >< ? php esc_html_e ( 'Downloads remaining' , 'woocommerce' ); ?> </label>
2017-11-21 17:50:30 +00:00
< input type = " hidden " name = " permission_id[<?php echo esc_attr( $loop ); ?>] " value = " <?php echo esc_attr( $download->get_id () ); ?> " />
< input type = " number " step = " 1 " min = " 0 " class = " short " name = " downloads_remaining[<?php echo esc_attr( $loop ); ?>] " value = " <?php echo esc_attr( $download->get_downloads_remaining () ); ?> " placeholder = " <?php esc_attr_e( 'Unlimited', 'woocommerce' ); ?> " />
2012-10-16 09:11:50 +00:00
</ td >
< td >
2017-11-13 16:24:33 +00:00
< label >< ? php esc_html_e ( 'Access expires' , 'woocommerce' ); ?> </label>
2017-11-21 17:50:30 +00:00
< input type = " text " class = " short date-picker " name = " access_expires[<?php echo esc_attr( $loop ); ?>] " value = " <?php echo ! is_null( $download->get_access_expires () ) ? esc_attr( date_i18n( 'Y-m-d', $download->get_access_expires ()->getTimestamp() ) ) : ''; ?> " maxlength = " 10 " placeholder = " <?php esc_attr_e( 'Never', 'woocommerce' ); ?> " pattern = " <?php echo esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9] { 4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ); ?> " />
2012-10-16 09:11:50 +00:00
</ td >
2016-05-11 04:52:18 +00:00
< td >
2017-11-13 16:24:33 +00:00
< label >< ? php esc_html_e ( 'Customer download link' , 'woocommerce' ); ?> </label>
2016-05-11 04:52:18 +00:00
< ? php
2016-08-27 06:14:06 +00:00
$download_link = add_query_arg ( array (
2016-11-18 17:13:02 +00:00
'download_file' => $download -> get_product_id (),
'order' => $download -> get_order_key (),
'email' => urlencode ( $download -> get_user_email () ),
'key' => $download -> get_download_id (),
2016-05-11 04:52:18 +00:00
), trailingslashit ( home_url () ) );
?>
2017-12-15 10:26:22 +00:00
< a id = " copy-download-link " class = " button " href = " <?php echo esc_url( $download_link ) ?> " data - tip = " <?php esc_attr_e( 'Copied!', 'woocommerce' ); ?> " data - tip - failed = " <?php esc_attr_e( 'Copying to clipboard failed. You should be able to right-click the button and copy.', 'woocommerce' ); ?> " >< ? php esc_html_e ( 'Copy link' , 'woocommerce' ); ?> </a>
2016-05-11 04:52:18 +00:00
</ td >
2017-08-05 04:35:37 +00:00
< td >
2017-12-15 10:26:22 +00:00
< label >< ? php esc_html_e ( 'Customer download log' , 'woocommerce' ); ?> </label>
2017-08-03 21:24:53 +00:00
< ? php
$report_url = add_query_arg (
'permission_id' ,
2017-08-23 03:03:27 +00:00
rawurlencode ( $download -> get_id () ),
2017-11-13 16:10:32 +00:00
admin_url ( 'admin.php?page=wc-reports&tab=orders&report=downloads' )
2017-08-03 21:24:53 +00:00
);
2017-12-14 05:57:47 +00:00
echo '<a class="button" href="' . esc_url ( $report_url ) . '">' ;
2017-12-15 10:26:22 +00:00
esc_html_e ( 'View report' , 'woocommerce' );
2017-08-03 21:24:53 +00:00
echo '</a>' ;
?>
</ td >
2012-10-16 09:11:50 +00:00
</ tr >
</ tbody >
</ table >
2014-09-20 20:05:06 +00:00
</ div >