woocommerce/includes/admin/views/html-admin-page-addons.php

135 lines
5.7 KiB
PHP
Raw Normal View History

<?php
/**
* Admin View: Page - Addons
2014-10-07 10:04:48 +00:00
*
2020-08-05 16:36:24 +00:00
* @package WooCommerce\Admin
2015-01-30 14:21:46 +00:00
* @var string $view
* @var object $addons
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
2016-02-23 09:11:02 +00:00
?>
2013-08-06 13:04:24 +00:00
<div class="wrap woocommerce wc_addons_wrap">
<nav class="nav-tab-wrapper woo-nav-tab-wrapper">
<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>
<?php
$count_html = WC_Helper_Updater::get_updates_count_html();
// translators: Count of updates for WooCommerce.com subscriptions.
$menu_title = sprintf( __( 'WooCommerce.com Subscriptions %s', 'woocommerce' ), $count_html );
?>
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons&section=helper' ) ); ?>" class="nav-tab"><?php echo wp_kses_post( $menu_title ); ?></a>
</nav>
<h1 class="screen-reader-text"><?php esc_html_e( 'WooCommerce Extensions', 'woocommerce' ); ?></h1>
<?php if ( $sections ) : ?>
2014-03-06 15:25:05 +00:00
<ul class="subsubsub">
2017-12-05 15:06:58 +00:00
<?php foreach ( $sections as $section ) : ?>
<li>
<a
class="<?php echo $current_section === $section->slug ? 'current' : ''; ?>"
href="<?php echo esc_url( admin_url( 'admin.php?page=wc-addons&section=' . esc_attr( $section->slug ) ) ); ?>">
2017-12-05 15:06:58 +00:00
<?php echo esc_html( $section->label ); ?>
</a>
</li>
<?php endforeach; ?>
2014-03-06 15:25:05 +00:00
</ul>
2017-12-05 16:15:09 +00:00
2019-08-30 17:33:59 +00:00
<?php if ( isset( $_GET['search'] ) ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>
2017-12-05 16:15:09 +00:00
<h1 class="search-form-title" >
<?php // translators: search keyword. ?>
2019-09-15 15:27:49 +00:00
<?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 ?>
2017-12-05 16:15:09 +00:00
</h1>
<?php endif; ?>
<form class="search-form" method="GET">
<button type="submit">
<span class="dashicons dashicons-search"></span>
</button>
2017-12-06 17:02:09 +00:00
<input
type="text"
name="search"
2019-08-30 17:33:59 +00:00
value="<?php echo esc_attr( isset( $_GET['search'] ) ? sanitize_text_field( wp_unslash( $_GET['search'] ) ) : '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>"
placeholder="<?php esc_attr_e( 'Enter a search term and press enter', 'woocommerce' ); ?>">
<input type="hidden" name="page" value="wc-addons">
2021-04-16 09:54:10 +00:00
<input type="hidden" name="section" value="_all">
</form>
2017-12-05 15:06:58 +00:00
<?php if ( '_featured' === $current_section ) : ?>
2016-09-20 17:42:46 +00:00
<div class="addons-featured">
<?php
$featured = WC_Admin_Addons::get_featured();
?>
</div>
<?php endif; ?>
2017-12-05 15:06:58 +00:00
<?php if ( '_featured' !== $current_section && $addons ) : ?>
<?php if ( 'shipping_methods' === $current_section ) : ?>
<div class="addons-shipping-methods">
<?php WC_Admin_Addons::output_wcs_banner_block(); ?>
</div>
<?php endif; ?>
<?php if ( 'payment-gateways' === $current_section ) : ?>
<div class="addons-shipping-methods">
2020-11-09 12:20:24 +00:00
<?php WC_Admin_Addons::output_wcpay_banner_block(); ?>
</div>
<?php endif; ?>
<ul class="products">
<?php foreach ( $addons as $addon ) : ?>
<?php
if ( 'shipping_methods' === $current_section ) {
// Do not show USPS or Canada Post extensions for US and CA stores, respectively.
$country = WC()->countries->get_base_country();
if ( 'US' === $country
&& false !== strpos(
$addon->link,
'woocommerce.com/products/usps-shipping-method'
)
) {
continue;
}
if ( 'CA' === $country
&& false !== strpos(
$addon->link,
'woocommerce.com/products/canada-post-shipping-method'
)
) {
continue;
}
}
?>
<li class="product">
<a href="<?php echo esc_attr( WC_Admin_Addons::add_in_app_purchase_url_params( $addon->link ) ); ?>">
<?php if ( ! empty( $addon->image ) ) : ?>
2017-12-08 13:23:08 +00:00
<span class="product-img-wrap"><img src="<?php echo esc_url( $addon->image ); ?>"/></span>
<?php else : ?>
<h2><?php echo esc_html( $addon->title ); ?></h2>
<?php endif; ?>
<span class="price"><?php echo wp_kses_post( $addon->price ); ?></span>
<p><?php echo wp_kses_post( $addon->excerpt ); ?></p>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
2014-03-06 15:25:05 +00:00
<?php else : ?>
<?php /* translators: a url */ ?>
2019-09-07 06:53:33 +00:00
<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>
2014-03-06 15:25:05 +00:00
<?php endif; ?>
2017-12-05 15:06:58 +00:00
<?php if ( 'Storefront' !== $theme['Name'] && '_featured' !== $current_section ) : ?>
<div class="storefront">
<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>
<h2><?php esc_html_e( 'Looking for a WooCommerce theme?', 'woocommerce' ); ?></h2>
<p><?php echo wp_kses_post( __( 'We recommend Storefront, the <em>official</em> WooCommerce theme.', 'woocommerce' ) ); ?></p>
<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>
<p>
<a href="https://woocommerce.com/storefront/" target="_blank" class="button"><?php esc_html_e( 'Read all about it', 'woocommerce' ); ?></a>
<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>
</p>
</div>
<?php endif; ?>
2014-05-23 12:54:26 +00:00
</div>