*/ public static function all(): array { return array( new CowboyAdapter(), new RoyalAdapter(), new AiEngineAdapter() ); } /** * An adapter's state on this site. * * @param Adapter $adapter The adapter. */ public static function status( Adapter $adapter ): string { $version = self::version( $adapter ); if ( null === $version ) { return self::ABSENT; } list( $lowest, $beyond ) = $adapter->tested(); return version_compare( $version, $lowest, '>=' ) && version_compare( $version, $beyond, '<' ) ? self::COVERED : self::UNTESTED; } /** * The active plugin's version, or null when it is not active. * * @param Adapter $adapter The adapter. */ public static function version( Adapter $adapter ): ?string { $file = $adapter->plugin_file(); $active = in_array( $file, (array) get_option( 'active_plugins', array() ), true ); $network = is_multisite() && array_key_exists( $file, (array) get_site_option( 'active_sitewide_plugins', array() ) ); $path = WP_PLUGIN_DIR . '/' . $file; if ( ( ! $active && ! $network ) || ! is_readable( $path ) ) { return null; } $header = get_file_data( $path, array( 'version' => 'Version' ) ); return '' === $header['version'] ? null : $header['version']; } }