Nenhuma Descrição

html-admin-page-addons.php 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?php
  2. /**
  3. * Admin View: Page - Addons
  4. *
  5. * @package WooCommerce\Admin
  6. * @var string $view
  7. * @var object $addons
  8. */
  9. if ( ! defined( 'ABSPATH' ) ) {
  10. exit;
  11. }
  12. $current_section_name = __( 'Browse Categories', 'woocommerce' );
  13. ?>
  14. <div class="woocommerce wc-addons-wrap">
  15. <h1 class="screen-reader-text"><?php esc_html_e( 'Marketplace', 'woocommerce' ); ?></h1>
  16. <?php if ( $sections ) : ?>
  17. <div class="marketplace-header">
  18. <h1 class="marketplace-header__title"><?php esc_html_e( 'WooCommerce Marketplace', 'woocommerce' ); ?></h1>
  19. <p class="marketplace-header__description"><?php esc_html_e( 'Grow your business with hundreds of free and paid WooCommerce extensions.', 'woocommerce' ); ?></p>
  20. <form class="marketplace-header__search-form" method="GET">
  21. <input
  22. type="text"
  23. name="search"
  24. value="<?php echo esc_attr( ! empty( $search ) ? sanitize_text_field( wp_unslash( $search ) ) : '' ); ?>"
  25. placeholder="<?php esc_attr_e( 'Search for extensions', 'woocommerce' ); ?>"
  26. />
  27. <button type="submit">
  28. <span class="dashicons dashicons-search"></span>
  29. </button>
  30. <input type="hidden" name="page" value="wc-addons">
  31. <input type="hidden" name="section" value="_all">
  32. </form>
  33. </div>
  34. <div class="top-bar">
  35. <div id="marketplace-current-section-dropdown" class="current-section-dropdown">
  36. <ul>
  37. <?php foreach ( $sections as $section ) : ?>
  38. <?php
  39. if ( $current_section === $section->slug && '_featured' !== $section->slug ) {
  40. $current_section_name = $section->label;
  41. }
  42. ?>
  43. <li>
  44. <a
  45. class="<?php echo $current_section === $section->slug ? 'current' : ''; ?>"
  46. href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons&section=' . esc_attr( $section->slug ) ) ); ?>">
  47. <?php echo esc_html( $section->label ); ?>
  48. </a>
  49. </li>
  50. <?php endforeach; ?>
  51. </ul>
  52. <div id="marketplace-current-section-name" class="current-section-name"><?php echo esc_html( $current_section_name ); ?></div>
  53. </div>
  54. </div>
  55. <div class="wp-header-end"></div>
  56. <div class="wrap">
  57. <div class="marketplace-content-wrapper">
  58. <?php if ( ! empty( $search ) ) : ?>
  59. <h1 class="search-form-title">
  60. <?php // translators: search keyword. ?>
  61. <?php printf( esc_html__( 'Search results for "%s"', 'woocommerce' ), esc_html( sanitize_text_field( wp_unslash( $search ) ) ) ); ?>
  62. </h1>
  63. <?php endif; ?>
  64. <?php if ( '_featured' === $current_section ) : ?>
  65. <div class="addons-featured">
  66. <?php
  67. $featured = WC_Admin_Addons::get_featured();
  68. ?>
  69. </div>
  70. <?php endif; ?>
  71. <?php if ( '_featured' !== $current_section && $addons ) : ?>
  72. <?php if ( 'shipping_methods' === $current_section ) : ?>
  73. <div class="addons-shipping-methods">
  74. <?php WC_Admin_Addons::output_wcs_banner_block(); ?>
  75. </div>
  76. <?php endif; ?>
  77. <?php if ( 'payment-gateways' === $current_section ) : ?>
  78. <div class="addons-shipping-methods">
  79. <?php WC_Admin_Addons::output_wcpay_banner_block(); ?>
  80. </div>
  81. <?php endif; ?>
  82. <ul class="products">
  83. <?php foreach ( $addons as $addon ) : ?>
  84. <?php
  85. if ( 'shipping_methods' === $current_section ) {
  86. // Do not show USPS or Canada Post extensions for US and CA stores, respectively.
  87. $country = WC()->countries->get_base_country();
  88. if ( 'US' === $country
  89. && false !== strpos(
  90. $addon->link,
  91. 'woocommerce.com/products/usps-shipping-method'
  92. )
  93. ) {
  94. continue;
  95. }
  96. if ( 'CA' === $country
  97. && false !== strpos(
  98. $addon->link,
  99. 'woocommerce.com/products/canada-post-shipping-method'
  100. )
  101. ) {
  102. continue;
  103. }
  104. }
  105. ?>
  106. <li class="product">
  107. <div class="product-details">
  108. <?php if ( ! empty( $addon->image ) ) : ?>
  109. <span class="product-img-wrap"><img src="<?php echo esc_url( $addon->image ); ?>" /></span>
  110. <?php endif; ?>
  111. <a href="<?php echo esc_url( WC_Admin_Addons::add_in_app_purchase_url_params( $addon->link ) ); ?>">
  112. <h2><?php echo esc_html( $addon->title ); ?></h2>
  113. </a>
  114. <p><?php echo wp_kses_post( $addon->excerpt ); ?></p>
  115. </div>
  116. <div class="product-footer">
  117. <?php if ( '&#36;0.00' === $addon->price ) : ?>
  118. <span class="price"><?php esc_html_e( 'Free', 'woocommerce' ); ?></span>
  119. <?php else : ?>
  120. <span class="price"><?php echo wp_kses_post( $addon->price ); ?></span>
  121. <span class="price_suffix"><?php esc_html_e( 'per year', 'woocommerce' ); ?></span>
  122. <?php endif; ?>
  123. <a class="button" href="<?php echo esc_url( WC_Admin_Addons::add_in_app_purchase_url_params( $addon->link ) ); ?>">
  124. <?php esc_html_e( 'View details', 'woocommerce' ); ?>
  125. </a>
  126. </div>
  127. </li>
  128. <?php endforeach; ?>
  129. </ul>
  130. <?php endif; ?>
  131. </div>
  132. <?php else : ?>
  133. <?php /* translators: a url */ ?>
  134. <p><?php printf( wp_kses_post( __( '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>
  135. <?php endif; ?>
  136. <?php if ( 'Storefront' !== $theme['Name'] && '_featured' !== $current_section ) : ?>
  137. <div class="storefront">
  138. <a href="<?php echo esc_url( 'https://woocommerce.com/storefront/' ); ?>" target="_blank"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/storefront.png" alt="<?php esc_attr_e( 'Storefront', 'woocommerce' ); ?>" /></a>
  139. <h2><?php esc_html_e( 'Looking for a WooCommerce theme?', 'woocommerce' ); ?></h2>
  140. <p><?php echo wp_kses_post( __( 'We recommend Storefront, the <em>official</em> WooCommerce theme.', 'woocommerce' ) ); ?></p>
  141. <p><?php echo wp_kses_post( __( '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>
  142. <p>
  143. <a href="https://woocommerce.com/storefront/" target="_blank" class="button"><?php esc_html_e( 'Read all about it', 'woocommerce' ); ?></a>
  144. <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 esc_html_e( 'Download &amp; install', 'woocommerce' ); ?></a>
  145. </p>
  146. </div>
  147. <?php endif; ?>
  148. </div>
  149. </div>