ray $value Current value. */ public function trigger_profile_completed_action( $old_value, $value ) { if ( isset( $old_value['completed'] ) && $old_value['completed'] ) { return; } if ( ! isset( $value['completed'] ) || ! $value['completed'] ) { return; } /** * Action hook fired when the onboarding profile (or onboarding wizard, * or profiler) is completed. * * @since 1.5.0 */ do_action( 'woocommerce_onboarding_profile_completed' ); } /** * Returns true if the profiler should be displayed (not completed and not skipped). * * @return bool */ private function should_show() { if ( $this->is_setup_wizard() ) { return true; } return OnboardingProfile::needs_completion(); } /** * Redirect to the profiler on homepage if completion is needed. */ public function redirect_to_profiler() { if ( ! $this->is_homepage() || ! OnboardingProfile::needs_completion() ) { return; } wp_safe_redirect( wc_admin_url( '&path=/setup-wizard' ) ); exit; } /** * Check if the current page is the profile wizard. * * @return bool */ private function is_setup_wizard() { /* phpcs:disable WordPress.Security.NonceVerification */ return isset( $_GET['page'] ) && 'wc-admin' === $_GET['page'] && isset( $_GET['path'] ) && '/setup-wizard' === $_GET['path']; /* phpcs: enable */ } /** * Check if the current page is the homepage. * * @return bool */ private function is_homepage() { /* phpcs:disable WordPress.Security.NonceVerification */ return isset( $_GET['page'] ) && 'wc-admin' === $_GET['page'] && ! isset( $_GET['path'] ); /* phpcs: enable */ } /** * Determine if the current page is one of the WC Admin pages. * * @return bool */ private function is_woocommerce_page() { $current_page = PageController::get_instance()->get_current_page(); if ( ! $current_page || ! isset( $current_page['path'] ) ) { return false; } return 0 === strpos( $current_page['path'], 'wc-admin' ); } /** * Add profiler items to component settings. * * @param array $settings Component settings. * * @return array */ public function component_settings( $settings ) { $profile = (array) get_option( OnboardingProfile::DATA_OPTION, array() ); $settings['onboarding'] = array( 'profile' => $profile, ); // Only fetch if the onboarding wizard OR the task list is incomplete or currently shown // or the current page is one of the WooCommerce Admin pages. if ( ( ! $this->should_show() && ! count( TaskLists::get_visible() ) || ! $this->is_woocommerce_page() ) ) { return $settings; } include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper-options.php'; $wccom_auth = \WC_Helper_Options::get( 'auth' ); $profile['wccom_connected'] = empty( $wccom_auth['access_token'] ) ? false : true; $settings['onboarding']['currencySymbols'] = get_woocommerce_currency_symbols(); $settings['onboarding']['euCountries'] = WC()->countries->get_european_union_countries(); $settings['onboarding']['localeInfo'] = include WC()->plugin_path() . '/i18n/locale-info.php'; $settings['onboarding']['profile'] = $profile; if ( $this->is_setup_wizard() ) { $settings['onboarding']['pageCount'] = (int) ( wp_count_posts( 'page' ) )->publish; $settings['onboarding']['postCount'] = (int) ( wp_count_posts( 'post' ) )->publish; $settings['onboarding']['isBlockTheme'] = wc_current_theme_is_fse_theme(); } return apply_filters( 'woocommerce_admin_onboarding_preloaded_data', $settings ); } /** * Preload WC setting options to prime state of the application. * * @param array $options Array of options to preload. * @return array */ public function preload_settings( $options ) { $options[] = 'general'; return $options; } /** * Set the admin full screen class when loading to prevent flashes of unstyled content. * * @param bool $classes Body classes. * @return array */ public function add_loading_classes( $classes ) { /* phpcs:disable WordPress.Security.NonceVerification */ if ( $this->is_setup_wizard() ) { $classes .= ' woocommerce-admin-full-screen'; } /* phpcs: enable */ return $classes; } /** * Remove the install notice that prompts the user to visit the old onboarding setup wizard. * * @param bool $show Show or hide the notice. * @param string $notice The slug of the notice. * @return bool */ public function remove_old_install_notice( $show, $notice ) { if ( 'install' === $notice ) { return false; } return $show; } /** * Set the viewport meta tag for the setup wizard. * * @param string $viewport_meta Viewport meta content value. * @return string Viewport meta content value. * * @since 9.0.0 */ public function set_viewport_meta_tag( $viewport_meta ) { if ( ! $this->is_setup_wizard() ) { return $viewport_meta; } return 'width=device-width, initial-scale=1.0, maximum-scale=1.0'; } }
Fatal error: Uncaught Error: Class "Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingSetupWizard" not found in /htdocs/wp-content/plugins/woocommerce/src/Internal/Admin/Onboarding/Onboarding.php:23 Stack trace: #0 /htdocs/wp-content/plugins/woocommerce/src/Internal/Admin/FeaturePlugin.php(160): Automattic\WooCommerce\Internal\Admin\Onboarding\Onboarding::init() #1 /htdocs/wp-content/plugins/woocommerce/src/Internal/Admin/FeaturePlugin.php(98): Automattic\WooCommerce\Internal\Admin\FeaturePlugin->includes() #2 /htdocs/wp-content/plugins/woocommerce/src/Internal/Admin/FeaturePlugin.php(81): Automattic\WooCommerce\Internal\Admin\FeaturePlugin->on_plugins_loaded() #3 /htdocs/wp-content/plugins/woocommerce/src/Admin/Composer/Package.php(65): Automattic\WooCommerce\Internal\Admin\FeaturePlugin->init() #4 [internal function]: Automattic\WooCommerce\Admin\Composer\Package::init() #5 /htdocs/wp-content/plugins/woocommerce/src/Packages.php(275): call_user_func(Array) #6 /htdocs/wp-content/plugins/woocommerce/src/Packages.php(85): Automattic\WooCommerce\Packages::initialize_packages() #7 /htdocs/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Packages::on_init('') #8 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #9 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #10 /htdocs/wp-settings.php(559): do_action('plugins_loaded') #11 /htdocs/wp-config.php(178): require_once('/htdocs/wp-sett...') #12 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #13 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #14 /htdocs/index.php(17): require('/htdocs/wp-blog...') #15 {main} thrown in /htdocs/wp-content/plugins/woocommerce/src/Internal/Admin/Onboarding/Onboarding.php on line 23