| 1 |
<?php |
| 2 |
/** |
| 3 |
* Display the table of products requiring licenses. |
| 4 |
* |
| 5 |
* @author Studio 164a |
| 6 |
* @package Charitable/Admin View/Settings |
| 7 |
* @since 1.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
$helper = charitable_get_helper( 'licenses' ); |
| 11 |
$products = $helper->get_products(); |
| 12 |
|
| 13 |
if ( empty( $products ) ) : |
| 14 |
return; |
| 15 |
endif; |
| 16 |
|
| 17 |
foreach ( $products as $key => $product ) : |
| 18 |
|
| 19 |
$license = $helper->get_license_details( $key ); |
| 20 |
|
| 21 |
if ( is_array( $license ) ) { |
| 22 |
$is_active = $license[ 'valid' ]; |
| 23 |
$license_key = $license[ 'license' ]; |
| 24 |
} |
| 25 |
else { |
| 26 |
$is_active = false; |
| 27 |
$license_key = $license; |
| 28 |
} |
| 29 |
|
| 30 |
?> |
| 31 |
<div class="charitable-settings-object charitable-licensed-product cf"> |
| 32 |
<h4><?php echo $product[ 'name' ] ?></h4> |
| 33 |
<input type="text" name="charitable_settings[licenses][<?php echo $key ?>]" id="charitable_settings_licenses_<?php echo $key ?>" class="charitable-settings-field" placeholder="<?php _e( 'Add your license key', 'charitable' ) ?>" value="<?php echo $license_key ?>" /> |
| 34 |
<?php if ( $license ) : ?> |
| 35 |
<div class="license-meta"> |
| 36 |
<?php if ( $is_active ) : ?> |
| 37 |
<a href="<?php echo $helper->get_license_deactivation_url( $key ) ?>" class="button-secondary license-deactivation"><?php _e( 'Deactivate License' ) ?></a> |
| 38 |
<span class="license-expiration-date"><?php printf( '%s %s.', __( 'Expiring in', 'charitable' ), human_time_diff( strtotime( $license[ 'expiration_date' ] ), time() ) ) ?></span> |
| 39 |
<?php elseif( is_array( $license ) ) : ?> |
| 40 |
<span class="license-invalid"><?php _e( 'This license is not valid', 'charitable' ) ?></span> |
| 41 |
<?php else : ?> |
| 42 |
<span class="license-invalid"><?php _e( 'We could not validate this license', 'charitable' ) ?></span> |
| 43 |
<?php endif ?> |
| 44 |
</div> |
| 45 |
<?php endif ?> |
| 46 |
</div> |
| 47 |
|
| 48 |
<?php |
| 49 |
endforeach; |