PageRenderTime 45ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/site/wp-content/plugins/woocommerce/includes/admin/helper/views/html-main.php

https://bitbucket.org/ericstrom/ballmerpeak
PHP | 214 lines | 193 code | 17 blank | 4 comment | 17 complexity | 566c171ea7060877e309edbcc24b4bde MD5 | raw file
  1. <?php defined( 'ABSPATH' ) or exit(); ?>
  2. <div class="wrap woocommerce wc_addons_wrap wc-helper">
  3. <?php require WC_Helper::get_view_filename( 'html-section-nav.php' ); ?>
  4. <h1 class="screen-reader-text"><?php _e( 'WooCommerce Extensions', 'woocommerce' ); ?></h1>
  5. <?php require WC_Helper::get_view_filename( 'html-section-notices.php' ); ?>
  6. <div class="subscriptions-header">
  7. <h2><?php _e( 'Subscriptions', 'woocommerce' ); ?></h2>
  8. <?php require WC_Helper::get_view_filename( 'html-section-account.php' ); ?>
  9. <p><?php printf( __( 'Below is a list of extensions available on your WooCommerce.com account. To receive extension updates please make sure the extension is installed, and its subscription activated and connected to your WooCommerce.com account. Extensions can be activated from the <a href="%s">Plugins</a> screen.', 'woocommerce' ), admin_url( 'plugins.php' ) ); ?></p>
  10. </div>
  11. <ul class="subscription-filter">
  12. <label><?php _e( 'Sort by:', 'woocommerce' ); ?> <span class="chevron dashicons dashicons-arrow-up-alt2"></span></label>
  13. <?php
  14. $filters = array_keys( WC_Helper::get_filters() );
  15. $last_filter = array_pop( $filters );
  16. $current_filter = WC_Helper::get_current_filter();
  17. $counts = WC_Helper::get_filters_counts();
  18. ?>
  19. <?php
  20. foreach ( WC_Helper::get_filters() as $key => $label ) :
  21. // Don't show empty filters.
  22. if ( empty( $counts[ $key ] ) ) {
  23. continue;
  24. }
  25. $url = admin_url( 'admin.php?page=wc-addons&section=helper&filter=' . $key );
  26. $class_html = $current_filter === $key ? 'class="current"' : '';
  27. ?>
  28. <li>
  29. <a <?php echo $class_html; ?> href="<?php echo esc_url( $url ); ?>">
  30. <?php echo esc_html( $label ); ?>
  31. <span class="count">(<?php echo absint( $counts[ $key ] ); ?>)</span>
  32. </a>
  33. </li>
  34. <?php endforeach; ?>
  35. </ul>
  36. <table class="wp-list-table widefat fixed striped">
  37. <?php if ( ! empty( $subscriptions ) ) : ?>
  38. <?php foreach ( $subscriptions as $subscription ) : ?>
  39. <tbody>
  40. <tr class="wp-list-table__row is-ext-header">
  41. <td class="wp-list-table__ext-details">
  42. <div class="wp-list-table__ext-title">
  43. <a href="<?php echo esc_url( $subscription['product_url'] ); ?>" target="_blank">
  44. <?php echo esc_html( $subscription['product_name'] ); ?>
  45. </a>
  46. </div>
  47. <div class="wp-list-table__ext-description">
  48. <?php if ( $subscription['lifetime'] ) : ?>
  49. <span class="renews">
  50. <?php _e( 'Lifetime Subscription', 'woocommerce' ); ?>
  51. </span>
  52. <?php elseif ( $subscription['expired'] ) : ?>
  53. <span class="renews">
  54. <strong><?php _e( 'Expired :(', 'woocommerce' ); ?></strong>
  55. <?php echo date_i18n( 'F jS, Y', $subscription['expires'] ); ?>
  56. </span>
  57. <?php elseif ( $subscription['autorenew'] ) : ?>
  58. <span class="renews">
  59. <?php _e( 'Auto renews on:', 'woocommerce' ); ?>
  60. <?php echo date_i18n( 'F jS, Y', $subscription['expires'] ); ?>
  61. </span>
  62. <?php elseif ( $subscription['expiring'] ) : ?>
  63. <span class="renews">
  64. <strong><?php _e( 'Expiring soon!', 'woocommerce' ); ?></strong>
  65. <?php echo date_i18n( 'F jS, Y', $subscription['expires'] ); ?>
  66. </span>
  67. <?php else : ?>
  68. <span class="renews">
  69. <?php _e( 'Expires on:', 'woocommerce' ); ?>
  70. <?php echo date_i18n( 'F jS, Y', $subscription['expires'] ); ?>
  71. </span>
  72. <?php endif; ?>
  73. <br/>
  74. <span class="subscription">
  75. <?php
  76. if ( ! $subscription['active'] && $subscription['maxed'] ) {
  77. /* translators: %1$d: sites active, %2$d max sites active */
  78. printf( __( 'Subscription: Not available - %1$d of %2$d already in use', 'woocommerce' ), absint( $subscription['sites_active'] ), absint( $subscription['sites_max'] ) );
  79. } elseif ( $subscription['sites_max'] > 0 ) {
  80. /* translators: %1$d: sites active, %2$d max sites active */
  81. printf( __( 'Subscription: Using %1$d of %2$d sites available', 'woocommerce' ), absint( $subscription['sites_active'] ), absint( $subscription['sites_max'] ) );
  82. } else {
  83. _e( 'Subscription: Unlimited', 'woocommerce' );
  84. }
  85. // Check shared.
  86. if ( ! empty( $subscription['is_shared'] ) && ! empty( $subscription['owner_email'] ) ) {
  87. printf( '</br>' . __( 'Shared by %s', 'woocommerce' ), esc_html( $subscription['owner_email'] ) );
  88. } elseif ( isset( $subscription['master_user_email'] ) ) {
  89. printf( '</br>' . __( 'Shared by %s', 'woocommerce' ), esc_html( $subscription['master_user_email'] ) );
  90. }
  91. ?>
  92. </span>
  93. </div>
  94. </td>
  95. <td class="wp-list-table__ext-actions">
  96. <?php if ( ! $subscription['active'] && $subscription['maxed'] ) : ?>
  97. <a class="button" href="https://woocommerce.com/my-account/my-subscriptions/" target="_blank"><?php _e( 'Upgrade', 'woocommerce' ); ?></a>
  98. <?php elseif ( ! $subscription['local']['installed'] && ! $subscription['expired'] ) : ?>
  99. <a class="button <?php echo empty( $subscription['download_primary'] ) ? 'button-secondary' : ''; ?>" href="<?php echo esc_url( $subscription['download_url'] ); ?>" target="_blank"><?php _e( 'Download', 'woocommerce' ); ?></a>
  100. <?php elseif ( $subscription['active'] ) : ?>
  101. <span class="form-toggle__wrapper">
  102. <a href="<?php echo esc_url( $subscription['deactivate_url'] ); ?>" class="form-toggle active is-compact" role="link" aria-checked="true"><?php _e( 'Active', 'woocommerce' ); ?></a>
  103. <label class="form-toggle__label" for="activate-extension">
  104. <span class="form-toggle__label-content">
  105. <label for="activate-extension"><?php _e( 'Active', 'woocommerce' ); ?></label>
  106. </span>
  107. <span class="form-toggle__switch"></span>
  108. </label>
  109. </span>
  110. <?php elseif ( ! $subscription['expired'] ) : ?>
  111. <span class="form-toggle__wrapper">
  112. <a href="<?php echo esc_url( $subscription['activate_url'] ); ?>" class="form-toggle is-compact" role="link" aria-checked="false"><?php _e( 'Inactive', 'woocommerce' ); ?></a>
  113. <label class="form-toggle__label" for="activate-extension">
  114. <span class="form-toggle__label-content">
  115. <label for="activate-extension"><?php _e( 'Inactive', 'woocommerce' ); ?></label>
  116. </span>
  117. <span class="form-toggle__switch"></span>
  118. </label>
  119. </span>
  120. <?php else : ?>
  121. <span class="form-toggle__wrapper">
  122. <span class="form-toggle disabled is-compact"><?php _e( 'Inactive', 'woocommerce' ); ?></span>
  123. <label class="form-toggle__label" for="activate-extension">
  124. <span class="form-toggle__label-content">
  125. <label for="activate-extension"><?php _e( 'Inactive', 'woocommerce' ); ?></label>
  126. </span>
  127. </label>
  128. </span>
  129. <?php endif; ?>
  130. </td>
  131. </tr>
  132. <?php foreach ( $subscription['actions'] as $action ) : ?>
  133. <tr class="wp-list-table__row wp-list-table__ext-updates">
  134. <td class="wp-list-table__ext-status <?php echo sanitize_html_class( $action['status'] ); ?>">
  135. <p><span class="dashicons <?php echo sanitize_html_class( $action['icon'] ); ?>"></span>
  136. <?php echo $action['message']; ?>
  137. </p>
  138. </td>
  139. <td class="wp-list-table__ext-actions">
  140. <?php if ( ! empty( $action['button_label'] ) && ! empty( $action['button_url'] ) ) : ?>
  141. <a class="button <?php echo empty( $action['primary'] ) ? 'button-secondary' : ''; ?>" href="<?php echo esc_url( $action['button_url'] ); ?>"><?php echo esc_html( $action['button_label'] ); ?></a>
  142. <?php endif; ?>
  143. </td>
  144. </tr>
  145. <?php endforeach; ?>
  146. </tbody>
  147. <?php endforeach; ?>
  148. <?php else : ?>
  149. <tr>
  150. <td colspan="3"><em><?php _e( 'Could not find any subscriptions on your WooCommerce.com account', 'woocommerce' ); ?></td>
  151. </tr>
  152. <?php endif; ?>
  153. </tbody>
  154. </table>
  155. <?php if ( ! empty( $no_subscriptions ) ) : ?>
  156. <h2><?php _e( 'Installed Extensions without a Subscription', 'woocommerce' ); ?></h2>
  157. <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>
  158. <table class="wp-list-table widefat fixed striped">
  159. <?php /* Extensions without a subscription. */ ?>
  160. <?php foreach ( $no_subscriptions as $filename => $data ) : ?>
  161. <tbody>
  162. <tr class="wp-list-table__row is-ext-header">
  163. <td class="wp-list-table__ext-details color-bar autorenews">
  164. <div class="wp-list-table__ext-title">
  165. <a href="<?php echo esc_url( $data['_product_url'] ); ?>" target="_blank"><?php echo esc_html( $data['Name'] ); ?></a>
  166. </div>
  167. <div class="wp-list-table__ext-description">
  168. </div>
  169. </td>
  170. <td class="wp-list-table__ext-actions">
  171. <span class="form-toggle__wrapper">
  172. <span class="form-toggle disabled is-compact" ><?php _e( 'Inactive', 'woocommerce' ); ?></span>
  173. <label class="form-toggle__label" for="activate-extension">
  174. <span class="form-toggle__label-content">
  175. <label for="activate-extension"><?php _e( 'Inactive', 'woocommerce' ); ?></label>
  176. </span>
  177. </label>
  178. </span>
  179. </td>
  180. </tr>
  181. <?php foreach ( $data['_actions'] as $action ) : ?>
  182. <tr class="wp-list-table__row wp-list-table__ext-updates">
  183. <td class="wp-list-table__ext-status <?php echo sanitize_html_class( $action['status'] ); ?>">
  184. <p><span class="dashicons <?php echo sanitize_html_class( $action['icon'] ); ?>"></span>
  185. <?php echo $action['message']; ?>
  186. </p>
  187. </td>
  188. <td class="wp-list-table__ext-actions">
  189. <a class="button" href="<?php echo esc_url( $action['button_url'] ); ?>" target="_blank"><?php echo esc_html( $action['button_label'] ); ?></a>
  190. </td>
  191. </tr>
  192. <?php endforeach; ?>
  193. </tbody>
  194. <?php endforeach; ?>
  195. </table>
  196. <?php endif; ?>
  197. </div>