HEX
Server: LiteSpeed
System: Linux server.zepintelhosting.com 4.18.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User: enamadmin (1026)
PHP: 8.2.30
Disabled: exec,system,passthru,shell_exec,proc_open,popen,apache_child_terminate
Upload Files
File: /home/enamadmin/www/wp-content/plugins/jetpack-boost/compatibility/woocommerce.php
<?php
/**
 * Compatibility functions for WooCommerce
 *
 * @package automattic/jetpack-boost
 */

namespace Automattic\Jetpack_Boost\Compatibility\Woocommerce;

/**
 * Exclude special Woocommerce pages from standard "single page" Critical CSS.
 *
 * @param object $args the query args.
 */
function exclude_woocommerce_pages_from_query( $args ) {

	// Only do this for page post type.
	if ( 'page' !== $args['post_type'] ) {
		return $args;
	}

	$woocommerce_pages = get_woocommerce_page_ids();
	if ( empty( $woocommerce_pages ) ) {
		return $args;
	}

	if ( ! isset( $args['post__not_in'] ) ) {
		$args['post__not_in'] = array();
	}

	$args['post__not_in'] = array_merge( $woocommerce_pages, $args['post__not_in'] );

	return $args;
}

/**
 * Get those ol' WooCommerce page IDs
 */
function get_woocommerce_page_ids() {
	if ( ! function_exists( 'wc_get_page_id' ) ) {
		return array();
	}
	$page_slugs = array( 'myaccount', 'shop', 'cart', 'checkout', 'view_order', 'terms' );
	$ids        = array_map( 'wc_get_page_id', $page_slugs );
	$ids        = array_filter(
		$ids,
		function ( $value ) {
			return $value > 0;
		}
	);

	return $ids;
}

add_filter( 'jetpack_boost_critical_css_post_type_query', __NAMESPACE__ . '\exclude_woocommerce_pages_from_query' );

function exclude_script_from_minify( $do_concat, $handle ) {

	// Exclude the wc-blocks-vendors-frontend script from minification.
	// The script has a regex that fails when being minified by JShrink/Minifier.
	if ( 'wc-blocks-vendors-frontend' === $handle ) {
		return false;
	}

	return $do_concat;
}

add_filter( 'js_do_concat', __NAMESPACE__ . '\exclude_script_from_minify', 10, 2 );