PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.7.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.7.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
← All changes | includes/class-wpo-onboarding.php +42 -1 4.6.1 → 4.7.0 View file →
@@ -61,13 +61,45 @@
61 61 public function init(): void {
62 62
63 63 add_action( $this->prefix.'_onboarding_update_options', array($this, 'update_step_settings'), 10, 2 );
64 64 add_filter( $this->prefix.'_onboarding_steps', array($this, 'load_steps'));
65 + add_action( 'admin_post_wpo_reopen_onboarding', array($this, 'handle_reopen_onboarding') );
65 66
66 67 $this->setup_onboarding();
67 68 }
68 69
69 70 /**
71 + * Handles the "Quick Setup" button: re-activates the onboarding wizard and redirects to the dashboard.
72 + *
73 + * @return void
74 + */
75 + public function handle_reopen_onboarding(): void {
76 + check_admin_referer('wpo_reopen_onboarding');
77 +
78 + $capability = $this->is_multisite ? 'manage_network_options' : 'manage_options';
79 + if (!current_user_can($capability)) {
80 + wp_die(esc_html__('Sorry, you are not allowed to do this.', 'wp-optimize'));
81 + }
82 +
83 + $this->activate_onboarding_wizard();
84 +
85 + wp_safe_redirect(WP_Optimize()->get_options()->admin_page_url('WP-Optimize'));
86 + exit;
87 + }
88 +
89 + /**
90 + * Returns the URL that reopens the onboarding wizard, including a nonce.
91 + *
92 + * @return string
93 + */
94 + public function get_reopen_onboarding_url(): string {
95 + return wp_nonce_url(
96 + admin_url('admin-post.php?action=wpo_reopen_onboarding'),
97 + 'wpo_reopen_onboarding'
98 + );
99 + }
100 +
101 + /**
70 102 * Get Features Status
71 103 *
72 104 * @param array $settings Settings data
73 105 * @param array $step_fields Step Fields data
@@ -692,9 +724,9 @@
692 724 * Initialize the onboarding
693 725 *
694 726 * @return void
695 727 */
696 - public function setup_onboarding(): void {
728 + private function setup_onboarding(): void {
697 729 $onboarding = new Onboarding();
698 730 if ($onboarding::is_onboarding_active($this->prefix, $this->caller_slug)) {
699 731
700 732 $support_link = $this->is_premium ? WP_Optimize_Utils::add_utm_params('https://teamupdraft.com/support/premium-support/', $this->get_utm_params_to_override('premium-support')) : esc_url('https://wordpress.org/support/plugin/wp-optimize/');
@@ -724,8 +756,17 @@
724 756
725 757 $onboarding->init();
726 758
727 759 }
760 + }
761 +
762 + /**
763 + * Check if the onboarding wizard is currently active (i.e. its modal is/will be shown)
764 + *
765 + * @return bool
766 + */
767 + public function is_active(): bool {
768 + return Onboarding::is_onboarding_active($this->prefix, $this->caller_slug);
728 769 }
729 770
730 771 /**
731 772 * Enable the onboarding wizard for the plugin.