html-admin-page-addons.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. /**
  3. * Admin View: Page - Addons
  4. *
  5. * @var string $view
  6. * @var object $addons
  7. */
  8. if ( ! defined( 'ABSPATH' ) ) {
  9. exit;
  10. }
  11. ?>
  12. <div class="wrap woocommerce wc_addons_wrap">
  13. <nav class="nav-tab-wrapper woo-nav-tab-wrapper">
  14. <a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons' ) ); ?>" class="nav-tab nav-tab-active"><?php _e( 'Browse Extensions', 'woocommerce' ); ?></a>
  15. <?php
  16. $count_html = WC_Helper_Updater::get_updates_count_html();
  17. $menu_title = sprintf( __( 'WooCommerce.com Subscriptions %s', 'woocommerce' ), $count_html );
  18. ?>
  19. <a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons&section=helper' ) ); ?>" class="nav-tab"><?php echo $menu_title; ?></a>
  20. </nav>
  21. <h1 class="screen-reader-text"><?php _e( 'WooCommerce Extensions', 'woocommerce' ); ?></h1>
  22. <?php if ( $sections ) : ?>
  23. <ul class="subsubsub">
  24. <?php foreach ( $sections as $section ) : ?>
  25. <li>
  26. <a
  27. class="<?php echo $current_section === $section->slug ? 'current' : ''; ?>"
  28. href="<?php echo admin_url( 'admin.php?page=wc-addons&section=' . esc_attr( $section->slug ) ); ?>">
  29. <?php echo esc_html( $section->label ); ?>
  30. </a>
  31. </li>
  32. <?php endforeach; ?>
  33. </ul>
  34. <?php if ( isset( $_GET['search'] ) ) : ?>
  35. <h1 class="search-form-title" >
  36. <?php printf( __( 'Showing search results for: %s', 'woocommerce' ), '<strong>' . esc_html( $_GET['search'] ) . '</strong>' ); ?>
  37. </h1>
  38. <?php endif; ?>
  39. <form class="search-form" method="GET">
  40. <button type="submit">
  41. <span class="dashicons dashicons-search"></span>
  42. </button>
  43. <input
  44. type="text"
  45. name="search"
  46. value="<?php echo esc_attr( isset( $_GET['search'] ) ? $_GET['search'] : '' ); ?>"
  47. placeholder="<?php _e( 'Enter a search term and press enter', 'woocommerce' ); ?>">
  48. <input type="hidden" name="page" value="wc-addons">
  49. <?php $page_section = ( isset( $_GET['section'] ) && '_featured' !== $_GET['section'] ) ? $_GET['section'] : '_all'; ?>
  50. <input type="hidden" name="section" value="<?php echo esc_attr( $page_section ); ?>">
  51. </form>
  52. <?php if ( '_featured' === $current_section ) : ?>
  53. <div class="addons-featured">
  54. <?php
  55. $featured = WC_Admin_Addons::get_featured();
  56. ?>
  57. </div>
  58. <?php endif; ?>
  59. <?php if ( '_featured' !== $current_section && $addons ) : ?>
  60. <?php if ( 'shipping_methods' === $current_section ) : ?>
  61. <div class="addons-shipping-methods">
  62. <?php WC_Admin_Addons::output_wcs_banner_block(); ?>
  63. </div>
  64. <?php endif; ?>
  65. <ul class="products">
  66. <?php foreach ( $addons as $addon ) : ?>
  67. <?php
  68. if ( 'shipping_methods' === $current_section ) {
  69. // Do not show USPS or Canada Post extensions for US and CA stores, respectively.
  70. $country = WC()->countries->get_base_country();
  71. if ( 'US' === $country
  72. && false !== strpos(
  73. $addon->link, 'woocommerce.com/products/usps-shipping-method'
  74. )
  75. ) {
  76. continue;
  77. }
  78. if ( 'CA' === $country
  79. && false !== strpos(
  80. $addon->link, 'woocommerce.com/products/canada-post-shipping-method'
  81. )
  82. ) {
  83. continue;
  84. }
  85. }
  86. ?>
  87. <li class="product">
  88. <a href="<?php echo esc_attr( $addon->link ); ?>">
  89. <?php if ( ! empty( $addon->image ) ) : ?>
  90. <span class="product-img-wrap"><img src="<?php echo esc_url( $addon->image ); ?>"/></span>
  91. <?php else : ?>
  92. <h2><?php echo esc_html( $addon->title ); ?></h2>
  93. <?php endif; ?>
  94. <span class="price"><?php echo wp_kses_post( $addon->price ); ?></span>
  95. <p><?php echo wp_kses_post( $addon->excerpt ); ?></p>
  96. </a>
  97. </li>
  98. <?php endforeach; ?>
  99. </ul>
  100. <?php endif; ?>
  101. <?php else : ?>
  102. <p><?php printf( __( 'Our catalog of WooCommerce Extensions can be found on WooCommerce.com here: <a href="%s">WooCommerce Extensions Catalog</a>', 'woocommerce' ), 'https://woocommerce.com/product-category/woocommerce-extensions/' ); ?></p>
  103. <?php endif; ?>
  104. <?php if ( 'Storefront' !== $theme['Name'] && '_featured' !== $current_section ) : ?>
  105. <div class="storefront">
  106. <a href="<?php echo esc_url( 'https://woocommerce.com/storefront/' ); ?>" target="_blank"><img src="<?php echo WC()->plugin_url(); ?>/assets/images/storefront.png" alt="Storefront" /></a>
  107. <h2><?php _e( 'Looking for a WooCommerce theme?', 'woocommerce' ); ?></h2>
  108. <p><?php _e( 'We recommend Storefront, the <em>official</em> WooCommerce theme.', 'woocommerce' ); ?></p>
  109. <p><?php _e( 'Storefront is an intuitive, flexible and <strong>free</strong> WordPress theme offering deep integration with WooCommerce and many of the most popular customer-facing extensions.', 'woocommerce' ); ?></p>
  110. <p>
  111. <a href="https://woocommerce.com/storefront/" target="_blank" class="button"><?php _e( 'Read all about it', 'woocommerce' ); ?></a>
  112. <a href="<?php echo esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-theme&theme=storefront' ), 'install-theme_storefront' ) ); ?>" class="button button-primary"><?php _e( 'Download &amp; install', 'woocommerce' ); ?></a>
  113. </p>
  114. </div>
  115. <?php endif; ?>
  116. </div>