WC_Admin_Notices::template_file_check_notice()
Show a notice highlighting bad template files.
Метод класса: WC_Admin_Notices{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = WC_Admin_Notices::template_file_check_notice();
Код WC_Admin_Notices::template_file_check_notice() WC Admin Notices::template file check notice WC 9.7.1
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 __DIR__ . '/views/html-notice-template-check.php'; } else { self::remove_notice( 'template_files' ); } }