'WP Rocket', 'litespeed-cache/litespeed-cache.php' => 'LiteSpeed Cache', 'w3-total-cache/w3-total-cache.php' => 'W3 Total Cache', 'wp-super-cache/wp-cache.php' => 'WP Super Cache', 'wp-fastest-cache/wpFastestCache.php' => 'WP Fastest Cache', 'autoptimize/autoptimize.php' => 'Autoptimize', 'wp-optimize/wp-optimize.php' => 'WP-Optimize', 'sg-cachepress/sg-cachepress.php' => 'SiteGround Optimizer', 'breeze/breeze.php' => 'Breeze', 'cache-enabler/cache-enabler.php' => 'Cache Enabler', 'hummingbird-performance/wp-hummingbird.php' => 'Hummingbird', 'nitropack/main.php' => 'NitroPack', 'flying-press/flying-press.php' => 'FlyingPress', 'perfmatters/perfmatters.php' => 'Perfmatters', 'ewww-image-optimizer/ewww-image-optimizer.php' => 'EWWW Image Optimizer', 'shortpixel-image-optimiser/wp-shortpixel.php' => 'ShortPixel', 'imagify/imagify.php' => 'Imagify', 'webp-express/webp-express.php' => 'WebP Express', 'smush-pro/wp-smush.php' => 'Smush Pro', 'wp-smushit/wp-smush.php' => 'Smush', ); public static function fingerprint() { $theme = wp_get_theme(); $plugins = array(); foreach ( (array) get_option( 'active_plugins', array() ) as $file ) { $plugins[] = dirname( $file ) === '.' ? basename( $file, '.php' ) : dirname( $file ); } if ( is_multisite() ) { foreach ( array_keys( (array) get_site_option( 'active_sitewide_plugins', array() ) ) as $file ) { $plugins[] = dirname( $file ) === '.' ? basename( $file, '.php' ) : dirname( $file ); } } $plugins = array_values( array_unique( $plugins ) ); return array( 'theme' => $theme->get_stylesheet(), 'parent' => $theme->get_template(), 'theme_ver' => $theme->get( 'Version' ), 'plugins' => $plugins, 'woocommerce' => class_exists( 'WooCommerce' ), 'builder' => self::builder( $plugins, $theme ), 'multisite' => is_multisite(), 'wp' => get_bloginfo( 'version' ), 'php' => PHP_VERSION, 'server' => isset( $_SERVER['SERVER_SOFTWARE'] ) ? substr( sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ), 0, 40 ) : '', 'conflicts' => self::conflicts(), ); } private static function builder( array $plugins, $theme ) { $map = array( 'elementor' => 'elementor', 'beaver-builder-lite-version' => 'beaver', 'bb-plugin' => 'beaver', 'js_composer' => 'wpbakery', 'bricks' => 'bricks', 'oxygen' => 'oxygen', 'breakdance' => 'breakdance', 'siteorigin-panels' => 'siteorigin', ); foreach ( $map as $slug => $name ) { if ( in_array( $slug, $plugins, true ) ) { return $name; } } $tpl = strtolower( $theme->get_template() ); if ( 'divi' === $tpl ) { return 'divi'; } if ( 'avada' === $tpl ) { return 'avada'; } if ( 'bricks' === $tpl ) { return 'bricks'; } return 'none'; } public static function conflicts() { $out = array(); foreach ( self::CONFLICTING_PLUGINS as $file => $name ) { if ( zeroconfig_is_plugin_active( $file ) ) { $out[] = $name; } } return $out; } /** * Bundled rules, used until the SaaS answers. Patterns are case-insensitive * substrings matched against the asset URL. */ public static function fallback_rules() { return array( 'version' => 0, 'js_exclude' => array( 'jquery.min.js', 'jquery.js', 'jquery-migrate', 'wp-includes/js/dist/', 'wp-polyfill', 'revslider', 'rs6', 'layerslider', 'ls.', 'wc-add-to-cart', 'wc-cart-fragments', 'wc-checkout', 'woocommerce.min.js', 'stripe.com', 'paypal.com', 'recaptcha', 'hcaptcha', 'cloudflare-static', 'rocket-loader', 'wp-emoji', 'admin-bar', 'wp-admin/', 'swiper', 'slick', 'owl.carousel', 'elementor-frontend', 'elementor-pro', 'bricks', 'oxygen', 'divi', 'et-core', 'frontend-builder', // consent managers must run before anything they gate 'cookiebot', 'usercentrics', 'cookieyes', 'onetrust', 'cookielaw.org', 'otsdkstub', 'otbanner', 'iubenda', 'didomi', 'complianz', 'cmplz', 'borlabs', 'cookie-law-info', 'cookie-notice', 'termly', 'quantcast', 'consentmanager', 'osano', 'trustarc', 'truste', 'axeptio', 'tarteaucitron', 'klaro', 'moove_gdpr', 'gdpr-cookie-compliance', 'cookiefirst', 'cookie-script', 'cookiehub', 'real-cookie-banner', 'cookieinformation', 'consent-mode', ), 'delay_allow' => array( 'googletagmanager.com', 'google-analytics.com', 'gtag/js', 'connect.facebook.net', 'fbevents', 'static.hotjar.com', 'clarity.ms', 'mc.yandex', 'ads.linkedin', 'snap.licdn', 'tiktok.com/i18n/pixel', 'analytics.tiktok', 'pinimg.com/ct', 'px.ads', 'crisp.chat', 'intercom.io', 'tawk.to', 'widget.manychat', 'embed.tawk', 'js.hs-scripts', 'hs-analytics', 'cdn.onesignal', 'klaviyo', 'omnisend', 'mailchimp', 'drift.com', 'zdassets', 'livechatinc', 'olark', ), // Never delayed even if a delay_allow pattern matches (consent must come before trackers). 'delay_deny' => array( 'cookiebot', 'usercentrics', 'cookieyes', 'onetrust', 'cookielaw.org', 'otsdkstub', 'otbanner', 'iubenda', 'didomi', 'complianz', 'cmplz', 'borlabs', 'cookie-law-info', 'cookie-notice', 'termly', 'quantcast', 'consentmanager', 'osano', 'trustarc', 'truste', 'axeptio', 'tarteaucitron', 'klaro', 'moove_gdpr', 'gdpr-cookie-compliance', 'cookiefirst', 'cookie-script', 'cookiehub', 'real-cookie-banner', 'cookieinformation', 'consent-mode' ), 'css_exclude' => array( 'admin-bar', 'dashicons', 'customize' ), 'img_exclude' => array( '.svg', '.gif', 'data:', 'gravatar.com', 'wp-admin/', 'captcha' ), 'features_off' => array(), 'critical_skip' => array( 'cart', 'checkout', 'my-account' ), ); } /** * Compatibility rules come from the service. Keep only the keys the plugin reads, each a list of * short strings, so a malformed payload cannot reach the rewriter in an unexpected shape. */ public static function clean_rules( $rules ) { if ( ! is_array( $rules ) ) { return array(); } $out = array(); if ( isset( $rules['version'] ) && is_scalar( $rules['version'] ) ) { $out['version'] = (int) $rules['version']; } foreach ( array( 'js_exclude', 'delay_allow', 'delay_deny', 'css_exclude', 'img_exclude', 'critical_skip', 'features_off' ) as $k ) { if ( ! isset( $rules[ $k ] ) || ! is_array( $rules[ $k ] ) ) { continue; } $list = array(); foreach ( $rules[ $k ] as $p ) { if ( is_string( $p ) && '' !== trim( $p ) && strlen( $p ) <= 200 ) { $list[] = $p; } } $out[ $k ] = array_slice( array_values( array_unique( $list ) ), 0, 500 ); } return $out; } public static function rules() { $rules = ZeroConfig_Options::get( 'rules' ); if ( empty( $rules ) || ! is_array( $rules ) || ! isset( $rules['js_exclude'] ) ) { return self::fallback_rules(); } return array_merge( self::fallback_rules(), $rules ); } public static function matches( $url, array $patterns ) { $url = strtolower( $url ); foreach ( $patterns as $p ) { $p = strtolower( trim( (string) $p ) ); if ( '' !== $p && false !== strpos( $url, $p ) ) { return true; } } return false; } } if ( ! function_exists( 'zeroconfig_is_plugin_active' ) ) { function zeroconfig_is_plugin_active( $file ) { if ( ! function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } return is_plugin_active( $file ); } }