check. * * @return array */ private static function optimizers(): array { return array( 'WP Rocket' => defined( 'WP_ROCKET_VERSION' ), 'LiteSpeed Cache' => defined( 'LSCWP_V' ), 'W3 Total Cache' => defined( 'W3TC' ), 'WP Super Cache' => defined( 'WPCACHEHOME' ), 'WP Fastest Cache' => class_exists( '\WpFastestCache' ), 'SiteGround Speed Optimizer' => defined( 'SiteGround_Optimizer\VERSION' ), 'Autoptimize' => defined( 'AUTOPTIMIZE_PLUGIN_VERSION' ), 'Perfmatters' => defined( 'PERFMATTERS_VERSION' ), 'FlyingPress' => defined( 'FLYING_PRESS_VERSION' ), 'Hummingbird' => defined( 'WPHB_VERSION' ), 'Cache Enabler' => class_exists( '\Cache_Enabler' ), 'Breeze' => defined( 'BREEZE_VERSION' ), ); } /** * Plugins found on the site that the checkout adjusts to. * * @return array */ public static function detected(): array { $found = array(); $cache = __( 'Supported: the checkout is never cached or optimized, and the side cart\'s and checkout\'s files are kept out of delayed, combined and "unused CSS" processing.', 'aiolos-checkout-for-woocommerce' ); foreach ( self::optimizers() as $name => $active ) { if ( $active ) { $found[] = array( 'name' => $name, 'note' => $cache, ); } } foreach ( Shims::classes() as $class ) { if ( $class::available() ) { $found[] = array( 'name' => $class::label(), 'note' => $class::note(), ); } } /** * Filters the plugins listed as detected and supported on the General tab. * * @since 1.6.0 * * @param array $found List of [ 'name' => ..., 'note' => ... ]. */ $found = (array) apply_filters( 'aiolos_detected_plugins', $found ); return array_values( array_filter( $found, static fn( $row ) => is_array( $row ) && isset( $row['name'] ) && is_string( $row['name'] ) ) ); } /** * The list on the General tab. */ public static function detected_list(): void { if ( ! current_user_can( 'manage_woocommerce' ) ) { return; } $found = self::detected(); echo '
'; echo '

' . esc_html__( 'Other plugins on this site', 'aiolos-checkout-for-woocommerce' ) . '

'; if ( ! $found ) { echo '

' . esc_html__( 'None of the plugins that need special handling were found. Shipping, payment and pickup-point plugins work through WooCommerce\'s own checkout hooks, which this checkout keeps.', 'aiolos-checkout-for-woocommerce' ) . '

'; echo '
'; return; } echo '

' . esc_html__( 'Shipping, payment and pickup-point plugins need no entry here: they work through WooCommerce\'s own checkout hooks, which this checkout keeps.', 'aiolos-checkout-for-woocommerce' ) . '

'; echo ''; } /** * Checkout plugins by folder name. * * @return array folder => product name. */ public static function known(): array { /** * Filters the plugins that replace WooCommerce's checkout (folder => name). * * @since 1.4.0 * * @param array $plugins Plugins. */ return (array) apply_filters( 'aiolos_conflicting_checkout_plugins', array( 'checkout-for-woocommerce' => 'CheckoutWC', 'fluid-checkout' => 'Fluid Checkout', 'fluid-checkout-pro' => 'Fluid Checkout PRO', 'funnel-builder' => 'FunnelKit Funnel Builder', 'funnel-builder-pro' => 'FunnelKit Funnel Builder Pro', 'cartflows' => 'CartFlows', 'cartflows-pro' => 'CartFlows Pro', 'flux-checkout' => 'Flux Checkout', 'iconic-flux-checkout' => 'Flux Checkout', 'woocommerce-direct-checkout' => 'Direct Checkout', 'woo-one-page-checkout' => 'One Page Checkout', ) ); } /** * Active plugins (and network-active ones) whose folder is in a list. * * @param array $list folder => name. * @return string[] Names. */ public static function active( array $list ): array { $plugins = (array) get_option( 'active_plugins', array() ); if ( is_multisite() ) { $plugins = array_merge( $plugins, array_keys( (array) get_site_option( 'active_sitewide_plugins', array() ) ) ); } $found = array(); foreach ( $plugins as $plugin ) { $folder = strtok( (string) $plugin, '/' ); if ( isset( $list[ $folder ] ) ) { $found[ $list[ $folder ] ] = $list[ $folder ]; } } return array_values( $found ); } /** * The warning. */ public static function notice(): void { if ( ! current_user_can( 'manage_woocommerce' ) || ! Settings::enabled( 'checkout_enabled' ) ) { return; } $found = self::active( self::known() ); if ( ! $found ) { return; } echo '

' . esc_html__( 'Aiolos Checkout', 'aiolos-checkout-for-woocommerce' ) . ': '; echo esc_html( sprintf( /* translators: %s: plugin names */ __( '%s also replaces the checkout. Two checkout plugins on the same page conflict (missing fields, payments that fail): keep one. Either deactivate it, or turn off "Checkout" in Aiolos Checkout > General and keep only the side cart.', 'aiolos-checkout-for-woocommerce' ), implode( ', ', $found ) ) ); echo '

'; } }