is_included() && ! empty( $data['extracted_directory_path'] ) && $this->is_feature_active() ); } private function is_feature_active(): bool { return Plugin::$instance->experiments->is_feature_active( Atomic_Widgets_Module::EXPERIMENT_NAME ); } public function import( array $data, array $imported_data ): array { $kit = Plugin::$instance->kits_manager->get_active_kit(); $default_styles_dir = $data['extracted_directory_path'] . '/' . Import_Export_Customization::DIRECTORY_NAME; if ( ! $kit || ! is_dir( $default_styles_dir ) ) { return []; } $repository = Default_Styles_Repository::make( $kit ); $imported_tags = []; foreach ( glob( $default_styles_dir . '/*.json' ) as $file_path ) { $tag = basename( $file_path, '.json' ); if ( ! Default_Styles_Repository::is_allowed_tag( $tag ) ) { continue; } $style_data = ImportExportUtils::read_json_file( $file_path ); if ( ! $style_data ) { continue; } if ( ! $repository->put( $tag, $style_data ) ) { continue; } $imported_tags[] = $tag; } return [ 'imported' => $imported_tags, ]; } }