2013-07-24 16:01:36 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-11-03 13:53:50 +00:00
|
|
|
* WooCommerce Admin
|
2013-07-24 16:01:36 +00:00
|
|
|
*
|
2016-05-20 21:02:57 +00:00
|
|
|
* @class WC_Admin
|
|
|
|
* @package WooCommerce/Admin
|
|
|
|
* @version 2.6.0
|
2013-07-24 16:01:36 +00:00
|
|
|
*/
|
2014-09-20 19:52:30 +00:00
|
|
|
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
2019-03-07 21:05:59 +00:00
|
|
|
exit; // Exit if accessed directly.
|
2014-09-20 19:52:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WC_Admin class.
|
|
|
|
*/
|
2013-07-24 16:01:36 +00:00
|
|
|
class WC_Admin {
|
|
|
|
|
|
|
|
/**
|
2015-11-03 12:28:01 +00:00
|
|
|
* Constructor.
|
2013-07-24 16:01:36 +00:00
|
|
|
*/
|
|
|
|
public function __construct() {
|
2013-11-07 09:53:24 +00:00
|
|
|
add_action( 'init', array( $this, 'includes' ) );
|
2015-07-06 09:49:31 +00:00
|
|
|
add_action( 'current_screen', array( $this, 'conditional_includes' ) );
|
2016-04-28 11:36:49 +00:00
|
|
|
add_action( 'admin_init', array( $this, 'buffer' ), 1 );
|
2013-08-06 15:56:15 +00:00
|
|
|
add_action( 'admin_init', array( $this, 'preview_emails' ) );
|
2015-07-04 22:11:12 +00:00
|
|
|
add_action( 'admin_init', array( $this, 'prevent_admin_access' ) );
|
|
|
|
add_action( 'admin_init', array( $this, 'admin_redirects' ) );
|
2015-07-06 09:49:31 +00:00
|
|
|
add_action( 'admin_footer', 'wc_print_js', 25 );
|
2015-01-29 12:41:39 +00:00
|
|
|
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
|
2017-09-10 22:48:38 +00:00
|
|
|
add_action( 'wp_ajax_setup_wizard_check_jetpack', array( $this, 'setup_wizard_check_jetpack' ) );
|
2019-03-01 03:12:30 +00:00
|
|
|
add_action( 'init', array( 'WC_Site_Tracking', 'init' ) );
|
2019-04-23 15:02:36 +00:00
|
|
|
|
|
|
|
// Disable WXR export of schedule action posts.
|
|
|
|
add_filter( 'action_scheduler_post_type_args', array( $this, 'disable_webhook_post_export' ) );
|
2020-04-22 20:32:26 +00:00
|
|
|
|
|
|
|
// Add body class for WP 5.3+ compatibility.
|
2020-04-22 22:19:27 +00:00
|
|
|
add_filter( 'admin_body_class', array( $this, 'include_admin_body_class' ) );
|
2013-07-24 16:01:36 +00:00
|
|
|
}
|
|
|
|
|
2016-04-28 11:36:49 +00:00
|
|
|
/**
|
|
|
|
* Output buffering allows admin screens to make redirects later on.
|
|
|
|
*/
|
|
|
|
public function buffer() {
|
|
|
|
ob_start();
|
|
|
|
}
|
|
|
|
|
2013-07-24 16:01:36 +00:00
|
|
|
/**
|
|
|
|
* Include any classes we need within admin.
|
|
|
|
*/
|
|
|
|
public function includes() {
|
2018-03-05 18:59:17 +00:00
|
|
|
include_once dirname( __FILE__ ) . '/wc-admin-functions.php';
|
|
|
|
include_once dirname( __FILE__ ) . '/wc-meta-box-functions.php';
|
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-post-types.php';
|
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-taxonomies.php';
|
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-menus.php';
|
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-customize.php';
|
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-notices.php';
|
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-assets.php';
|
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-api-keys.php';
|
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-webhooks.php';
|
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-pointers.php';
|
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-importers.php';
|
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-exporters.php';
|
2013-07-24 16:01:36 +00:00
|
|
|
|
2019-02-01 01:26:38 +00:00
|
|
|
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks.php';
|
|
|
|
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks-event.php';
|
|
|
|
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks-client.php';
|
2019-02-22 19:00:38 +00:00
|
|
|
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks-footer-pixel.php';
|
2019-02-01 01:26:38 +00:00
|
|
|
include_once WC_ABSPATH . 'includes/tracks/class-wc-site-tracking.php';
|
|
|
|
|
2019-03-07 21:05:59 +00:00
|
|
|
// Help Tabs.
|
2015-04-29 10:32:03 +00:00
|
|
|
if ( apply_filters( 'woocommerce_enable_admin_help_tab', true ) ) {
|
2018-03-05 18:59:17 +00:00
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-help.php';
|
2015-04-29 10:32:03 +00:00
|
|
|
}
|
2013-07-24 16:01:36 +00:00
|
|
|
|
2019-03-07 21:05:59 +00:00
|
|
|
// Setup/welcome.
|
2019-12-13 19:58:14 +00:00
|
|
|
if ( ! empty( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
|
|
|
switch ( $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
2018-03-05 18:59:17 +00:00
|
|
|
case 'wc-setup':
|
|
|
|
include_once dirname( __FILE__ ) . '/class-wc-admin-setup-wizard.php';
|
|
|
|
break;
|
2014-06-04 10:16:19 +00:00
|
|
|
}
|
2013-12-05 15:34:37 +00:00
|
|
|
}
|
2013-10-22 17:20:33 +00:00
|
|
|
|
2019-03-07 21:05:59 +00:00
|
|
|
// Helper.
|
2018-03-05 18:59:17 +00:00
|
|
|
include_once dirname( __FILE__ ) . '/helper/class-wc-helper.php';
|
2019-02-20 23:44:21 +00:00
|
|
|
|
|
|
|
// Marketplace suggestions & related REST API.
|
|
|
|
include_once dirname( __FILE__ ) . '/marketplace-suggestions/class-wc-marketplace-suggestions.php';
|
2019-02-22 19:34:18 +00:00
|
|
|
include_once dirname( __FILE__ ) . '/marketplace-suggestions/class-wc-marketplace-updater.php';
|
2013-07-24 16:01:36 +00:00
|
|
|
}
|
|
|
|
|
2013-08-06 15:56:15 +00:00
|
|
|
/**
|
2015-11-03 12:28:01 +00:00
|
|
|
* Include admin files conditionally.
|
2013-08-06 15:56:15 +00:00
|
|
|
*/
|
2015-07-06 09:49:31 +00:00
|
|
|
public function conditional_includes() {
|
2019-03-07 21:05:59 +00:00
|
|
|
$screen = get_current_screen();
|
|
|
|
|
|
|
|
if ( ! $screen ) {
|
2016-02-05 12:16:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-07-24 16:01:36 +00:00
|
|
|
|
|
|
|
switch ( $screen->id ) {
|
2018-03-05 18:59:17 +00:00
|
|
|
case 'dashboard':
|
|
|
|
case 'dashboard-network':
|
|
|
|
include 'class-wc-admin-dashboard.php';
|
|
|
|
break;
|
|
|
|
case 'options-permalink':
|
|
|
|
include 'class-wc-admin-permalink-settings.php';
|
|
|
|
break;
|
|
|
|
case 'plugins':
|
|
|
|
include 'plugin-updates/class-wc-plugins-screen-updates.php';
|
|
|
|
break;
|
|
|
|
case 'update-core':
|
|
|
|
include 'plugin-updates/class-wc-updates-screen-updates.php';
|
|
|
|
break;
|
|
|
|
case 'users':
|
|
|
|
case 'user':
|
|
|
|
case 'profile':
|
|
|
|
case 'user-edit':
|
|
|
|
include 'class-wc-admin-profile.php';
|
|
|
|
break;
|
2013-07-24 16:01:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-29 09:47:57 +00:00
|
|
|
/**
|
2015-04-29 10:24:29 +00:00
|
|
|
* Handle redirects to setup/welcome page after install and updates.
|
|
|
|
*
|
2016-05-11 16:01:34 +00:00
|
|
|
* For setup wizard, transient must be present, the user must have access rights, and we must ignore the network/bulk plugin updaters.
|
2015-04-29 09:47:57 +00:00
|
|
|
*/
|
|
|
|
public function admin_redirects() {
|
2020-02-07 11:58:31 +00:00
|
|
|
// Don't run this fn from Action Scheduler requests, as it would clear _wc_activation_redirect transient.
|
|
|
|
// That means OBW would never be shown.
|
2020-02-06 23:20:42 +00:00
|
|
|
if ( wc_is_running_from_async_action_scheduler() ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-12-13 19:58:14 +00:00
|
|
|
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
2019-03-07 21:05:59 +00:00
|
|
|
// Nonced plugin install redirects (whitelisted).
|
2016-05-11 16:01:34 +00:00
|
|
|
if ( ! empty( $_GET['wc-install-plugin-redirect'] ) ) {
|
2019-03-07 21:05:59 +00:00
|
|
|
$plugin_slug = wc_clean( wp_unslash( $_GET['wc-install-plugin-redirect'] ) );
|
2015-04-29 09:47:57 +00:00
|
|
|
|
2019-03-08 15:11:23 +00:00
|
|
|
if ( current_user_can( 'install_plugins' ) && in_array( $plugin_slug, array( 'woocommerce-gateway-stripe' ), true ) ) {
|
2016-05-11 16:01:34 +00:00
|
|
|
$nonce = wp_create_nonce( 'install-plugin_' . $plugin_slug );
|
|
|
|
$url = self_admin_url( 'update.php?action=install-plugin&plugin=' . $plugin_slug . '&_wpnonce=' . $nonce );
|
|
|
|
} else {
|
|
|
|
$url = admin_url( 'plugin-install.php?tab=search&type=term&s=' . $plugin_slug );
|
|
|
|
}
|
2015-07-04 22:11:12 +00:00
|
|
|
|
2016-05-11 16:01:34 +00:00
|
|
|
wp_safe_redirect( $url );
|
|
|
|
exit;
|
2015-07-04 22:11:12 +00:00
|
|
|
}
|
2015-04-29 09:47:57 +00:00
|
|
|
|
2019-03-07 21:05:59 +00:00
|
|
|
// Setup wizard redirect.
|
2019-03-08 15:11:23 +00:00
|
|
|
if ( get_transient( '_wc_activation_redirect' ) && apply_filters( 'woocommerce_enable_setup_wizard', true ) ) {
|
|
|
|
$do_redirect = true;
|
|
|
|
$current_page = isset( $_GET['page'] ) ? wc_clean( wp_unslash( $_GET['page'] ) ) : false;
|
2016-05-11 16:01:34 +00:00
|
|
|
|
2019-03-08 15:11:23 +00:00
|
|
|
// On these pages, or during these events, postpone the redirect.
|
|
|
|
if ( wp_doing_ajax() || is_network_admin() || ! current_user_can( 'manage_woocommerce' ) ) {
|
|
|
|
$do_redirect = false;
|
2016-05-11 16:01:34 +00:00
|
|
|
}
|
|
|
|
|
2019-03-08 15:11:23 +00:00
|
|
|
// On these pages, or during these events, disable the redirect.
|
|
|
|
if ( 'wc-setup' === $current_page || ! WC_Admin_Notices::has_notice( 'install' ) || apply_filters( 'woocommerce_prevent_automatic_wizard_redirect', false ) || isset( $_GET['activate-multi'] ) ) {
|
|
|
|
delete_transient( '_wc_activation_redirect' );
|
|
|
|
$do_redirect = false;
|
2016-05-11 16:01:34 +00:00
|
|
|
}
|
|
|
|
|
2019-03-08 15:11:23 +00:00
|
|
|
if ( $do_redirect ) {
|
|
|
|
delete_transient( '_wc_activation_redirect' );
|
2016-05-11 16:01:34 +00:00
|
|
|
wp_safe_redirect( admin_url( 'index.php?page=wc-setup' ) );
|
|
|
|
exit;
|
|
|
|
}
|
2015-04-29 09:47:57 +00:00
|
|
|
}
|
2019-12-13 19:58:14 +00:00
|
|
|
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
2015-04-29 09:47:57 +00:00
|
|
|
}
|
|
|
|
|
2013-08-06 15:56:15 +00:00
|
|
|
/**
|
2015-11-03 12:28:01 +00:00
|
|
|
* Prevent any user who cannot 'edit_posts' (subscribers, customers etc) from accessing admin.
|
2013-08-06 15:56:15 +00:00
|
|
|
*/
|
|
|
|
public function prevent_admin_access() {
|
|
|
|
$prevent_access = false;
|
|
|
|
|
2019-03-07 21:48:26 +00:00
|
|
|
if ( apply_filters( 'woocommerce_disable_admin_bar', true ) && ! is_ajax() && isset( $_SERVER['SCRIPT_FILENAME'] ) && basename( sanitize_text_field( wp_unslash( $_SERVER['SCRIPT_FILENAME'] ) ) ) !== 'admin-post.php' ) {
|
2016-06-21 10:18:14 +00:00
|
|
|
$has_cap = false;
|
|
|
|
$access_caps = array( 'edit_posts', 'manage_woocommerce', 'view_admin_dashboard' );
|
|
|
|
|
|
|
|
foreach ( $access_caps as $access_cap ) {
|
|
|
|
if ( current_user_can( $access_cap ) ) {
|
|
|
|
$has_cap = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-08-06 15:56:15 +00:00
|
|
|
|
2016-06-21 10:18:14 +00:00
|
|
|
if ( ! $has_cap ) {
|
|
|
|
$prevent_access = true;
|
|
|
|
}
|
|
|
|
}
|
2013-08-06 15:56:15 +00:00
|
|
|
|
2016-06-21 10:18:14 +00:00
|
|
|
if ( apply_filters( 'woocommerce_prevent_admin_access', $prevent_access ) ) {
|
2015-02-15 19:13:22 +00:00
|
|
|
wp_safe_redirect( wc_get_page_permalink( 'myaccount' ) );
|
2013-08-06 15:56:15 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-11-03 12:28:01 +00:00
|
|
|
* Preview email template.
|
2013-08-06 15:56:15 +00:00
|
|
|
*/
|
|
|
|
public function preview_emails() {
|
2014-11-30 06:52:32 +00:00
|
|
|
|
2013-08-06 15:56:15 +00:00
|
|
|
if ( isset( $_GET['preview_woocommerce_mail'] ) ) {
|
2019-04-17 23:08:00 +00:00
|
|
|
if ( ! ( isset( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'preview-mail' ) ) ) {
|
2013-08-06 15:56:15 +00:00
|
|
|
die( 'Security check' );
|
2014-06-17 21:40:54 +00:00
|
|
|
}
|
2013-08-06 15:56:15 +00:00
|
|
|
|
2019-03-07 21:05:59 +00:00
|
|
|
// load the mailer class.
|
2018-03-05 18:59:17 +00:00
|
|
|
$mailer = WC()->mailer();
|
2013-08-06 15:56:15 +00:00
|
|
|
|
2019-03-07 21:05:59 +00:00
|
|
|
// get the preview email subject.
|
2016-10-12 10:16:30 +00:00
|
|
|
$email_heading = __( 'HTML email template', 'woocommerce' );
|
2013-08-06 15:56:15 +00:00
|
|
|
|
2019-03-07 21:05:59 +00:00
|
|
|
// get the preview email content.
|
2014-12-16 18:32:54 +00:00
|
|
|
ob_start();
|
2018-03-05 18:59:17 +00:00
|
|
|
include 'views/html-email-template-preview.php';
|
|
|
|
$message = ob_get_clean();
|
2013-08-06 15:56:15 +00:00
|
|
|
|
2019-03-07 21:05:59 +00:00
|
|
|
// create a new email.
|
2018-03-05 18:59:17 +00:00
|
|
|
$email = new WC_Email();
|
2014-12-16 18:32:54 +00:00
|
|
|
|
2019-03-07 21:05:59 +00:00
|
|
|
// wrap the content with the email template and then add styles.
|
2018-03-05 18:59:17 +00:00
|
|
|
$message = apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
2014-12-16 18:32:54 +00:00
|
|
|
|
2019-03-07 21:05:59 +00:00
|
|
|
// print the preview email.
|
2019-03-10 22:59:05 +00:00
|
|
|
// phpcs:ignore WordPress.Security.EscapeOutput
|
2014-12-16 18:32:54 +00:00
|
|
|
echo $message;
|
2019-03-10 22:59:05 +00:00
|
|
|
// phpcs:enable
|
2013-08-06 15:56:15 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
2015-01-29 00:13:13 +00:00
|
|
|
|
|
|
|
/**
|
2015-11-03 12:28:01 +00:00
|
|
|
* Change the admin footer text on WooCommerce admin pages.
|
2015-01-29 00:13:13 +00:00
|
|
|
*
|
|
|
|
* @since 2.3
|
2019-03-07 21:05:59 +00:00
|
|
|
* @param string $footer_text text to be rendered in the footer.
|
2015-01-29 00:13:13 +00:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function admin_footer_text( $footer_text ) {
|
2016-08-27 14:46:23 +00:00
|
|
|
if ( ! current_user_can( 'manage_woocommerce' ) || ! function_exists( 'wc_get_screen_ids' ) ) {
|
2017-01-10 16:08:23 +00:00
|
|
|
return $footer_text;
|
2015-04-28 14:06:38 +00:00
|
|
|
}
|
2015-01-29 12:41:39 +00:00
|
|
|
$current_screen = get_current_screen();
|
2015-02-17 18:24:11 +00:00
|
|
|
$wc_pages = wc_get_screen_ids();
|
|
|
|
|
2017-01-10 16:08:23 +00:00
|
|
|
// Set only WC pages.
|
|
|
|
$wc_pages = array_diff( $wc_pages, array( 'profile', 'user-edit' ) );
|
2015-02-17 18:24:11 +00:00
|
|
|
|
2017-01-10 16:08:23 +00:00
|
|
|
// Check to make sure we're on a WooCommerce admin page.
|
2019-04-23 15:07:02 +00:00
|
|
|
if ( isset( $current_screen->id ) && apply_filters( 'woocommerce_display_admin_footer_text', in_array( $current_screen->id, $wc_pages, true ) ) ) {
|
2019-03-07 21:05:59 +00:00
|
|
|
// Change the footer text.
|
2015-02-19 11:38:35 +00:00
|
|
|
if ( ! get_option( 'woocommerce_admin_footer_text_rated' ) ) {
|
2017-08-24 21:39:13 +00:00
|
|
|
$footer_text = sprintf(
|
|
|
|
/* translators: 1: WooCommerce 2:: five stars */
|
|
|
|
__( 'If you like %1$s please leave us a %2$s rating. A huge thanks in advance!', 'woocommerce' ),
|
2017-10-04 09:48:22 +00:00
|
|
|
sprintf( '<strong>%s</strong>', esc_html__( 'WooCommerce', 'woocommerce' ) ),
|
2019-03-15 16:01:21 +00:00
|
|
|
'<a href="https://wordpress.org/support/plugin/woocommerce/reviews?rate=5#new-post" target="_blank" class="wc-rating-link" aria-label="' . esc_attr__( 'five star', 'woocommerce' ) . '" data-rated="' . esc_attr__( 'Thanks :)', 'woocommerce' ) . '">★★★★★</a>'
|
2017-08-24 21:39:13 +00:00
|
|
|
);
|
2018-03-05 18:59:17 +00:00
|
|
|
wc_enqueue_js(
|
|
|
|
"jQuery( 'a.wc-rating-link' ).click( function() {
|
2015-02-19 11:38:35 +00:00
|
|
|
jQuery.post( '" . WC()->ajax_url() . "', { action: 'woocommerce_rated' } );
|
2015-04-28 14:06:38 +00:00
|
|
|
jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
|
2018-03-05 18:59:17 +00:00
|
|
|
});"
|
|
|
|
);
|
2015-02-19 11:38:35 +00:00
|
|
|
} else {
|
|
|
|
$footer_text = __( 'Thank you for selling with WooCommerce.', 'woocommerce' );
|
|
|
|
}
|
2015-01-29 00:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $footer_text;
|
|
|
|
}
|
2017-09-10 22:48:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check on a Jetpack install queued by the Setup Wizard.
|
|
|
|
*
|
|
|
|
* See: WC_Admin_Setup_Wizard::install_jetpack()
|
|
|
|
*/
|
|
|
|
public function setup_wizard_check_jetpack() {
|
2017-10-05 11:51:49 +00:00
|
|
|
$jetpack_active = class_exists( 'Jetpack' );
|
2017-10-09 22:45:33 +00:00
|
|
|
|
2018-03-05 18:59:17 +00:00
|
|
|
wp_send_json_success(
|
|
|
|
array(
|
|
|
|
'is_active' => $jetpack_active ? 'yes' : 'no',
|
|
|
|
)
|
|
|
|
);
|
2017-09-10 22:48:38 +00:00
|
|
|
}
|
2019-04-23 15:02:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Disable WXR export of scheduled action posts.
|
|
|
|
*
|
|
|
|
* @since 3.6.2
|
|
|
|
*
|
|
|
|
* @param array $args Scehduled action post type registration args.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function disable_webhook_post_export( $args ) {
|
|
|
|
$args['can_export'] = false;
|
|
|
|
return $args;
|
|
|
|
}
|
2020-04-22 20:32:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Include admin classes.
|
|
|
|
*
|
2020-05-07 21:57:53 +00:00
|
|
|
* @since 4.2.0
|
|
|
|
* @param string $classes Body classes string.
|
|
|
|
* @return string
|
2020-04-22 20:32:26 +00:00
|
|
|
*/
|
2020-04-22 22:17:40 +00:00
|
|
|
public function include_admin_body_class( $classes ) {
|
|
|
|
if ( false !== strpos( $classes, 'wc-wp-version-gte-53' ) ) {
|
2020-04-22 20:32:26 +00:00
|
|
|
return $classes;
|
|
|
|
}
|
|
|
|
|
2020-05-07 21:57:53 +00:00
|
|
|
$raw_version = get_bloginfo( 'version' );
|
|
|
|
$version_parts = explode( '-', $raw_version );
|
|
|
|
$version = count( $version_parts ) > 1 ? $version_parts[0] : $raw_version;
|
2020-04-22 20:32:26 +00:00
|
|
|
|
2020-04-22 22:17:40 +00:00
|
|
|
// Add WP 5.3+ compatibility class.
|
2020-05-07 21:57:53 +00:00
|
|
|
if ( $raw_version && version_compare( $version, '5.3', '>=' ) ) {
|
2020-04-22 20:32:26 +00:00
|
|
|
$classes .= ' wc-wp-version-gte-53';
|
|
|
|
}
|
|
|
|
|
|
|
|
return $classes;
|
|
|
|
}
|
2013-07-24 16:01:36 +00:00
|
|
|
}
|
|
|
|
|
2014-06-17 21:40:54 +00:00
|
|
|
return new WC_Admin();
|