ion_step( array $steps ): array { return array_values( array_filter( $steps, function ( $step ) { return 'theme_selection' !== $step; } ) ); } private function get_translated_strings(): array { $locale = $this->get_onboarding_locale(); $api = new EditorAssetsAPI( [ EditorAssetsAPI::ASSETS_DATA_URL => self::ASSETS_BASE_URL . $locale . '.json', EditorAssetsAPI::ASSETS_DATA_TRANSIENT_KEY => '_elementor_onboarding_strings_' . $locale, EditorAssetsAPI::ASSETS_DATA_KEY => 'translations', ] ); return $api->get_assets_data(); } private function get_onboarding_locale(): string { static $flipped_locales = null; if ( null === $flipped_locales ) { $flipped_locales = array_flip( self::SUPPORTED_LOCALES ); } $user_locale = get_user_locale(); if ( isset( self::SUPPORTED_LOCALES[ $user_locale ] ) ) { return $user_locale; } $locale = substr( $user_locale, 0, 2 ); if ( isset( $flipped_locales[ $locale ] ) ) { return $flipped_locales[ $locale ]; } return 'en'; } private function get_steps_config(): array { $steps = [ [ 'id' => 'building_for', 'label' => __( 'Who are you building for?', 'elementor' ), 'type' => 'single', ], [ 'id' => 'site_about', 'label' => __( 'What is your site about?', 'elementor' ), 'type' => 'multiple', ], [ 'id' => 'experience_level', 'label' => __( 'How much experience do you have with Elementor?', 'elementor' ), 'type' => 'single', ], ]; if ( ! $this->is_elementor_theme_active() ) { $steps[] = [ 'id' => 'theme_selection', 'label' => __( 'Start with a theme that fits your needs', 'elementor' ), 'type' => 'single', ]; } if ( ! self::is_elementor_pro_installed() ) { $steps[] = [ 'id' => 'site_features', 'label' => __( 'What do you want to include in your site?', 'elementor' ), 'type' => 'multiple', ]; } return apply_filters( 'elementor/onboarding/steps', $steps ); } private static function is_elementor_pro_installed(): bool { $is_pro_installed = Utils::has_pro() || Utils::is_pro_installed_and_not_active(); return (bool) apply_filters( 'elementor/onboarding/is_elementor_pro_installed', $is_pro_installed ); } private function is_elementor_theme_active(): bool { $active_theme = get_stylesheet(); $is_active = in_array( $active_theme, Install_Theme::ALLOWED_THEMES, true ); return (bool) apply_filters( 'elementor/onboarding/is_elementor_theme_active', $is_active ); } }