WC_Tracker::get_all_template_overrides()private staticWC 1.0

Look for any template override and return filenames.

Метод класса: WC_Tracker{}

Хуки из метода

Возвращает

Массив.

Использование

$result = WC_Tracker::get_all_template_overrides();

Код WC_Tracker::get_all_template_overrides() WC 8.7.0

private static function get_all_template_overrides() {
	$override_data = array();
	/**
	 * Filter the paths to scan for template overrides.
	 *
	 * @since 2.3.0
	 */
	$template_paths = apply_filters( 'woocommerce_template_overrides_scan_paths', array( 'WooCommerce' => WC()->plugin_path() . '/templates/' ) );
	$scanned_files  = array();

	require_once WC()->plugin_path() . '/includes/admin/class-wc-admin-status.php';

	foreach ( $template_paths as $plugin_name => $template_path ) {
		$scanned_files[ $plugin_name ] = WC_Admin_Status::scan_template_files( $template_path );
	}

	foreach ( $scanned_files as $plugin_name => $files ) {
		foreach ( $files as $file ) {
			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;
			} else {
				$theme_file = false;
			}

			if ( false !== $theme_file ) {
				$override_data[] = basename( $theme_file );
			}
		}
	}
	return $override_data;
}