meta. * * @return array */ public static function known_plugins() { return array( 'woocommerce-currency-switcher/index.php' => array( 'name' => 'FOX - Currency Switcher', 'category' => 'multi_currency', 'impact' => 'Orders in non-base currency are Unsupported.', ), 'woocommerce-multicurrency/woocommerce-multicurrency.php' => array( 'name' => 'WooCommerce Multi-Currency', 'category' => 'multi_currency', 'impact' => 'Orders in non-base currency are Unsupported.', ), 'woocommerce-product-addons/woocommerce-product-addons.php' => array( 'name' => 'Product Add-Ons', 'category' => 'pricing', 'impact' => 'Add-on pricing may not be fully represented in Free preflight.', ), 'woocommerce-dynamic-pricing/woocommerce-dynamic-pricing.php' => array( 'name' => 'Dynamic Pricing', 'category' => 'pricing', 'impact' => 'Dynamic rules are outside Free selected-coupon preflight fidelity.', ), 'yith-woocommerce-dynamic-pricing-and-discounts-premium/init.php' => array( 'name' => 'YITH Dynamic Pricing', 'category' => 'pricing', 'impact' => 'Dynamic discounts may produce Unknown or approximated results.', ), 'cost-of-goods-for-woocommerce/cost-of-goods-for-woocommerce.php' => array( 'name' => 'Cost of Goods for WooCommerce', 'category' => 'cogs', 'impact' => 'Prefer native WooCommerce COGS or MarginBeacon manual cost for Exact confidence.', ), ); } /** * Scan and persist compatibility state. * * @return array */ public function refresh() { if ( ! function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $detected = array(); foreach ( self::known_plugins() as $file => $meta ) { if ( is_plugin_active( $file ) ) { $detected[] = array_merge( array( 'plugin_file' => $file ), $meta ); } } $state = array( 'checked_at_gmt' => gmdate( 'Y-m-d H:i:s' ), 'detected' => $detected, 'limited' => ! empty( $detected ), ); update_option( Constants::OPTION_COMPATIBILITY, $state, false ); return $state; } /** * @return array */ public function current() { $state = get_option( Constants::OPTION_COMPATIBILITY, null ); if ( ! is_array( $state ) ) { return $this->refresh(); } return $state; } }