2017-04-21 12:05:44 +00:00
< ? php defined ( 'ABSPATH' ) or exit (); ?>
2017-05-30 16:46:26 +00:00
< div class = " wrap woocommerce wc_addons_wrap wc-helper " >
< h1 >< ? php _e ( 'WooCommerce Extensions' , 'woocommerce' ); ?> </h1>
2017-04-21 12:05:44 +00:00
< ? php include ( WC_Helper :: get_view_filename ( 'html-section-notices.php' ) ); ?>
2017-05-30 16:46:26 +00:00
< ? php include ( WC_Helper :: get_view_filename ( 'html-section-nav.php' ) ); ?>
2017-04-21 12:05:44 +00:00
< ? php include ( WC_Helper :: get_view_filename ( 'html-section-account.php' ) ); ?>
2017-04-26 15:36:20 +00:00
< h2 >< ? php _e ( 'Subscriptions' , 'woocommerce' ); ?> </h2>
< p >< ? php _e ( 'Below is a list of products available on your WooCommerce.com account. To receive plugin updates please make sure the product is installed, activated and connected to your WooCommerce.com account.' , 'woocommerce' ); ?> </p>
2017-04-21 12:05:44 +00:00
< table class = " wp-list-table widefat fixed striped " >
< thead >
< tr >
2017-04-26 15:36:20 +00:00
< th >< ? php _e ( 'Product' , 'woocommerce' ); ?> </th>
< th >< ? php _e ( 'Subscription' , 'woocommerce' ); ?> </th>
< th >< ? php _e ( 'Site Usage' , 'woocommerce' ); ?> </th>
< th >< ? php _e ( 'Action' , 'woocommerce' ); ?> </th>
2017-04-21 12:05:44 +00:00
</ tr >
</ thead >
< ? php if ( ! empty ( $subscriptions ) ) : ?>
< ? php foreach ( $subscriptions as $subscription ) : ?>
< ? php
$installed = ! empty ( $subscription [ 'local' ][ 'installed' ] );
$connected = $subscription [ 'active' ];
$product_id = $subscription [ 'product_id' ];
$update_available = false ;
if ( $installed && ! empty ( $updates [ $product_id ] ) &&
version_compare ( $updates [ $product_id ][ 'version' ], $subscription [ 'local' ][ 'version' ], '>' ) ) {
$update_available = true ;
}
$download_url = $subscription [ 'product_url' ];
if ( ! $installed && ! empty ( $updates [ $product_id ][ 'package' ] ) ) {
$download_url = $updates [ $product_id ][ 'package' ];
}
$classes = array (
'color-bar' => true ,
'expired' => $subscription [ 'expired' ],
'expiring' => $subscription [ 'expiring' ],
'update-available' => $update_available ,
'autorenews' => $subscription [ 'autorenew' ],
);
2017-04-21 12:35:27 +00:00
$classes = array_filter ( $classes , function ( $i ) {
return ( bool ) $i ;
} );
2017-04-21 12:05:44 +00:00
$classes = array_keys ( $classes );
?>
< tr >
< td class = " <?php echo implode( ' ', $classes ); ?> " >
< a class = " product-name " href = " <?php echo esc_url( $subscription['product_url'] ); ?> " target = " _blank " >< ? php
echo esc_html ( $subscription [ 'product_name' ] ); ?> </a><br>
< ? php if ( $update_available && $connected && ! $subscription [ 'expired' ] ) : ?>
2017-04-26 15:36:20 +00:00
< ? php /* translators: %s: version number */ ?>
< a href = " <?php echo admin_url( 'update-core.php' ); ?> " >< ? php printf ( __ ( 'Update to %s' , 'woocommerce' ), esc_html ( $updates [ $product_id ][ 'version' ] ) ); ?> </a>
2017-04-21 12:05:44 +00:00
< ? php endif ; ?>
< ? php if ( $update_available && $connected && $subscription [ 'expired' ] ) : ?>
2017-04-26 15:36:20 +00:00
< ? php /* translators: %s: version number */ ?>
< ? php printf ( __ ( '%s available' , 'woocommerce' ), esc_html ( $updates [ $product_id ][ 'version' ] ) ); ?>
2017-04-21 12:05:44 +00:00
< a href = " # " > [ ? ] </ a ><!-- Sub is active but expired -->
< ? php endif ; ?>
< ? php if ( $update_available && ! $connected ) : ?>
2017-04-26 15:36:20 +00:00
< ? php /* translators: %s: version number */ ?>
< ? php printf ( __ ( '%s available' , 'woocommerce' ), esc_html ( $updates [ $product_id ][ 'version' ] ) ); ?>
2017-04-21 12:05:44 +00:00
< a href = " # " > [ ? ] </ a ><!-- Subscription must be active to receive updates -->
< ? php endif ; ?>
2017-05-25 20:44:29 +00:00
< ? php if ( ! $installed && $update_available ) : ?>
2017-04-26 15:36:20 +00:00
< ? php /* translators: %s: version number */ ?>
< strong >< ? php printf ( __ ( '%s available' , 'woocommerce' ), esc_html ( $updates [ $product_id ][ 'version' ] ) ); ?> </strong>
2017-04-21 12:05:44 +00:00
< ? php endif ; ?>
</ td >
< td >
< ? php if ( $subscription [ 'expired' ] ) : ?>
2017-04-26 15:36:20 +00:00
< strong >< span class = " expired " style = " color: #B81C23; " >< ? php _e ( 'Expired :(' , 'woocommerce' ); ?> </span></strong><br>
2017-04-26 15:38:24 +00:00
< strong >< ? php echo date_i18n ( 'F jS, Y' , $subscription [ 'expires' ] ); ?> </strong>
2017-04-21 12:05:44 +00:00
< ? php elseif ( $subscription [ 'autorenew' ] ) : ?>
2017-04-26 15:36:20 +00:00
< span class = " renews " style = " color: black; " >< ? php _e ( 'Auto renews on:' , 'woocommerce' ); ?> </span><br>
2017-04-26 15:38:24 +00:00
< span >< ? php echo date_i18n ( 'F jS, Y' , $subscription [ 'expires' ] ); ?> </span>
2017-04-21 12:05:44 +00:00
< ? php elseif ( $subscription [ 'expiring' ] ) : ?>
2017-04-26 15:36:20 +00:00
< strong >< span class = " expiring " style = " color: orange; " >< ? php _e ( 'Expiring soon!' , 'woocommerce' ); ?> </span></strong><br>
2017-04-26 15:38:24 +00:00
< strong >< ? php echo date_i18n ( 'F jS, Y' , $subscription [ 'expires' ] ); ?> </strong>
2017-04-21 12:05:44 +00:00
< ? php else : ?>
2017-04-26 15:36:20 +00:00
< span class = " renews " style = " color: black; " >< ? php _e ( 'Expires on:' , 'woocommerce' ); ?> </span><br>
2017-04-26 15:38:24 +00:00
< span >< ? php echo date_i18n ( 'F jS, Y' , $subscription [ 'expires' ] ); ?> </span>
2017-04-21 12:05:44 +00:00
< ? php endif ; ?>
</ td >
< td >
< ? php echo esc_html ( $subscription [ 'key_type_label' ] ); ?>
< ? php
if ( $subscription [ 'sites_max' ] > 0 ) {
2017-04-26 15:36:20 +00:00
/* translators: %1$d: sites active, %2$d max sites active */
printf ( __ ( '(%1$d of %2$d used)' , 'woocommerce' ), $subscription [ 'sites_active' ], $subscription [ 'sites_max' ] );
2017-04-21 12:05:44 +00:00
}
?> <br>
< ? php if ( ! $installed ) : ?>
2017-04-26 15:36:20 +00:00
< ? php _e ( 'Not installed' , 'woocommerce' ); ?> <br>
2017-04-21 12:05:44 +00:00
< ? php elseif ( $installed ) : ?>
2017-04-26 15:36:20 +00:00
< ? php _e ( 'Installed on this site' , 'woocommerce' ); ?> <br>
2017-04-21 12:05:44 +00:00
< ? php endif ; ?>
</ td >
< td >
< ? php if ( ! $subscription [ 'expired' ] ) : ?>
< ? php if ( $connected ) : ?>
< ? php if ( $update_available ) : ?>
2017-05-24 15:11:37 +00:00
< a class = " button " href = " <?php echo esc_url( $subscription['update_url'] ); ?> " >< ? php _e ( 'Update' , 'woocommerce' ); ?> </a>
2017-04-21 12:05:44 +00:00
< ? php endif ; ?>
< ? php if ( $subscription [ 'expiring' ] ) : ?>
2017-04-26 15:36:20 +00:00
< a class = " button " href = " https://woocommerce.com/my-account/my-subscriptions/ " >< ? php _e ( 'Renew' , 'woocommerce' ); ?> </a>
2017-04-21 12:05:44 +00:00
< ? php endif ; ?>
2017-04-26 15:36:20 +00:00
< a class = " button " href = " <?php echo esc_url( $subscription['deactivate_url'] ); ?> " >< ? php _e ( 'Deactivate' , 'woocommerce' ); ?> </a>
2017-04-21 12:05:44 +00:00
< ? php elseif ( $subscription [ 'expiring' ] ) : ?>
2017-04-26 15:36:20 +00:00
< a class = " button " href = " https://woocommerce.com/my-account/my-subscriptions/ " >< ? php _e ( 'Renew' , 'woocommerce' ); ?> </a>
2017-04-21 12:05:44 +00:00
< ? php elseif ( $installed ) : ?>
2017-04-26 15:36:20 +00:00
< a class = " button " href = " <?php echo esc_url( $subscription['activate_url'] ); ?> " >< ? php _e ( 'Activate' , 'woocommerce' ); ?> </a>
2017-04-21 12:05:44 +00:00
< ? php else : ?>
2017-04-26 15:36:20 +00:00
< a class = " button " href = " <?php echo esc_url( $download_url ); ?> " target = " _blank " >< ? php _e ( 'Download' , 'woocommerce' ); ?> </a>
2017-04-21 12:05:44 +00:00
< ? php endif ; ?>
< ? php else : ?>
2017-04-26 15:36:20 +00:00
< a class = " button " href = " https://woocommerce.com/my-account/my-subscriptions/ " target = " _blank " >< ? php _e ( 'Renew' , 'woocommerce' ); ?> </a>
2017-04-21 12:05:44 +00:00
< ? php endif ; ?>
</ td >
</ tr >
< ? php endforeach ; ?>
< ? php else : ?>
< tr >
2017-04-26 15:36:20 +00:00
< td colspan = " 3 " >< em >< ? php _e ( 'Could not find any subscriptions on your WooCommerce.com account' , 'woocommerce' ); ?> </td>
2017-04-21 12:05:44 +00:00
</ tr >
< ? php endif ; ?>
</ table >
< ? php if ( ! empty ( $no_subscriptions ) ) : ?>
2017-04-26 15:36:20 +00:00
< h2 >< ? php _e ( 'Installed Extensions Without a Subscription' , 'woocommerce' ); ?> </h2>
2017-04-21 12:05:44 +00:00
< table class = " wp-list-table widefat fixed striped " >
< thead >
< tr >
2017-04-26 15:36:20 +00:00
< th >< ? php _e ( 'Product' , 'woocommerce' ); ?> </th>
< th >< ? php _e ( 'Subscription' , 'woocommerce' ); ?> </th>
2017-04-21 12:05:44 +00:00
< th ></ th >
2017-04-26 15:36:20 +00:00
< th >< ? php _e ( 'Action' , 'woocommerce' ); ?> </th>
2017-04-21 12:05:44 +00:00
</ tr >
</ thead >
< ? php /* Extensions without a subscription. */ ?>
< ? php foreach ( $no_subscriptions as $filename => $data ) : ?>
< ? php
$product_id = $data [ '_product_id' ];
$update_available = false ;
if ( ! empty ( $updates [ $product_id ] ) &&
version_compare ( $updates [ $product_id ][ 'version' ], $data [ 'Version' ], '>' ) ) {
$update_available = true ;
}
$product_url = '#' ;
if ( ! empty ( $updates [ $product_id ][ 'url' ] ) ) {
$product_url = $updates [ $product_id ][ 'url' ];
} elseif ( ! empty ( $data [ 'PluginURI' ] ) ) {
$product_url = $data [ 'PluginURI' ];
}
?>
< tr >
< td >
2017-04-26 15:36:20 +00:00
< ? php /* translators: %1$s: product name, %2$s: product version */ ?>
2017-05-24 10:04:52 +00:00
< ? php printf ( __ ( '%1$s<br>%2$s installed' , 'woocommerce' ), esc_html ( $data [ 'Name' ] ), esc_html ( $data [ 'Version' ] ) ); ?>
2017-04-21 12:05:44 +00:00
< ? php if ( ! $update_available ) : ?>
2017-04-26 15:36:20 +00:00
< ? php _e ( '(latest)' , 'woocommerce' ); ?>
2017-04-21 12:05:44 +00:00
< ? php endif ; ?>
< br >
< ? php if ( $update_available ) : ?>
2017-04-26 15:36:20 +00:00
< ? php /* translators: %s: version number */ ?>
< strong >< ? php printf ( __ ( '%s available' , 'woocommerce' ), esc_html ( $updates [ $product_id ][ 'version' ] ) ); ?> </strong>
2017-04-21 12:05:44 +00:00
< a href = " # " > [ ? ] </ a ><!-- There must be an active subscription to receive updates -->
< ? php endif ; ?>
</ td >
2017-04-26 15:36:20 +00:00
< td >< ? php _e ( 'No/Invalid subscription' , 'woocommerce' ); ?> </td>
2017-04-21 12:05:44 +00:00
< td ></ td >
< td >
2017-04-26 15:36:20 +00:00
< a class = " button " href = " <?php echo esc_url( $product_url ); ?> " target = " _blank " >< ? php _e ( 'Purchase Subscription' , 'woocommerce' ); ?> </a>
2017-04-21 12:05:44 +00:00
</ td >
</ tr >
< ? php endforeach ; ?>
</ table >
< ? php endif ; ?>
</ div >