PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.16
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.16
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / classes / controllers / FrmOnboardingWizardController.php

FrmOnboardingWizardController.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.16, at classes/controllers/FrmOnboardingWizardController.php

761 lines 20.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Onboarding Wizard Controller class.
4 *
5 * @package Formidable
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 die( 'You are not allowed to call this page directly.' );
10 }
11
12 /**
13 * Handles the Onboarding Wizard page in the admin area.
14 *
15 * @since 6.9
16 */
17 class FrmOnboardingWizardController {
18
19 /**
20 * The slug of the Onboarding Wizard page.
21 *
22 * @var string
23 */
24 const PAGE_SLUG = 'formidable-onboarding-wizard';
25
26 /**
27 * The script handle.
28 *
29 * @var string
30 */
31 const SCRIPT_HANDLE = 'frm-onboarding-wizard';
32
33 /**
34 * The required user capability to view the Onboarding Wizard page.
35 *
36 * @var string
37 */
38 const REQUIRED_CAPABILITY = 'frm_view_forms';
39
40 /**
41 * Transient name used for managing redirection to the Onboarding Wizard page.
42 *
43 * @var string
44 */
45 const TRANSIENT_NAME = 'frm_activation_redirect';
46
47 /**
48 * Transient value associated with the redirection to the Onboarding Wizard page.
49 * Used when activating a single plugin.
50 *
51 * @var string
52 */
53 const TRANSIENT_VALUE = 'formidable-welcome';
54
55 /**
56 * Transient value associated with the redirection to the Onboarding Wizard page.
57 * Used when activating multiple plugins at once.
58 *
59 * @var string
60 */
61 const TRANSIENT_MULTI_VALUE = 'formidable-welcome-multi';
62
63 /**
64 * Option name for storing the redirect status for the Onboarding Wizard page.
65 *
66 * @var string
67 */
68 const REDIRECT_STATUS_OPTION = 'frm_welcome_redirect';
69
70 /**
71 * Option name for tracking if the onboarding wizard was skipped.
72 *
73 * @var string
74 */
75 const ONBOARDING_SKIPPED_OPTION = 'frm_onboarding_skipped';
76
77 /**
78 * Defines the initial step for redirection within the application flow.
79 *
80 * @var string
81 */
82 const INITIAL_STEP = 'consent-tracking';
83
84 /**
85 * Option name to store usage data.
86 *
87 * @var string
88 */
89 const USAGE_DATA_OPTION = 'frm_onboarding_usage_data';
90
91 /**
92 * Holds the URL to access the Onboarding Wizard's page.
93 *
94 * @var string
95 */
96 private static $page_url = '';
97
98 /**
99 * Holds a list of add-ons available for installation.
100 *
101 * @var array
102 */
103 private static $available_addons = array();
104
105 /**
106 * Path to views.
107 *
108 * @var string
109 */
110 private static $view_path = '';
111
112 /**
113 * Upgrade URL.
114 *
115 * @var string
116 */
117 private static $upgrade_link = '';
118
119 /**
120 * Initialize hooks for template page only.
121 *
122 * @since 6.9
123 */
124 public static function load_admin_hooks() {
125 self::set_page_url();
126 add_action( 'admin_init', __CLASS__ . '::do_admin_redirects' );
127
128 if ( self::has_onboarding_been_skipped() ) {
129 add_filter( 'option_frm_inbox', __CLASS__ . '::add_wizard_to_floating_links' );
130 }
131
132 // Load page if admin page is Onboarding Wizard.
133 self::maybe_load_page();
134 }
135
136 /**
137 * Performs a safe redirect to the welcome screen when the plugin is activated.
138 * On single activation, we will redirect immediately.
139 * When activating multiple plugins, the redirect is delayed until a Formidable page is loaded.
140 *
141 * @return void
142 */
143 public static function do_admin_redirects() {
144 $current_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
145
146 // Prevent endless loop.
147 if ( $current_page === self::PAGE_SLUG ) {
148 return;
149 }
150
151 // Only do this for single site installs.
152 if ( is_network_admin() ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
153 self::mark_onboarding_as_skipped();
154 return;
155 }
156
157 if ( self::has_onboarding_been_skipped() || FrmAppHelper::pro_is_connected() ) {
158 return;
159 }
160
161 $transient_value = get_transient( self::TRANSIENT_NAME );
162 if ( ! in_array( $transient_value, array( self::TRANSIENT_VALUE, self::TRANSIENT_MULTI_VALUE ), true ) ) {
163 return;
164 }
165
166 if ( isset( $_GET['activate-multi'] ) ) {
167 /**
168 * $_GET['activate-multi'] is set after activating multiple plugins.
169 * In this case, change the transient value so we know for future checks.
170 */
171 set_transient( self::TRANSIENT_NAME, self::TRANSIENT_MULTI_VALUE, 60 );
172 return;
173 }
174
175 if ( self::TRANSIENT_MULTI_VALUE === $transient_value && ! FrmAppHelper::is_formidable_admin() ) {
176 // For multi-activations we want to only redirect when a user loads a Formidable page.
177 return;
178 }
179
180 set_transient( self::TRANSIENT_NAME, 'no', 60 );
181
182 // Prevent redirect with every activation.
183 if ( self::has_already_redirected() ) {
184 return;
185 }
186
187 // Redirect to the onboarding wizard's initial step.
188 $page_url = add_query_arg( 'step', self::INITIAL_STEP, self::$page_url );
189 if ( wp_safe_redirect( esc_url_raw( $page_url ) ) ) {
190 exit;
191 }
192 }
193
194 /**
195 * Initializes the Onboarding Wizard setup if on its designated admin page.
196 *
197 * @since 6.9
198 *
199 * @return void
200 */
201 public static function maybe_load_page() {
202 if ( self::is_onboarding_wizard_page() ) {
203 add_action( 'admin_menu', __CLASS__ . '::menu', 99 );
204 add_action( 'admin_init', __CLASS__ . '::assign_properties' );
205 add_action( 'admin_enqueue_scripts', __CLASS__ . '::enqueue_assets', 15 );
206 add_action( 'admin_head', __CLASS__ . '::remove_menu' );
207
208 add_filter( 'admin_body_class', __CLASS__ . '::add_admin_body_classes', 999 );
209 add_filter( 'frm_show_footer_links', '__return_false' );
210 }
211 }
212
213 /**
214 * Initializes class properties with essential values for operation.
215 *
216 * @since 6.9
217 *
218 * @return void
219 */
220 public static function assign_properties() {
221 self::$view_path = FrmAppHelper::plugin_path() . '/classes/views/onboarding-wizard/';
222
223 self::$upgrade_link = FrmAppHelper::admin_upgrade_link(
224 array(
225 'medium' => 'onboarding-wizard',
226 'content' => 'upgrade',
227 )
228 );
229
230 self::set_available_addons();
231 }
232
233 /**
234 * Add Onboarding Wizard menu item to sidebar and define index page.
235 *
236 * @since 6.9
237 *
238 * @return void
239 */
240 public static function menu() {
241 if ( ! current_user_can( 'activate_plugins' ) ) {
242 return;
243 }
244
245 $label = __( 'Onboarding Wizard', 'formidable' );
246
247 add_submenu_page(
248 'formidable',
249 'Formidable | ' . $label,
250 $label,
251 self::REQUIRED_CAPABILITY,
252 self::PAGE_SLUG,
253 array( __CLASS__, 'render' )
254 );
255 }
256
257 /**
258 * Renders the Onboarding Wizard page in the WordPress admin area.
259 *
260 * @since 6.9
261 *
262 * @return void
263 */
264 public static function render() {
265 if ( self::has_onboarding_been_skipped() ) {
266 delete_option( self::ONBOARDING_SKIPPED_OPTION );
267 self::has_already_redirected();
268 }
269
270 // Include SVG images for icons.
271 FrmAppHelper::include_svg();
272
273 $view_path = self::get_view_path();
274 $available_addons = self::get_available_addons();
275 $upgrade_link = self::get_upgrade_link();
276 $addons_count = FrmAddonsController::get_addons_count();
277 $license_key = base64_decode( rawurldecode( FrmAppHelper::get_param( 'key', '', 'request', 'sanitize_text_field' ) ) );
278 $pro_is_installed = FrmAppHelper::pro_is_installed();
279
280 // Note: Add step parts in order.
281 $step_parts = array(
282 'consent-tracking' => 'steps/consent-tracking-step.php',
283 'install-addons' => 'steps/install-addons-step.php',
284 'success' => 'steps/success-step.php',
285 'unsuccessful' => 'steps/unsuccessful-step.php',
286 );
287
288 include $view_path . 'index.php';
289 }
290
291 /**
292 * Handle AJAX request to setup the "Never miss an important update" step.
293 *
294 * @since 6.9
295 *
296 * @return void
297 */
298 public static function ajax_consent_tracking() {
299 // Check permission and nonce.
300 FrmAppHelper::permission_check( self::REQUIRED_CAPABILITY );
301 check_ajax_referer( 'frm_ajax', 'nonce' );
302
303 // Update Settings.
304 $frm_settings = FrmAppHelper::get_settings();
305 $frm_settings->update_setting( 'tracking', true, 'rest_sanitize_boolean' );
306
307 // Remove the 'FrmProSettingsController::store' action to avoid PHP errors during AJAX call.
308 remove_action( 'frm_store_settings', 'FrmProSettingsController::store' );
309 $frm_settings->store();
310
311 self::subscribe_to_active_campaign();
312
313 // Send response.
314 wp_send_json_success();
315 }
316
317 /**
318 * When the user consents to receiving news of updates, subscribe their email to ActiveCampaign.
319 *
320 * @since 6.16
321 *
322 * @return void
323 */
324 private static function subscribe_to_active_campaign() {
325 $user = wp_get_current_user();
326 if ( empty( $user->user_email ) ) {
327 return;
328 }
329
330 if ( ! self::should_send_email_to_active_campaign( $user->user_email ) ) {
331 return;
332 }
333
334 wp_remote_post(
335 'https://sandbox.formidableforms.com/api/wp-admin/admin-ajax.php?action=frm_forms_preview&form=subscribe-onboarding',
336 array(
337 'body' => http_build_query(
338 array(
339 'form_key' => 'subscribe-onboarding',
340 'frm_action' => 'create',
341 'form_id' => 5,
342 'item_key' => '',
343 'item_meta[0]' => '',
344 'item_meta[15]' => $user->user_email,
345 'item_meta[17]' => 'Source - FF Lite Plugin Onboarding',
346 )
347 ),
348 )
349 );
350 }
351
352 /**
353 * Try to skip any fake emails.
354 *
355 * @since 6.16
356 *
357 * @param string $email
358 * @return bool
359 */
360 private static function should_send_email_to_active_campaign( $email ) {
361 $substrings = array(
362 '@wpengine.local',
363 '@example.com',
364 '@localhost',
365 '@local.dev',
366 '@local.test',
367 );
368 foreach ( $substrings as $substring ) {
369 if ( false !== strpos( $email, $substring ) ) {
370 return false;
371 }
372 }
373 return true;
374 }
375
376 /**
377 * Handle AJAX request to set up usage data for the Onboarding Wizard.
378 *
379 * @since 6.9
380 *
381 * @return void
382 */
383 public static function setup_usage_data() {
384 // Check permission and nonce.
385 FrmAppHelper::permission_check( self::REQUIRED_CAPABILITY );
386 check_ajax_referer( 'frm_ajax', 'nonce' );
387
388 // Retrieve the current usage data.
389 $usage_data = self::get_usage_data();
390
391 $fields_to_update = array(
392 'allows_tracking' => 'rest_sanitize_boolean',
393 'installed_addons' => 'sanitize_text_field',
394 'processed_steps' => 'sanitize_text_field',
395 'completed_steps' => 'rest_sanitize_boolean',
396 );
397
398 foreach ( $fields_to_update as $field => $sanitize_callback ) {
399 if ( isset( $_POST[ $field ] ) ) {
400 $usage_data[ $field ] = FrmAppHelper::get_post_param( $field, '', $sanitize_callback );
401 }
402 }
403
404 update_option( self::USAGE_DATA_OPTION, $usage_data );
405 wp_send_json_success();
406 }
407
408 /**
409 * Enqueues the Onboarding Wizard page scripts and styles.
410 *
411 * @since 6.9
412 *
413 * @return void
414 */
415 public static function enqueue_assets() {
416 $plugin_url = FrmAppHelper::plugin_url();
417 $version = FrmAppHelper::plugin_version();
418 $js_dependencies = array(
419 'wp-i18n',
420 // This prevents a console error "wp.hooks is undefined" in WP versions older than 5.7.
421 'wp-hooks',
422 'formidable_dom',
423 );
424
425 // Enqueue styles that needed.
426 wp_enqueue_style( 'formidable-admin' );
427 wp_enqueue_style( 'formidable-grids' );
428
429 // Register and enqueue Onboarding Wizard style.
430 wp_register_style( self::SCRIPT_HANDLE, $plugin_url . '/css/admin/onboarding-wizard.css', array(), $version );
431 wp_enqueue_style( self::SCRIPT_HANDLE );
432
433 // Register and enqueue Onboarding Wizard script.
434 wp_register_script( self::SCRIPT_HANDLE, $plugin_url . '/js/onboarding-wizard.js', $js_dependencies, $version, true );
435 wp_localize_script( self::SCRIPT_HANDLE, 'frmOnboardingWizardVars', self::get_js_variables() );
436 wp_enqueue_script( self::SCRIPT_HANDLE );
437
438 /**
439 * Fires after the Onboarding Wizard enqueue assets.
440 *
441 * @since 6.9
442 */
443 do_action( 'frm_onboarding_wizard_enqueue_assets' );
444
445 FrmAppHelper::dequeue_extra_global_scripts();
446 }
447
448 /**
449 * Get the Onboarding Wizard JS variables as an array.
450 *
451 * @since 6.9
452 *
453 * @return array
454 */
455 private static function get_js_variables() {
456 return array(
457 'INITIAL_STEP' => self::INITIAL_STEP,
458 );
459 }
460
461 /**
462 * Remove the Onboarding Wizard submenu page from the formidable parent menu
463 * since it is not necessary to show that link there.
464 *
465 * @since 6.9
466 *
467 * @return void
468 */
469 public static function remove_menu() {
470 remove_submenu_page( 'formidable', self::PAGE_SLUG );
471 }
472
473 /**
474 * Adds custom classes to the existing string of admin body classes.
475 *
476 * The function appends a custom class to the existing admin body classes, enabling full-screen mode for the admin interface.
477 *
478 * @since 6.9
479 *
480 * @param string $classes Existing body classes.
481 * @return string Updated list of body classes, including the newly added classes.
482 */
483 public static function add_admin_body_classes( $classes ) {
484 return $classes . ' frm-admin-full-screen';
485 }
486
487 /**
488 * Checks if the Onboarding Wizard was skipped during the plugin's installation.
489 *
490 * @since 6.9
491 * @return bool True if the Onboarding Wizard was skipped, false otherwise.
492 */
493 public static function has_onboarding_been_skipped() {
494 return get_option( self::ONBOARDING_SKIPPED_OPTION, false );
495 }
496
497 /**
498 * Marks the Onboarding Wizard as skipped to prevent automatic redirects to the wizard.
499 *
500 * @since 6.9
501 * @return void
502 */
503 public static function mark_onboarding_as_skipped() {
504 update_option( self::ONBOARDING_SKIPPED_OPTION, true, 'no' );
505 }
506
507 /**
508 * Adds an Onboarding Wizard welcome message to the floating notifications.
509 *
510 * @since 6.9
511 *
512 * @param array $inbox_messages The array of existing inbox messages.
513 * @return array Configuration for the onboarding wizard slide-in notification.
514 */
515 public static function add_wizard_to_floating_links( $inbox_messages ) {
516 $message = __( 'Welcome to Formidable Forms! Click here to run the Onboarding Wizard and it will guide you through the basic settings and get you started in 2 minutes.', 'formidable' );
517
518 return array(
519 'onboarding_wizard' => array(
520 'subject' => esc_html__( 'Begin With Ease!', 'formidable' ),
521 'message' => esc_html( $message ),
522 'slidein' => esc_html( $message ),
523 'cta' => '<a href="' . esc_url( self::$page_url ) . '" class="button-primary frm-button-primary" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Begin Setup', 'formidable' ) . '</a>',
524 'created' => time(),
525 'key' => 'onboarding_wizard',
526 ),
527 );
528 }
529
530 /**
531 * Check if the current page is the Onboarding Wizard page.
532 *
533 * @since 6.9
534 *
535 * @return bool True if the current page is the Onboarding Wizard page, false otherwise.
536 */
537 public static function is_onboarding_wizard_page() {
538 return FrmAppHelper::is_admin_page( self::PAGE_SLUG );
539 }
540
541 /**
542 * Checks if the plugin has already performed a redirect to avoid repeated redirections.
543 *
544 * @return bool Returns true if already redirected, otherwise false.
545 */
546 private static function has_already_redirected() {
547 if ( get_option( self::REDIRECT_STATUS_OPTION ) ) {
548 return true;
549 }
550
551 update_option( self::REDIRECT_STATUS_OPTION, FrmAppHelper::plugin_version(), 'no' );
552 return false;
553 }
554
555 /**
556 * Get the path to the Onboarding Wizard views.
557 *
558 * @since 6.9
559 *
560 * @return string Path to views.
561 */
562 public static function get_page_url() {
563 return self::$page_url;
564 }
565
566 /**
567 * Set the URL to access the Onboarding Wizard's page.
568 *
569 * @return void
570 */
571 private static function set_page_url() {
572 self::$page_url = admin_url( 'admin.php?page=' . self::PAGE_SLUG );
573 }
574
575 /**
576 * Get the list of add-ons available for installation.
577 *
578 * @since 6.9
579 *
580 * @return array A list of add-ons.
581 */
582 public static function get_available_addons() {
583 return self::$available_addons;
584 }
585
586 /**
587 * Set the list of add-ons available for installation.
588 *
589 * @since 6.9
590 *
591 * @return void
592 */
593 private static function set_available_addons() {
594 $pro_is_installed = FrmAppHelper::pro_is_installed();
595 $plugins = get_plugins();
596
597 // Base add-ons always included.
598 self::$available_addons['spam-protection'] = array(
599 'title' => esc_html__( 'Spam Protection', 'formidable' ),
600 'is-checked' => true,
601 'is-disabled' => true,
602 'help-text' => esc_html__( 'Get anti-spam options like reCAPTCHA, hCaptcha, Akismet, Turnstile and the blocklist.', 'formidable' ),
603 );
604 self::$available_addons['stripe-payments'] = array(
605 'title' => esc_html__( 'Stripe Payments', 'formidable' ),
606 'is-checked' => true,
607 'is-disabled' => true,
608 'help-text' => esc_html__( 'Collect donations and payments with your forms. Offer physical products, digital goods, services, and more.', 'formidable' ),
609 );
610
611 // Add-ons included when Pro is not installed.
612 if ( ! $pro_is_installed ) {
613 self::$available_addons['visual-styler'] = array(
614 'title' => esc_html__( 'Visual Styler', 'formidable' ),
615 'is-checked' => true,
616 'is-disabled' => true,
617 'help-text' => esc_html__( 'Customize form appearance with an intuitive styling interface.', 'formidable' ),
618 );
619 self::$available_addons['save-entries'] = array(
620 'title' => esc_html__( 'Save Entries', 'formidable' ),
621 'is-checked' => true,
622 'is-disabled' => true,
623 'help-text' => esc_html__( 'Save form submissions to your database for future reference and analysis.', 'formidable' ),
624 );
625 }
626
627 // SMTP add-on if wp_mail_smtp is not installed.
628 if ( ! function_exists( 'wp_mail_smtp' ) ) {
629 $wp_mail_smtp_plugin = 'wp-mail-smtp/wp_mail_smtp.php';
630 $is_installed_wp_mail_smtp = array_key_exists( $wp_mail_smtp_plugin, $plugins );
631
632 self::$available_addons['wp-mail-smtp'] = array(
633 'title' => esc_html__( 'SMTP', 'formidable' ),
634 'rel' => $is_installed_wp_mail_smtp ? $wp_mail_smtp_plugin : 'wp-mail-smtp',
635 'is-checked' => false,
636 'is-vendor' => true,
637 'is-installed' => $is_installed_wp_mail_smtp,
638 'help-text' => esc_html__( 'Improve email deliverability by routing WordPress emails through SMTP.', 'formidable' ),
639 );
640 }
641
642 // Add-ons available when Pro is installed.
643 if ( $pro_is_installed ) {
644 $available_pro_addons = array(
645 'formidable-views' => array(
646 'addon_key' => 'views',
647 'title' => __( 'Views', 'formidable' ),
648 'plugin_file' => 'formidable-views/formidable-views.php',
649 ),
650 'formidable-mailchimp' => array(
651 'addon_key' => 'mailchimp',
652 'title' => __( 'Mailchimp', 'formidable' ),
653 'plugin_file' => 'formidable-mailchimp/formidable-mailchimp.php',
654 ),
655 'formidable-registration' => array(
656 'addon_key' => 'registration',
657 'title' => __( 'User Registration', 'formidable' ),
658 'plugin_file' => 'formidable-registration/formidable-registration.php',
659 ),
660 'formidable-api' => array(
661 'addon_key' => 'api',
662 'title' => __( 'Form Rest API', 'formidable' ),
663 'plugin_file' => 'formidable-api/formidable-api.php',
664 ),
665 'formidable-signature' => array(
666 'addon_key' => 'signature',
667 'title' => __( 'Signature Forms', 'formidable' ),
668 'plugin_file' => 'formidable-signature/signature.php',
669 ),
670 );
671
672 // Include ACF Forms add-on if ACF is installed.
673 if ( class_exists( 'ACF' ) ) {
674 $available_pro_addons['formidable-acf'] = array(
675 'addon_key' => 'acf',
676 'title' => __( 'ACF Forms', 'formidable' ),
677 'plugin_file' => 'formidable-acf/formidable-acf.php',
678 );
679 }
680
681 foreach ( $available_pro_addons as $key => $data ) {
682 $addon = FrmAddonsController::get_addon( $data['addon_key'] );
683 $plugin_file = $data['plugin_file'];
684
685 if ( ! is_plugin_active( $plugin_file ) && isset( $addon['url'] ) ) {
686 $is_installed = array_key_exists( $plugin_file, $plugins );
687
688 self::$available_addons[ $key ] = array(
689 'title' => $data['title'],
690 'rel' => $is_installed ? $plugin_file : $addon['url'],
691 'is-checked' => false,
692 'is-installed' => $is_installed,
693 'help-text' => $addon['excerpt'],
694 );
695 }
696 }
697 }//end if
698
699 // Gravity Forms Migrator add-on.
700 $gravity_forms_plugin = 'formidable-gravity-forms-importer/formidable-gravity-forms-importer.php';
701 if ( class_exists( 'GFForms' ) && ! is_plugin_active( $gravity_forms_plugin ) ) {
702 $is_installed_gravity_forms = array_key_exists( $gravity_forms_plugin, $plugins );
703
704 self::$available_addons['formidable-gravity-forms-importer'] = array(
705 'title' => esc_html__( 'Gravity Forms Migrator', 'formidable' ),
706 'rel' => $is_installed_gravity_forms ? $gravity_forms_plugin : 'formidable-gravity-forms-importer',
707 'is-checked' => false,
708 'is-vendor' => true,
709 'is-installed' => $is_installed_gravity_forms,
710 'help-text' => esc_html__( 'Easily migrate your forms from Gravity Forms to Formidable.', 'formidable' ),
711 );
712 }
713 }
714
715 /**
716 * Get the path to the Onboarding Wizard views.
717 *
718 * @since 6.9
719 *
720 * @return string Path to views.
721 */
722 public static function get_view_path() {
723 return self::$view_path;
724 }
725
726 /**
727 * Get the upgrade link.
728 *
729 * @since 6.9
730 *
731 * @return string URL for upgrading accounts.
732 */
733 public static function get_upgrade_link() {
734 return self::$upgrade_link;
735 }
736
737 /**
738 * Retrieves the current Onboarding Wizard usage data, returning an empty array if none exists.
739 *
740 * @since 6.9
741 *
742 * @return array Current usage data.
743 */
744 public static function get_usage_data() {
745 return get_option( self::USAGE_DATA_OPTION, array() );
746 }
747
748 /**
749 * Validates if the Onboarding Wizard page is being displayed.
750 *
751 * @since 6.9
752 * @deprecated 6.16
753 *
754 * @return bool True if the Onboarding Wizard page is displayed, false otherwise.
755 */
756 public static function is_onboarding_wizard_displayed() {
757 _deprecated_function( __METHOD__, '6.16' );
758 return get_transient( self::TRANSIENT_NAME ) === self::TRANSIENT_VALUE;
759 }
760 }
761