2014-07-28 14:50:11 +00:00
< ? 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
2014-07-28 14:50:11 +00:00
*/
2019-07-04 03:50:40 +00:00
2014-07-28 15:16:35 +00:00
if ( ! defined ( 'ABSPATH' ) ) {
2015-12-03 13:38:13 +00:00
exit ;
2014-07-28 15:16:35 +00:00
}
2016-02-23 09:11:02 +00:00
2021-08-13 09:29:12 +00:00
$current_section_name = __ ( 'Browse Categories' , woocommerce );
2014-07-28 14:50:11 +00:00
?>
2021-08-09 15:48:57 +00:00
< div class = " woocommerce wc-addons-wrap " >
2021-08-05 16:05:48 +00:00
< h1 class = " screen-reader-text " >< ? php esc_html_e ( 'Marketplace' , 'woocommerce' ); ?> </h1>
2021-08-09 15:48:57 +00:00
2015-12-03 13:38:13 +00:00
< ? php if ( $sections ) : ?>
2021-08-09 15:48:57 +00:00
< div class = " marketplace-header " >
< h1 class = " marketplace-header__title " >< ? php esc_html_e ( 'WooCommerce Marketplace' , 'woocommerce' ); ?> </h1>
< p class = " marketplace-header__description " >< ? php esc_html_e ( 'Grow your business with hundreds of free and paid WooCommerce extensions.' , 'woocommerce' ); ?> </p>
< form class = " marketplace-header__search-form " method = " GET " >
< input
type = " text "
name = " search "
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( 'Search for extensions', 'woocommerce' ); ?> "
/>
< button type = " submit " >
< span class = " dashicons dashicons-search " ></ span >
</ button >
< input type = " hidden " name = " page " value = " wc-addons " >
< input type = " hidden " name = " section " value = " _all " >
</ form >
</ div >
2017-12-05 16:15:09 +00:00
2021-08-11 14:13:49 +00:00
< div class = " top-bar " >
2021-08-13 09:29:12 +00:00
< div class = " current-section-dropdown " >
2021-08-11 14:13:49 +00:00
< ul >
< ? php foreach ( $sections as $section ) : ?>
2021-08-13 09:29:12 +00:00
< ? php if ( $current_section === $section -> slug ) {
$current_section_name = $section -> label ;
$add_current_class = true ;
} else {
$add_current_class = false ;
} ?>
2021-08-11 14:13:49 +00:00
< li >
< a
2021-08-13 09:29:12 +00:00
class = " <?php echo $add_current_class ? 'current' : ''; ?> "
2021-08-11 14:13:49 +00:00
href = " <?php echo esc_url( admin_url( 'admin.php?page=wc-addons§ion=' . esc_attr( $section->slug ) ) ); ?> " >
< ? php echo esc_html ( $section -> label ); ?>
</ a >
</ li >
< ? php endforeach ; ?>
</ ul >
2021-08-13 09:29:12 +00:00
< div class = " current-section-name " >< ? php echo esc_html ( $current_section_name ); ?> </div>
</ div >
2021-08-11 14:13:49 +00:00
</ div >
2021-08-12 15:51:15 +00:00
2021-08-11 16:42:11 +00:00
< div class = " wp-header-end " ></ div >
2021-08-09 15:48:57 +00:00
< div class = " wrap " >
2021-08-05 09:03:28 +00:00
< div class = " marketplace-content-wrapper " >
2021-08-09 15:48:57 +00:00
< ? php if ( isset ( $_GET [ 'search' ] ) ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>
< h1 class = " search-form-title " >
< ? php // translators: search keyword. ?>
< ? 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 ?>
</ h1 >
< ? php endif ; ?>
2017-12-05 16:15:09 +00:00
2021-08-09 15:48:57 +00:00
< ? php if ( '_featured' === $current_section ) : ?>
< div class = " addons-featured " >
< ? php
2016-09-20 17:42:46 +00:00
$featured = WC_Admin_Addons :: get_featured ();
2021-08-09 15:48:57 +00:00
?>
2020-11-09 12:19:11 +00:00
</ div >
< ? php endif ; ?>
2021-08-09 15:48:57 +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 (); ?>
2021-08-03 11:35:58 +00:00
</ div >
2021-08-09 15:48:57 +00:00
< ? php endif ; ?>
< ? php if ( 'payment-gateways' === $current_section ) : ?>
< div class = " addons-shipping-methods " >
< ? php WC_Admin_Addons :: output_wcpay_banner_block (); ?>
2021-08-03 11:35:58 +00:00
</ div >
2021-08-09 15:48:57 +00:00
< ? 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
2021-08-09 16:02:58 +00:00
&& false !== strpos (
2021-08-09 15:48:57 +00:00
$addon -> link ,
'woocommerce.com/products/usps-shipping-method'
)
) {
continue ;
}
if ( 'CA' === $country
2021-08-09 16:02:58 +00:00
&& false !== strpos (
2021-08-09 15:48:57 +00:00
$addon -> link ,
'woocommerce.com/products/canada-post-shipping-method'
)
) {
continue ;
}
}
?>
< li class = " product " >
< div class = " product-details " >
< ? php if ( ! empty ( $addon -> image ) ) : ?>
< span class = " product-img-wrap " >< img src = " <?php echo esc_url( $addon->image ); ?> " /></ span >
< ? php endif ; ?>
< a href = " <?php echo esc_attr( WC_Admin_Addons::add_in_app_purchase_url_params( $addon->link ) ); ?> " >
< h2 >< ? php echo esc_html ( $addon -> title ); ?> </h2>
</ a >
< p >< ? php echo wp_kses_post ( $addon -> excerpt ); ?> </p>
</ div >
< div class = " product-footer " >
< ? php if ( '$0.00' === $addon -> price ) : ?>
2021-08-09 16:02:58 +00:00
< span class = " price " >< ? php esc_html_e ( 'Free' , 'woocommerce' ); ?> </span>
2021-08-09 15:48:57 +00:00
< ? php else : ?>
< span class = " price " >< ? php echo wp_kses_post ( $addon -> price ); ?> </span>
2021-08-09 16:02:58 +00:00
< span class = " price_suffix " >< ? php esc_html_e ( 'per year' , 'woocommerce' ); ?> </span>
2021-08-09 15:48:57 +00:00
< ? php endif ; ?>
< a class = " button " href = " <?php echo esc_attr( WC_Admin_Addons::add_in_app_purchase_url_params( $addon->link ) ); ?> " >
2021-08-09 16:02:58 +00:00
< ? php esc_html_e ( 'View details' , 'woocommerce' ); ?>
2021-08-09 15:48:57 +00:00
</ a >
</ div >
</ li >
< ? php endforeach ; ?>
</ ul >
< ? php endif ; ?>
2021-08-05 09:03:28 +00:00
</ div >
2021-08-09 15:48:57 +00:00
< ? php else : ?>
< ? php /* translators: a url */ ?>
< 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>
< ? php endif ; ?>
2014-12-16 11:43:26 +00:00
2021-08-09 15:48:57 +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 & install' , 'woocommerce' ); ?> </a>
</ p >
</ div >
< ? php endif ; ?>
</ div >
2014-05-23 12:54:26 +00:00
</ div >