boot(); /** * Fires once every feature has registered its hooks. * * @param Registry $registry The feature registry. */ do_action( 'wpat_loaded', self::features() ); } /** * The feature registry, seeded with everything the plugin ships. */ public static function features(): Registry { if ( null === self::$registry ) { self::$registry = ( new Registry() )->add( new CaptureFeature(), new DebuggerFeature(), new GravityFormsFeature(), new ContactForm7Feature(), new WPFormsFeature(), new FluentFormsFeature(), new NinjaFormsFeature(), new ElementorFeature(), new WooCommerceFeature(), new AdminUiFeature() ); } return self::$registry; } /** * Seed default settings on activation without touching existing values. */ public static function activate(): void { Migrations::install(); if ( false === get_option( Settings::OPTION ) ) { add_option( Settings::OPTION, Settings::defaults() ); } } /** * Whether Gravity Forms is available in this request. */ public static function gravity_forms_active(): bool { return class_exists( 'GFAPI' ) && class_exists( 'GFFormsModel' ); } /** * Cache busting version for a bundled asset. * * The file time while WP_DEBUG is on, the plugin version otherwise. * * @param string $relative Path relative to the plugin root. */ public static function asset_version( string $relative ): string { if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) { return VERSION; } $file = path( $relative ); return is_readable( $file ) ? (string) filemtime( $file ) : VERSION; } }