static function register( $object, $slug ) { self::$plugin_compatibilities[ $slug ] = $object; } public static function get_compatibility_class( $slug ) { return ( isset( self::$plugin_compatibilities[ $slug ] ) ) ? self::$plugin_compatibilities[ $slug ] : false; } public static function get_language_compatible_plugin() { if ( empty( self::$plugin_compatibilities ) ) { return ''; } foreach ( self::$plugin_compatibilities as $plugins_class ) { if ( property_exists( $plugins_class, 'is_language_support' ) && true === $plugins_class->is_language_support ) { return call_user_func( array( $plugins_class, 'get_plugin_nicename' ) ); } } return ''; } } WFFN_Plugin_Compatibilities::load_all_compatibilities(); } { LiteSpeed_Cache_Purge::purge_all( 'Clear Cache For Me' ); } } /** * Clear WP Optimize */ private static function clear_wp_optimize(): void { if ( class_exists( 'WP_Optimize' ) && defined( 'WPO_PLUGIN_MAIN_PATH' ) ) { ob_start(); if ( ! class_exists( 'WP_Optimize_Cache_Commands' ) ) include_once WPO_PLUGIN_MAIN_PATH . 'cache/class-cache-commands.php'; if ( ! class_exists( 'WP_Optimize_Minify_Commands' ) ) include_once WPO_PLUGIN_MAIN_PATH . 'minify/class-wp-optimize-minify-commands.php'; if ( ! class_exists( 'WP_Optimize_Minify_Cache_Functions' ) ) include_once WPO_PLUGIN_MAIN_PATH . 'minify/class-wp-optimize-minify-cache-functions.php'; if ( class_exists( 'WP_Optimize_Cache_Commands' ) && method_exists( 'WP_Optimize_Cache_Commands', 'purge_page_cache' ) ) { $wpoptimize_cache_commands = new WP_Optimize_Cache_Commands(); $wpoptimize_cache_commands->purge_page_cache(); } if ( class_exists( 'WP_Optimize_Minify_Commands' ) && method_exists( 'WP_Optimize_Minify_Commands', 'purge_minify_cache' ) ) { $wpoptimize_minify_commands = new WP_Optimize_Minify_Commands(); $wpoptimize_minify_commands->purge_minify_cache(); } ob_get_clean(); } } /** * Clear GoDaddy Hosting Cache */ private static function clear_godaddy_cache(): void { if ( class_exists( 'WPaaS\Plugin' ) && function_exists( 'fastvelocity_godaddy_request' ) ) { fastvelocity_godaddy_request( 'BAN' ); } } /** * Clear WP Engine Cache */ private static function clear_wp_engine_cache(): void { if ( class_exists( 'WpeCommon' ) ) { if ( method_exists( 'WpeCommon', 'purge_memcached' ) ) { WpeCommon::purge_memcached(); } if ( method_exists( 'WpeCommon', 'clear_maxcdn_cache' ) ) { WpeCommon::clear_maxcdn_cache(); } if ( method_exists( 'WpeCommon', 'purge_varnish_cache' ) ) { WpeCommon::purge_varnish_cache(); } } } /** * Clear WP Rocket */ private static function clear_wp_rocket(): void { if ( function_exists( 'rocket_clean_domain' ) ) { rocket_clean_domain(); $container = apply_filters( 'rocket_container', null ); if ( $container ) { $rucss_admin_subscriber = $container->get( 'rucss_admin_subscriber' ); if ( $rucss_admin_subscriber && method_exists( $rucss_admin_subscriber, 'truncate_used_css' ) ) { $rucss_admin_subscriber->truncate_used_css(); } } } if ( function_exists( 'rocket_clean_minify' ) ) { rocket_clean_minify(); } } /** * Clear WP Super Cache */ private static function clear_wp_super_cache(): void { if ( function_exists( 'wp_cache_clean_cache' ) ) { wp_cache_clean_cache(); } } /** * Clear Autoptimize */ private static function clear_autoptimize(): void { if ( class_exists( 'autoptimizeCache' ) && method_exists( 'autoptimizeCache', 'clearall' ) ) { autoptimizeCache::clearall(); } } /** * Clear Fast Velocity Minify */ private static function clear_fast_velocity_minify(): void { if ( function_exists( 'fvm_purge_all' ) ) { fvm_purge_all(); } if ( function_exists( 'fastvelocity_purge_others' ) ) { fastvelocity_purge_others(); } } /** * Clear Hummingbird Performance */ private static function clear_hummingbird(): void { if ( has_action( 'wphb_clear_page_cache' ) ) { do_action( 'wphb_clear_page_cache' ); } } /** * Clear Swift Performance */ private static function clear_swift_performance(): void { if ( class_exists( 'Swift_Performance_Cache' ) && method_exists( 'Swift_Performance_Cache', 'clear_all_cache' ) ) { Swift_Performance_Cache::clear_all_cache(); } } /** * Clear ShortPixel AI */ private static function clear_shortpixel(): void { if ( class_exists( 'ShortPixelAI' ) && method_exists( 'ShortPixelAI', 'clear_css_cache' ) ) { ShortPixelAI::clear_css_cache(); } } /** * Clear Perfmatters */ private static function clear_perfmatters(): void { if ( class_exists( 'Perfmatters\CSS' ) && method_exists( 'Perfmatters\CSS', 'clear_used_css' ) ) { Perfmatters\CSS::clear_used_css(); } } /** * Clear Breeze Cache */ private static function clear_breeze(): void { if ( has_action( 'breeze_clear_all_cache' ) ) { do_action( 'breeze_clear_all_cache' ); } } /** * Clear varnish cache for the dynamic files. * Credit @davidbarratt: https://github.com/davidbarratt/varnish-http-purge */ private static function clear_varnish_cache(): void { // Early bail if Varnish cache is not enabled on the site. if ( ! isset( $_SERVER['HTTP_X_VARNISH'] ) ) { return; } // Parse the URL for proxy proxies. $parsed_url = wp_parse_url( home_url() ); // Build a varniship. $varniship = get_option( 'vhp_varnish_ip' ); if ( defined( 'VHP_VARNISH_IP' ) && false !== VHP_VARNISH_IP ) { $varniship = VHP_VARNISH_IP; } // If we made varniship, let it sail. $purgeme = ( isset( $varniship ) && null !== $varniship ) ? $varniship : $parsed_url['host']; wp_remote_request( $parsed_url['scheme'] . '://' . $purgeme, [ 'method' => 'PURGE', 'blocking' => false, 'headers' => [ 'host' => $parsed_url['host'], 'X-Purge-Method' => 'default', ], ] ); } }