false, 'active' => false, 'version' => '' ); foreach ( get_plugins() as $file => $data ) { // Read installed metadata instead of assuming a private PHP class or option. if ( strtolower( trim( wp_strip_all_tags( $data['Name'] ) ) ) === 'woocommerce ai' ) { $active = is_plugin_active( $file ) || ( is_multisite() && is_plugin_active_for_network( $file ) ); if ( ! $ai['active'] ) { $ai = array( 'installed' => true, 'active' => $active, 'version' => $data['Version'] ); } } } return array( 'woocommerce' => defined( 'WC_VERSION' ) && function_exists( 'wc_get_products' ), 'wc_version' => defined( 'WC_VERSION' ) ? WC_VERSION : '', 'ai' => $ai, ); } }