Remove need for wc_get_core_supported_themes

This commit is contained in:
Mike Jolley 2017-11-07 12:17:03 +00:00
parent fb8c6cd0d2
commit 6701917e5a
7 changed files with 16 additions and 40 deletions

View File

@ -79,7 +79,7 @@ class WC_Admin_Notices {
* Reset notices for themes when switched or a new version of WC is installed.
*/
public static function reset_admin_notices() {
if ( ! current_theme_supports( 'woocommerce' ) && ! in_array( get_option( 'template' ), wc_get_core_supported_themes() ) ) {
if ( ! current_theme_supports( 'woocommerce' ) ) {
self::add_notice( 'theme_support' );
}
@ -216,7 +216,7 @@ class WC_Admin_Notices {
* Show the Theme Check notice.
*/
public static function theme_check_notice() {
if ( ! current_theme_supports( 'woocommerce' ) && ! in_array( get_option( 'template' ), wc_get_core_supported_themes() ) ) {
if ( ! current_theme_supports( 'woocommerce' ) ) {
include( 'views/html-notice-theme-support.php' );
} else {
self::remove_notice( 'theme_support' );

View File

@ -874,7 +874,7 @@ class WC_REST_System_Status_Controller extends WC_REST_Controller {
'version_latest' => WC_Admin_Status::get_latest_theme_version( $active_theme ),
'author_url' => esc_url_raw( $active_theme->{'Author URI'} ),
'is_child_theme' => is_child_theme(),
'has_woocommerce_support' => ( current_theme_supports( 'woocommerce' ) || in_array( $active_theme->template, wc_get_core_supported_themes() ) ),
'has_woocommerce_support' => current_theme_supports( 'woocommerce' ),
'has_woocommerce_file' => ( file_exists( get_stylesheet_directory() . '/woocommerce.php' ) || file_exists( get_template_directory() . '/woocommerce.php' ) ),
'has_outdated_templates' => $outdated_templates,
'overrides' => $override_files,

View File

@ -43,20 +43,6 @@ class WC_Frontend_Scripts {
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'load_scripts' ) );
add_action( 'wp_print_scripts', array( __CLASS__, 'localize_printed_scripts' ), 5 );
add_action( 'wp_print_footer_scripts', array( __CLASS__, 'localize_printed_scripts' ), 5 );
add_action( 'setup_theme', array( __CLASS__, 'add_default_theme_support' ) );
}
/**
* Add theme support for default WP themes.
*
* @since 3.0.0
*/
public static function add_default_theme_support() {
if ( in_array( get_option( 'template' ), wc_get_core_supported_themes() ) ) {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
}
/**

View File

@ -141,7 +141,7 @@ class WC_Tracker {
public static function get_theme_info() {
$theme_data = wp_get_theme();
$theme_child_theme = is_child_theme() ? 'Yes' : 'No';
$theme_wc_support = ( ! current_theme_supports( 'woocommerce' ) && ! in_array( $theme_data->template, wc_get_core_supported_themes() ) ) ? 'No' : 'Yes';
$theme_wc_support = ! current_theme_supports( 'woocommerce' ) ? 'No' : 'Yes';
return array( 'name' => $theme_data->Name, 'version' => $theme_data->Version, 'child_theme' => $theme_child_theme, 'wc_support' => $theme_wc_support );
}

View File

@ -915,16 +915,6 @@ function wc_ms_protect_download_rewite_rules( $rewrite ) {
}
add_filter( 'mod_rewrite_rules', 'wc_ms_protect_download_rewite_rules' );
/**
* WooCommerce Core Supported Themes.
*
* @since 2.2
* @return string[]
*/
function wc_get_core_supported_themes() {
return array( 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' );
}
/**
* Wrapper function to execute the `woocommerce_deliver_webhook_async` cron.
* hook, see WC_Webhook::process().

View File

@ -972,3 +972,15 @@ function wc_get_customer_avatar_url( $email ) {
return get_avatar_url( $email );
}
/**
* WooCommerce Core Supported Themes.
*
* @deprecated 3.3.0
* @since 2.2
* @return string[]
*/
function wc_get_core_supported_themes() {
wc_deprecated_function( 'wc_get_core_supported_themes()', '3.3' );
return array( 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' );
}

View File

@ -267,18 +267,6 @@ class WC_Tests_Core_Functions extends WC_Unit_Test_Case {
return __CLASS__;
}
/**
* Test wc_get_core_supported_themes().
*
* @since 2.2
*/
public function test_wc_get_core_supported_themes() {
$expected_themes = array( 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' );
$this->assertEquals( $expected_themes, wc_get_core_supported_themes() );
}
/**
* Test wc_get_base_location().
*