abilities = $abilities; } /** * Returns the events this subscriber listens to. * * @return array */ public static function get_subscribed_events(): array { return [ // @action wp_abilities_api_categories_init 'wp_abilities_api_categories_init' => 'register_categories', // @action wp_abilities_api_init 'wp_abilities_api_init' => 'register_abilities', ]; } /** * Registers the `imagify` ability category. * * No-ops gracefully when the WP Abilities API is not available (WP < 6.9). * * @return void */ public function register_categories(): void { if ( ! function_exists( 'wp_register_ability_category' ) ) { return; } wp_register_ability_category( 'imagify', [ 'label' => __( 'Imagify', 'imagify' ), 'description' => __( 'Image optimization tools for WordPress.', 'imagify' ), ] ); } /** * Registers all injected Imagify abilities. * * No-ops gracefully when the WP Abilities API is not available (WP < 6.9). * * @return void */ public function register_abilities(): void { if ( ! function_exists( 'wp_register_ability' ) ) { return; } foreach ( $this->abilities as $ability ) { $ability->register(); } } }