human label. * * @var array */ public const MODULES = [ 'metadata' => 'Metadata Engine', 'analysis' => 'Content Analysis', 'sitemaps' => 'XML Sitemaps', 'schema' => 'Schema (JSON-LD)', 'breadcrumbs' => 'Breadcrumbs', 'importer' => 'Importer', 'redirects' => 'Redirects', '404' => '404 Monitor', 'instant-indexing' => 'Instant Indexing (IndexNow)', 'robots' => 'Robots.txt & .htaccess', 'image-seo' => 'Automatic image alt and title patterns. Planned.', 'gutenberg' => 'An editor sidebar with analysis and previews. Planned.', 'ai' => 'Bring your own key AI tools. Planned.', 'headless' => 'A read only REST payload for headless builds. Planned.', ]; /** * Module ids that are planned: visible to the owner as coming soon, * but never toggleable and never booted, even if present in the option. * * @var string[] */ public const PLANNED = [ 'image-seo', 'gutenberg', 'ai', 'headless' ]; /** * Get all modules as id => label. * * @return array */ public static function all(): array { return self::MODULES; } /** * Get all module ids. * * @return string[] The result. */ public static function ids(): array { return array_map( 'strval', array_keys( self::MODULES ) ); } /** * Whether a module id exists. * * @param string $id Id. * @return bool The result. */ public static function has( string $id ): bool { return array_key_exists( $id, self::MODULES ); } /** * Whether a module id is planned (visible but not toggleable). * * @param string $id Id. * @return bool The result. */ public static function isPlanned( string $id ): bool { return in_array( $id, self::PLANNED, true ); } /** * Get label for a module id. * * @throws \InvalidArgumentException If id is unknown. * @param string $id Id. * @return string The result. */ public static function label( string $id ): string { if ( ! array_key_exists( $id, self::MODULES ) ) { // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- internal exception message; escape once at any future display site. throw new \InvalidArgumentException( sprintf( 'Unknown module id: %s', $id ) ); } return self::MODULES[ $id ]; } }