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
2017-05-30 17:50:14 +00:00
<!--< div class = " subscription-filter " >
< label > Sort by : < span class = " chevron dashicons dashicons-arrow-up-alt2 " ></ span ></ label >
< span > All ( 10 ) </ span >
< a href = " # " > Active ( 4 ) </ a >
< a href = " # " > Inactive ( 6 ) </ a >
< a href = " # " > Update Available ( 4 ) </ a >
< a href = " # " > Expiring Soon ( 4 ) </ a >
< a href = " # " > Expired ( 1 ) </ a >
< a href = " # " > Download ( 1 ) </ a >
</ div >-->
< table class = " wp-list-table widefat fixed striped " >
2017-04-21 12:05:44 +00:00
< ? 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 );
?>
2017-05-30 17:50:14 +00:00
< tbody >
< tr class = " wp-list-table__row is-ext-header " >
< td class = " wp-list-table__ext-details <?php echo implode( ' ', $classes ); ?> " >
< div class = " wp-list-table__ext-title " >
< a href = " <?php echo esc_url( $subscription['product_url'] ); ?> " target = " _blank " >< ? php
echo esc_html ( $subscription [ 'product_name' ] ); ?> </a>
</ div >
< div class = " wp-list-table__ext-description " >
< ? php if ( $subscription [ 'expired' ] ) : ?>
< span class = " renews " >
< strong >< ? php _e ( 'Expired :(' , 'woocommerce' ); ?> </strong>
< ? php echo date_i18n ( 'F jS, Y' , $subscription [ 'expires' ] ); ?>
</ span >
< ? php elseif ( $subscription [ 'autorenew' ] ) : ?>
< span class = " renews " >
< ? php _e ( 'Auto renews on:' , 'woocommerce' ); ?>
< ? php echo date_i18n ( 'F jS, Y' , $subscription [ 'expires' ] ); ?>
</ span >
< ? php elseif ( $subscription [ 'expiring' ] ) : ?>
< span class = " renews " >
< strong >< ? php _e ( 'Expiring soon!' , 'woocommerce' ); ?> </strong>
< ? php echo date_i18n ( 'F jS, Y' , $subscription [ 'expires' ] ); ?>
</ span >
< ? php else : ?>
< span class = " renews " >
< ? php _e ( 'Expires on:' , 'woocommerce' ); ?>
< ? php echo date_i18n ( 'F jS, Y' , $subscription [ 'expires' ] ); ?>
</ span >
< ? php endif ; ?>
2017-04-21 12:05:44 +00:00
2017-05-30 17:50:14 +00:00
< br />
< span class = " subscription " >
< ? php
if ( $subscription [ 'sites_max' ] > 0 ) {
/* translators: %1$d: sites active, %2$d max sites active */
printf ( __ ( 'Subscription: Using %1$d of %2$d sites available' , 'woocommerce' ), $subscription [ 'sites_active' ], $subscription [ 'sites_max' ] );
} else {
_e ( 'Subscription: Unlimited' , 'woocommerce' );
}
?>
</ span >
</ div >
</ td >
< td class = " wp-list-table__ext-actions " >
< ? php if ( ! $installed && ! $subscription [ 'expired' ] ) : ?>
< a class = " button " href = " <?php echo esc_url( $download_url ); ?> " target = " _blank " >< ? php _e ( 'Download' , 'woocommerce' ); ?> </a>
< ? php elseif ( $connected ) : ?>
<!-- TODO : Replace with a toggle -->
< a class = " button " href = " <?php echo esc_url( $subscription['deactivate_url'] ); ?> " >< ? php _e ( 'Deactivate' , 'woocommerce' ); ?> </a>
< ? php elseif ( ! $subscription [ 'expired' ] ) : ?>
< a class = " button " href = " <?php echo esc_url( $subscription['activate_url'] ); ?> " >< ? php _e ( 'Activate' , 'woocommerce' ); ?> </a>
< ? php else : ?>
< a class = " button disabled " href = " # " >< ? php _e ( 'Activate' , 'woocommerce' ); ?> </a>
2017-04-21 12:05:44 +00:00
< ? php endif ; ?>
2017-05-30 17:50:14 +00:00
</ td >
</ tr >
2017-04-21 12:05:44 +00:00
2017-05-30 17:50:14 +00:00
< ? php if ( $update_available && ! $subscription [ 'expired' ] ) : ?>
< tr class = " wp-list-table__row wp-list-table__ext-updates " >
< td class = " wp-list-table__ext-status update-available " >
< p >< span class = " dashicons dashicons-update " ></ span >
2017-04-26 15:36:20 +00:00
< ? php /* translators: %s: version number */ ?>
2017-05-30 17:50:14 +00:00
< ? php printf ( __ ( 'Version %s is <strong>available</strong>.' , 'woocommerce' ), esc_html ( $updates [ $product_id ][ 'version' ] ) ); ?>
< ? php if ( ! $connected ) : ?>
< ? php _e ( 'To enable this update you need to <strong>activate</strong> this subscription.' , 'woocommerce' ); ?>
< ? php endif ; ?>
</ p >
</ td >
< td class = " wp-list-table__ext-actions " >
< ? php if ( $connected ) : ?>
< a class = " button " href = " <?php echo esc_url( $subscription['update_url'] ); ?> " >< ? php _e ( 'Update' , 'woocommerce' ); ?> </a>
<!-- TODO : Activate & Update -->
2017-04-21 12:05:44 +00:00
< ? php endif ; ?>
2017-05-30 17:50:14 +00:00
</ td >
</ tr >
< ? php endif ; ?>
2017-04-21 12:05:44 +00:00
2017-05-30 17:50:14 +00:00
< ? php if ( $update_available && $subscription [ 'expired' ] ) : ?>
< tr class = " wp-list-table__row wp-list-table__ext-updates " >
< td class = " wp-list-table__ext-status expired " >
< p >< span class = " dashicons dashicons-info " ></ span >
2017-04-26 15:36:20 +00:00
< ? php /* translators: %s: version number */ ?>
2017-05-30 17:50:14 +00:00
< ? php printf ( __ ( 'Version %s is <strong>available</strong>.' , 'woocommerce' ), esc_html ( $updates [ $product_id ][ 'version' ] ) ); ?>
< ? php _e ( 'To enable this update you need to <strong>purchase</strong> a new subscription.' , 'woocommerce' ); ?>
</ p >
2017-04-21 12:05:44 +00:00
</ td >
2017-05-30 17:50:14 +00:00
< td class = " wp-list-table__ext-actions " >
< a class = " button " href = " <?php echo esc_url( $subscription['product_url'] ); ?> " target = " _blank " >< ? php _e ( 'Purchase' , 'woocommerce' ); ?> </a>
2017-04-21 12:05:44 +00:00
</ td >
2017-05-30 17:50:14 +00:00
</ tr >
< ? php endif ; ?>
< ? php if ( $subscription [ 'expiring' ] && ! $subscription [ 'autorenew' ] ) : ?>
< tr class = " wp-list-table__row wp-list-table__ext-updates " >
< td class = " wp-list-table__ext-status expired " >
< p >< span class = " dashicons dashicons-info " ></ span >
< ? php _e ( 'Subscription is <strong>expiring</strong> soon.' , 'woocommerce' ); ?>
</ p >
2017-04-21 12:05:44 +00:00
</ td >
2017-05-30 17:50:14 +00:00
< td class = " wp-list-table__ext-actions " >
< a class = " button " href = " https://woocommerce.com/my-account/my-subscriptions/ " target = " _blank " >< ? php _e ( 'Enable auto-renew' , 'woocommerce' ); ?> </a>
</ td >
</ tr >
< ? php endif ; ?>
< ? php if ( ! $connected && $subscription [ 'sites_max' ] > 0 && $subscription [ 'sites_active' ] >= $subscription [ 'sites_max' ] ) : ?>
< tr class = " wp-list-table__row wp-list-table__ext-updates " >
< td class = " wp-list-table__ext-status expired " >
< p >< span class = " dashicons dashicons-info " ></ span >
< ? php _e ( 'You are already using the <strong>maximum number of sites available</strong> with your current subscription.' , 'woocommerce' ); ?>
</ p >
</ td >
< td class = " wp-list-table__ext-actions " >
< a class = " button " href = " https://woocommerce.com/my-account/my-subscriptions/ " target = " _blank " >< ? php _e ( 'Upgrade' , 'woocommerce' ); ?> </a>
2017-04-21 12:05:44 +00:00
</ td >
</ tr >
2017-05-30 17:50:14 +00:00
< ? php endif ; ?>
2017-04-21 12:05:44 +00:00
2017-05-30 17:50:14 +00:00
</ tbody >
2017-04-21 12:05:44 +00:00
< ? 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 ; ?>
2017-05-30 17:50:14 +00:00
</ tbody >
2017-04-21 12:05:44 +00:00
</ table >
< ? php if ( ! empty ( $no_subscriptions ) ) : ?>
2017-05-30 17:50:14 +00:00
< h2 >< ? php _e ( 'Installed Extensions without a Subscription' , 'woocommerce' ); ?> </h2>
< p > Below is a list of WooCommerce . com products available on your site - but are either out - dated or do not have a valid subscription .</ p >
2017-04-21 12:05:44 +00:00
2017-05-30 17:50:14 +00:00
< table class = " wp-list-table widefat fixed striped " >
2017-04-21 12:05:44 +00:00
< ? 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' ];
}
?>
2017-05-30 17:50:14 +00:00
< tbody >
< tr class = " wp-list-table__row is-ext-header " >
< td class = " wp-list-table__ext-details color-bar autorenews " >
< div class = " wp-list-table__ext-title " >
< a href = " <?php echo esc_url( $product_url ); ?> " target = " _blank " >< ? php echo esc_html ( $data [ 'Name' ] ); ?> </a>
</ div >
< div class = " wp-list-table__ext-description " >
</ div >
</ td >
< td class = " wp-list-table__ext-actions " >
< span class = " form-toggle__wrapper " >
< input type = " checkbox " class = " form-toggle is-compact " readonly = " " value = " on " >
< label class = " form-toggle__label " for = " activate-akismet-undefined " >
< span class = " form-toggle__label-content " >
< label class = " plugin-action__label " for = " activate-akismet-undefined " > Inactive </ label >
</ span >
< span class = " form-toggle__switch " id = " activate-akismet-undefined " role = " checkbox " aria - checked = " false " tabindex = " 0 " ></ span >
</ label >
</ span >
</ td >
</ tr >
< ? php if ( $update_available ) : ?>
< tr class = " wp-list-table__row wp-list-table__ext-updates " >
< td class = " wp-list-table__ext-status update-available " >
< p >< span class = " dashicons dashicons-update " ></ span >
< ? php printf ( __ ( 'Version %s is available. To enable this update you need to <strong>purchase</strong> a new subscription.' , 'woocommerce' ), esc_html ( $updates [ $product_id ][ 'version' ] ) ); ?>
</ p >
</ td >
< td class = " wp-list-table__ext-actions " >
< a class = " button " href = " <?php echo esc_url( $product_url ); ?> " target = " _blank " >< ? php _e ( 'Purchase' , 'woocommerce' ); ?> </a>
</ td >
</ tr >
< ? php endif ; ?>
</ tbody >
2017-04-21 12:05:44 +00:00
< ? php endforeach ; ?>
</ table >
< ? php endif ; ?>
</ div >