html-admin-page-addons.php
5 years ago
html-admin-page-product-export.php
5 years ago
html-admin-page-reports.php
5 years ago
html-admin-page-status-logs-db.php
5 years ago
html-admin-page-status-logs.php
5 years ago
html-admin-page-status-report.php
5 years ago
html-admin-page-status-tools.php
8 years ago
html-admin-page-status.php
8 years ago
html-admin-settings.php
5 years ago
html-bulk-edit-product.php
5 years ago
html-email-template-preview.php
7 years ago
html-notice-base-table-missing.php
5 years ago
html-notice-custom.php
8 years ago
html-notice-install.php
5 years ago
html-notice-legacy-shipping.php
7 years ago
html-notice-maxmind-license-key.php
6 years ago
html-notice-no-shipping-methods.php
7 years ago
html-notice-redirect-only-download.php
6 years ago
html-notice-regenerating-lookup-table.php
5 years ago
html-notice-regenerating-thumbnails.php
8 years ago
html-notice-secure-connection.php
8 years ago
html-notice-template-check.php
5 years ago
html-notice-update.php
7 years ago
html-notice-updated.php
7 years ago
html-notice-updating.php
6 years ago
html-notice-uploads-directory-is-unprotected.php
6 years ago
html-notice-wp-php-minimum-requirements.php
6 years ago
html-quick-edit-product.php
5 years ago
html-report-by-date.php
5 years ago
html-admin-page-addons.php
136 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Admin View: Page - Addons |
| 4 | * |
| 5 | * @package WooCommerce\Admin |
| 6 | * @var string $view |
| 7 | * @var object $addons |
| 8 | */ |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit; |
| 12 | } |
| 13 | |
| 14 | ?> |
| 15 | <div class="wrap woocommerce wc_addons_wrap"> |
| 16 | <nav class="nav-tab-wrapper woo-nav-tab-wrapper"> |
| 17 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons' ) ); ?>" class="nav-tab nav-tab-active"><?php esc_html_e( 'Browse Extensions', 'woocommerce' ); ?></a> |
| 18 | |
| 19 | <?php |
| 20 | $count_html = WC_Helper_Updater::get_updates_count_html(); |
| 21 | // translators: Count of updates for WooCommerce.com subscriptions. |
| 22 | $menu_title = sprintf( __( 'WooCommerce.com Subscriptions %s', 'woocommerce' ), $count_html ); |
| 23 | ?> |
| 24 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons§ion=helper' ) ); ?>" class="nav-tab"><?php echo wp_kses_post( $menu_title ); ?></a> |
| 25 | </nav> |
| 26 | |
| 27 | <h1 class="screen-reader-text"><?php esc_html_e( 'WooCommerce Extensions', 'woocommerce' ); ?></h1> |
| 28 | |
| 29 | <?php if ( $sections ) : ?> |
| 30 | <ul class="subsubsub"> |
| 31 | <?php foreach ( $sections as $section ) : ?> |
| 32 | <li> |
| 33 | <a |
| 34 | class="<?php echo $current_section === $section->slug ? 'current' : ''; ?>" |
| 35 | href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons§ion=' . esc_attr( $section->slug ) ) ); ?>"> |
| 36 | <?php echo esc_html( $section->label ); ?> |
| 37 | </a> |
| 38 | </li> |
| 39 | <?php endforeach; ?> |
| 40 | </ul> |
| 41 | |
| 42 | <?php if ( isset( $_GET['search'] ) ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?> |
| 43 | <h1 class="search-form-title" > |
| 44 | <?php // translators: search keyword. ?> |
| 45 | <?php printf( esc_html__( 'Showing search results for: %s', 'woocommerce' ), '<strong>' . esc_html( sanitize_text_field( wp_unslash( $_GET['search'] ) ) ) . '</strong>' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?> |
| 46 | </h1> |
| 47 | <?php endif; ?> |
| 48 | |
| 49 | <form class="search-form" method="GET"> |
| 50 | <button type="submit"> |
| 51 | <span class="dashicons dashicons-search"></span> |
| 52 | </button> |
| 53 | <input |
| 54 | type="text" |
| 55 | name="search" |
| 56 | value="<?php echo esc_attr( isset( $_GET['search'] ) ? sanitize_text_field( wp_unslash( $_GET['search'] ) ) : '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>" |
| 57 | placeholder="<?php esc_attr_e( 'Enter a search term and press enter', 'woocommerce' ); ?>"> |
| 58 | <input type="hidden" name="page" value="wc-addons"> |
| 59 | <?php $page_section = ( isset( $_GET['section'] ) && '_featured' !== $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : '_all'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?> |
| 60 | <input type="hidden" name="section" value="<?php echo esc_attr( $page_section ); ?>"> |
| 61 | </form> |
| 62 | <?php if ( '_featured' === $current_section ) : ?> |
| 63 | <div class="addons-featured"> |
| 64 | <?php |
| 65 | $featured = WC_Admin_Addons::get_featured(); |
| 66 | ?> |
| 67 | </div> |
| 68 | <?php endif; ?> |
| 69 | <?php if ( '_featured' !== $current_section && $addons ) : ?> |
| 70 | <?php if ( 'shipping_methods' === $current_section ) : ?> |
| 71 | <div class="addons-shipping-methods"> |
| 72 | <?php WC_Admin_Addons::output_wcs_banner_block(); ?> |
| 73 | </div> |
| 74 | <?php endif; ?> |
| 75 | <?php if ( 'payment-gateways' === $current_section ) : ?> |
| 76 | <div class="addons-shipping-methods"> |
| 77 | <?php WC_Admin_Addons::output_wcpay_banner_block(); ?> |
| 78 | </div> |
| 79 | <?php endif; ?> |
| 80 | <ul class="products"> |
| 81 | <?php foreach ( $addons as $addon ) : ?> |
| 82 | <?php |
| 83 | if ( 'shipping_methods' === $current_section ) { |
| 84 | // Do not show USPS or Canada Post extensions for US and CA stores, respectively. |
| 85 | $country = WC()->countries->get_base_country(); |
| 86 | if ( 'US' === $country |
| 87 | && false !== strpos( |
| 88 | $addon->link, |
| 89 | 'woocommerce.com/products/usps-shipping-method' |
| 90 | ) |
| 91 | ) { |
| 92 | continue; |
| 93 | } |
| 94 | if ( 'CA' === $country |
| 95 | && false !== strpos( |
| 96 | $addon->link, |
| 97 | 'woocommerce.com/products/canada-post-shipping-method' |
| 98 | ) |
| 99 | ) { |
| 100 | continue; |
| 101 | } |
| 102 | } |
| 103 | ?> |
| 104 | <li class="product"> |
| 105 | <a href="<?php echo esc_attr( WC_Admin_Addons::add_in_app_purchase_url_params( $addon->link ) ); ?>"> |
| 106 | <?php if ( ! empty( $addon->image ) ) : ?> |
| 107 | <span class="product-img-wrap"><img src="<?php echo esc_url( $addon->image ); ?>"/></span> |
| 108 | <?php else : ?> |
| 109 | <h2><?php echo esc_html( $addon->title ); ?></h2> |
| 110 | <?php endif; ?> |
| 111 | <span class="price"><?php echo wp_kses_post( $addon->price ); ?></span> |
| 112 | <p><?php echo wp_kses_post( $addon->excerpt ); ?></p> |
| 113 | </a> |
| 114 | </li> |
| 115 | <?php endforeach; ?> |
| 116 | </ul> |
| 117 | <?php endif; ?> |
| 118 | <?php else : ?> |
| 119 | <?php /* translators: a url */ ?> |
| 120 | <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> |
| 121 | <?php endif; ?> |
| 122 | |
| 123 | <?php if ( 'Storefront' !== $theme['Name'] && '_featured' !== $current_section ) : ?> |
| 124 | <div class="storefront"> |
| 125 | <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> |
| 126 | <h2><?php esc_html_e( 'Looking for a WooCommerce theme?', 'woocommerce' ); ?></h2> |
| 127 | <p><?php echo wp_kses_post( __( 'We recommend Storefront, the <em>official</em> WooCommerce theme.', 'woocommerce' ) ); ?></p> |
| 128 | <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> |
| 129 | <p> |
| 130 | <a href="https://woocommerce.com/storefront/" target="_blank" class="button"><?php esc_html_e( 'Read all about it', 'woocommerce' ); ?></a> |
| 131 | <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 & install', 'woocommerce' ); ?></a> |
| 132 | </p> |
| 133 | </div> |
| 134 | <?php endif; ?> |
| 135 | </div> |
| 136 |