WC_Admin_Notices::template_file_check_notice()
Show a notice highlighting bad template files.
Description Description
Source Source
File: includes/admin/class-wc-admin-notices.php
public static function template_file_check_notice() { $core_templates = WC_Admin_Status::scan_template_files( WC()->plugin_path() . '/templates' ); $outdated = false; foreach ( $core_templates as $file ) { $theme_file = false; if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) { $theme_file = get_stylesheet_directory() . '/' . $file; } elseif ( file_exists( get_stylesheet_directory() . '/' . WC()->template_path() . $file ) ) { $theme_file = get_stylesheet_directory() . '/' . WC()->template_path() . $file; } elseif ( file_exists( get_template_directory() . '/' . $file ) ) { $theme_file = get_template_directory() . '/' . $file; } elseif ( file_exists( get_template_directory() . '/' . WC()->template_path() . $file ) ) { $theme_file = get_template_directory() . '/' . WC()->template_path() . $file; } if ( false !== $theme_file ) { $core_version = WC_Admin_Status::get_file_version( WC()->plugin_path() . '/templates/' . $file ); $theme_version = WC_Admin_Status::get_file_version( $theme_file ); if ( $core_version && $theme_version && version_compare( $theme_version, $core_version, '<' ) ) { $outdated = true; break; } } } if ( $outdated ) { include dirname( __FILE__ ) . '/views/html-notice-template-check.php'; } else { self::remove_notice( 'template_files' ); } }