← All changes
|
classes/controllers/FrmOnboardingWizardController.php
+118
-170
6.27
→
6.15
View file →
| @@ -45,9 +45,8 @@ | ||
| 45 | 45 | const TRANSIENT_NAME = 'frm_activation_redirect'; |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Transient value associated with the redirection to the Onboarding Wizard page. |
| 49 | - * Used when activating a single plugin. | |
| 50 | 49 | * |
| 51 | 50 | * @var string |
| 52 | 51 | */ |
| 53 | 52 | const TRANSIENT_VALUE = 'formidable-welcome'; |
| @@ -52,16 +51,8 @@ | ||
| 52 | 51 | */ |
| 53 | 52 | const TRANSIENT_VALUE = 'formidable-welcome'; |
| 54 | 53 | |
| 55 | 54 | /** |
| 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 | 55 | * Option name for storing the redirect status for the Onboarding Wizard page. |
| 65 | 56 | * |
| 66 | 57 | * @var string |
| 67 | 58 | */ |
| @@ -78,9 +69,9 @@ | ||
| 78 | 69 | * Defines the initial step for redirection within the application flow. |
| 79 | 70 | * |
| 80 | 71 | * @var string |
| 81 | 72 | */ |
| 82 | - const INITIAL_STEP = 'consent-tracking'; | |
| 73 | + const INITIAL_STEP = 'welcome'; | |
| 83 | 74 | |
| 84 | 75 | /** |
| 85 | 76 | * Option name to store usage data. |
| 86 | 77 | * |
| @@ -119,17 +110,15 @@ | ||
| 119 | 110 | /** |
| 120 | 111 | * Initialize hooks for template page only. |
| 121 | 112 | * |
| 122 | 113 | * @since 6.9 |
| 123 | - * | |
| 124 | - * @return void | |
| 125 | 114 | */ |
| 126 | 115 | public static function load_admin_hooks() { |
| 127 | 116 | self::set_page_url(); |
| 128 | - add_action( 'admin_init', self::class . '::do_admin_redirects' ); | |
| 117 | + add_action( 'admin_init', __CLASS__ . '::do_admin_redirects' ); | |
| 129 | 118 | |
| 130 | 119 | if ( self::has_onboarding_been_skipped() ) { |
| 131 | - add_filter( 'option_frm_inbox', self::class . '::add_wizard_to_floating_links' ); | |
| 120 | + add_filter( 'option_frm_inbox', __CLASS__ . '::add_wizard_to_floating_links' ); | |
| 132 | 121 | } |
| 133 | 122 | |
| 134 | 123 | // Load page if admin page is Onboarding Wizard. |
| 135 | 124 | self::maybe_load_page(); |
| @@ -136,10 +125,8 @@ | ||
| 136 | 125 | } |
| 137 | 126 | |
| 138 | 127 | /** |
| 139 | 128 | * Performs a safe redirect to the welcome screen when the plugin is activated. |
| 140 | - * On single activation, we will redirect immediately. | |
| 141 | - * When activating multiple plugins, the redirect is delayed until a Formidable page is loaded. | |
| 142 | 129 | * |
| 143 | 130 | * @return void |
| 144 | 131 | */ |
| 145 | 132 | public static function do_admin_redirects() { |
| @@ -155,32 +142,13 @@ | ||
| 155 | 142 | self::mark_onboarding_as_skipped(); |
| 156 | 143 | return; |
| 157 | 144 | } |
| 158 | 145 | |
| 159 | - if ( self::has_onboarding_been_skipped() || FrmAppHelper::pro_is_connected() ) { | |
| 146 | + // Check if we should consider redirection. | |
| 147 | + if ( ! FrmAppHelper::is_formidable_admin() || ! self::is_onboarding_wizard_displayed() || self::has_onboarding_been_skipped() || FrmAppHelper::pro_is_connected() ) { | |
| 160 | 148 | return; |
| 161 | 149 | } |
| 162 | 150 | |
| 163 | - $transient_value = get_transient( self::TRANSIENT_NAME ); | |
| 164 | - | |
| 165 | - if ( ! in_array( $transient_value, array( self::TRANSIENT_VALUE, self::TRANSIENT_MULTI_VALUE ), true ) ) { | |
| 166 | - return; | |
| 167 | - } | |
| 168 | - | |
| 169 | - if ( isset( $_GET['activate-multi'] ) ) { | |
| 170 | - /** | |
| 171 | - * $_GET['activate-multi'] is set after activating multiple plugins. | |
| 172 | - * In this case, change the transient value so we know for future checks. | |
| 173 | - */ | |
| 174 | - set_transient( self::TRANSIENT_NAME, self::TRANSIENT_MULTI_VALUE, 60 ); | |
| 175 | - return; | |
| 176 | - } | |
| 177 | - | |
| 178 | - if ( self::TRANSIENT_MULTI_VALUE === $transient_value && ! FrmAppHelper::is_formidable_admin() ) { | |
| 179 | - // For multi-activations we want to only redirect when a user loads a Formidable page. | |
| 180 | - return; | |
| 181 | - } | |
| 182 | - | |
| 183 | 151 | set_transient( self::TRANSIENT_NAME, 'no', 60 ); |
| 184 | 152 | |
| 185 | 153 | // Prevent redirect with every activation. |
| 186 | 154 | if ( self::has_already_redirected() ) { |
| @@ -188,9 +156,8 @@ | ||
| 188 | 156 | } |
| 189 | 157 | |
| 190 | 158 | // Redirect to the onboarding wizard's initial step. |
| 191 | 159 | $page_url = add_query_arg( 'step', self::INITIAL_STEP, self::$page_url ); |
| 192 | - | |
| 193 | 160 | if ( wp_safe_redirect( esc_url_raw( $page_url ) ) ) { |
| 194 | 161 | exit; |
| 195 | 162 | } |
| 196 | 163 | } |
| @@ -203,18 +170,14 @@ | ||
| 203 | 170 | * @return void |
| 204 | 171 | */ |
| 205 | 172 | public static function maybe_load_page() { |
| 206 | 173 | if ( self::is_onboarding_wizard_page() ) { |
| 207 | - // Dismiss the onboarding wizard message so it stops appearing after it is clicked. | |
| 208 | - $message = new FrmInbox(); | |
| 209 | - $message->dismiss( 'onboarding_wizard' ); | |
| 174 | + add_action( 'admin_menu', __CLASS__ . '::menu', 99 ); | |
| 175 | + add_action( 'admin_init', __CLASS__ . '::assign_properties' ); | |
| 176 | + add_action( 'admin_enqueue_scripts', __CLASS__ . '::enqueue_assets', 15 ); | |
| 177 | + add_action( 'admin_head', __CLASS__ . '::remove_menu' ); | |
| 210 | 178 | |
| 211 | - add_action( 'admin_menu', self::class . '::menu', 99 ); | |
| 212 | - add_action( 'admin_init', self::class . '::assign_properties' ); | |
| 213 | - add_action( 'admin_enqueue_scripts', self::class . '::enqueue_assets', 15 ); | |
| 214 | - add_action( 'admin_head', self::class . '::remove_menu' ); | |
| 215 | - | |
| 216 | - add_filter( 'admin_body_class', self::class . '::add_admin_body_classes', 999 ); | |
| 179 | + add_filter( 'admin_body_class', __CLASS__ . '::add_admin_body_classes', 999 ); | |
| 217 | 180 | add_filter( 'frm_show_footer_links', '__return_false' ); |
| 218 | 181 | } |
| 219 | 182 | } |
| 220 | 183 | |
| @@ -257,9 +220,9 @@ | ||
| 257 | 220 | 'Formidable | ' . $label, |
| 258 | 221 | $label, |
| 259 | 222 | self::REQUIRED_CAPABILITY, |
| 260 | 223 | self::PAGE_SLUG, |
| 261 | - array( self::class, 'render' ) | |
| 224 | + array( __CLASS__, 'render' ) | |
| 262 | 225 | ); |
| 263 | 226 | } |
| 264 | 227 | |
| 265 | 228 | /** |
| @@ -286,12 +249,14 @@ | ||
| 286 | 249 | $pro_is_installed = FrmAppHelper::pro_is_installed(); |
| 287 | 250 | |
| 288 | 251 | // Note: Add step parts in order. |
| 289 | 252 | $step_parts = array( |
| 290 | - 'consent-tracking' => 'steps/consent-tracking-step.php', | |
| 291 | - 'install-addons' => 'steps/install-addons-step.php', | |
| 292 | - 'success' => 'steps/success-step.php', | |
| 293 | - 'unsuccessful' => 'steps/unsuccessful-step.php', | |
| 253 | + 'welcome' => 'steps/welcome-step.php', | |
| 254 | + 'install-formidable-pro' => 'steps/install-formidable-pro-step.php', | |
| 255 | + 'license-management' => 'steps/license-management-step.php', | |
| 256 | + 'default-email-address' => 'steps/default-email-address-step.php', | |
| 257 | + 'install-addons' => 'steps/install-addons-step.php', | |
| 258 | + 'success' => 'steps/success-step.php', | |
| 294 | 259 | ); |
| 295 | 260 | |
| 296 | 261 | include $view_path . 'index.php'; |
| 297 | 262 | } |
| @@ -296,29 +261,35 @@ | ||
| 296 | 261 | include $view_path . 'index.php'; |
| 297 | 262 | } |
| 298 | 263 | |
| 299 | 264 | /** |
| 300 | - * Handle AJAX request to setup the "Never miss an important update" step. | |
| 265 | + * Handle AJAX request to setup the "Default Email Address" step. | |
| 301 | 266 | * |
| 302 | 267 | * @since 6.9 |
| 303 | 268 | * |
| 304 | 269 | * @return void |
| 305 | 270 | */ |
| 306 | - public static function ajax_consent_tracking() { | |
| 271 | + public static function ajax_setup_email_step() { | |
| 307 | 272 | // Check permission and nonce. |
| 308 | 273 | FrmAppHelper::permission_check( self::REQUIRED_CAPABILITY ); |
| 309 | 274 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 310 | 275 | |
| 276 | + // Get posted data. | |
| 277 | + $from_email = FrmAppHelper::get_post_param( 'from_email', '', 'sanitize_email' ); | |
| 278 | + $default_email = FrmAppHelper::get_post_param( 'default_email', '', 'sanitize_email' ); | |
| 279 | + $allows_tracking = FrmAppHelper::get_post_param( 'allows_tracking', '', 'rest_sanitize_boolean' ); | |
| 280 | + $summary_emails = FrmAppHelper::get_post_param( 'summary_emails', '', 'rest_sanitize_boolean' ); | |
| 281 | + | |
| 311 | 282 | // Update Settings. |
| 312 | 283 | $frm_settings = FrmAppHelper::get_settings(); |
| 313 | - $frm_settings->update_setting( 'tracking', true, 'rest_sanitize_boolean' ); | |
| 314 | - | |
| 284 | + $frm_settings->update_setting( 'from_email', $from_email, 'sanitize_text_field' ); | |
| 285 | + $frm_settings->update_setting( 'default_email', $default_email, 'sanitize_text_field' ); | |
| 286 | + $frm_settings->update_setting( 'tracking', $allows_tracking, 'rest_sanitize_boolean' ); | |
| 287 | + $frm_settings->update_setting( 'summary_emails', $summary_emails, 'rest_sanitize_boolean' ); | |
| 315 | 288 | // Remove the 'FrmProSettingsController::store' action to avoid PHP errors during AJAX call. |
| 316 | 289 | remove_action( 'frm_store_settings', 'FrmProSettingsController::store' ); |
| 317 | 290 | $frm_settings->store(); |
| 318 | 291 | |
| 319 | - FrmEmailCollectionHelper::subscribe_to_active_campaign(); | |
| 320 | - | |
| 321 | 292 | // Send response. |
| 322 | 293 | wp_send_json_success(); |
| 323 | 294 | } |
| 324 | 295 | |
| @@ -337,9 +308,12 @@ | ||
| 337 | 308 | // Retrieve the current usage data. |
| 338 | 309 | $usage_data = self::get_usage_data(); |
| 339 | 310 | |
| 340 | 311 | $fields_to_update = array( |
| 312 | + 'default_email' => 'sanitize_email', | |
| 313 | + 'is_subscribed' => 'rest_sanitize_boolean', | |
| 341 | 314 | 'allows_tracking' => 'rest_sanitize_boolean', |
| 315 | + 'summary_emails' => 'rest_sanitize_boolean', | |
| 342 | 316 | 'installed_addons' => 'sanitize_text_field', |
| 343 | 317 | 'processed_steps' => 'sanitize_text_field', |
| 344 | 318 | 'completed_steps' => 'rest_sanitize_boolean', |
| 345 | 319 | ); |
| @@ -402,9 +376,10 @@ | ||
| 402 | 376 | * @return array |
| 403 | 377 | */ |
| 404 | 378 | private static function get_js_variables() { |
| 405 | 379 | return array( |
| 406 | - 'INITIAL_STEP' => self::INITIAL_STEP, | |
| 380 | + 'INITIAL_STEP' => self::INITIAL_STEP, | |
| 381 | + 'proIsIncluded' => FrmAppHelper::pro_is_included(), | |
| 407 | 382 | ); |
| 408 | 383 | } |
| 409 | 384 | |
| 410 | 385 | /** |
| @@ -426,9 +401,8 @@ | ||
| 426 | 401 | * |
| 427 | 402 | * @since 6.9 |
| 428 | 403 | * |
| 429 | 404 | * @param string $classes Existing body classes. |
| 430 | - * | |
| 431 | 405 | * @return string Updated list of body classes, including the newly added classes. |
| 432 | 406 | */ |
| 433 | 407 | public static function add_admin_body_classes( $classes ) { |
| 434 | 408 | return $classes . ' frm-admin-full-screen'; |
| @@ -437,9 +411,8 @@ | ||
| 437 | 411 | /** |
| 438 | 412 | * Checks if the Onboarding Wizard was skipped during the plugin's installation. |
| 439 | 413 | * |
| 440 | 414 | * @since 6.9 |
| 441 | - * | |
| 442 | 415 | * @return bool True if the Onboarding Wizard was skipped, false otherwise. |
| 443 | 416 | */ |
| 444 | 417 | public static function has_onboarding_been_skipped() { |
| 445 | 418 | return get_option( self::ONBOARDING_SKIPPED_OPTION, false ); |
| @@ -448,9 +421,8 @@ | ||
| 448 | 421 | /** |
| 449 | 422 | * Marks the Onboarding Wizard as skipped to prevent automatic redirects to the wizard. |
| 450 | 423 | * |
| 451 | 424 | * @since 6.9 |
| 452 | - * | |
| 453 | 425 | * @return void |
| 454 | 426 | */ |
| 455 | 427 | public static function mark_onboarding_as_skipped() { |
| 456 | 428 | update_option( self::ONBOARDING_SKIPPED_OPTION, true, 'no' ); |
| @@ -460,29 +432,24 @@ | ||
| 460 | 432 | * Adds an Onboarding Wizard welcome message to the floating notifications. |
| 461 | 433 | * |
| 462 | 434 | * @since 6.9 |
| 463 | 435 | * |
| 464 | - * @param mixed $inbox_messages The inbox option data. An array of existing inbox messages if there is valid data set in the option. | |
| 465 | - * | |
| 436 | + * @param array $inbox_messages The array of existing inbox messages. | |
| 466 | 437 | * @return array Configuration for the onboarding wizard slide-in notification. |
| 467 | 438 | */ |
| 468 | 439 | public static function add_wizard_to_floating_links( $inbox_messages ) { |
| 469 | - $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' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 440 | + $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' ); | |
| 470 | 441 | |
| 471 | - if ( ! is_array( $inbox_messages ) ) { | |
| 472 | - $inbox_messages = array(); | |
| 473 | - } | |
| 474 | - | |
| 475 | - $inbox_messages['onboarding_wizard'] = array( | |
| 476 | - 'subject' => esc_html__( 'Begin With Ease!', 'formidable' ), | |
| 477 | - 'message' => esc_html( $message ), | |
| 478 | - 'slidein' => esc_html( $message ), | |
| 479 | - '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>', // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 480 | - 'created' => time(), | |
| 481 | - 'key' => 'onboarding_wizard', | |
| 442 | + return array( | |
| 443 | + 'onboarding_wizard' => array( | |
| 444 | + 'subject' => esc_html__( 'Begin With Ease!', 'formidable' ), | |
| 445 | + 'message' => esc_html( $message ), | |
| 446 | + 'slidein' => esc_html( $message ), | |
| 447 | + '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>', | |
| 448 | + 'created' => time(), | |
| 449 | + 'key' => 'onboarding_wizard', | |
| 450 | + ), | |
| 482 | 451 | ); |
| 483 | - | |
| 484 | - return $inbox_messages; | |
| 485 | 452 | } |
| 486 | 453 | |
| 487 | 454 | /** |
| 488 | 455 | * Check if the current page is the Onboarding Wizard page. |
| @@ -495,8 +462,19 @@ | ||
| 495 | 462 | return FrmAppHelper::is_admin_page( self::PAGE_SLUG ); |
| 496 | 463 | } |
| 497 | 464 | |
| 498 | 465 | /** |
| 466 | + * Validates if the Onboarding Wizard page is being displayed. | |
| 467 | + * | |
| 468 | + * @since 6.9 | |
| 469 | + * | |
| 470 | + * @return bool True if the Onboarding Wizard page is displayed, false otherwise. | |
| 471 | + */ | |
| 472 | + public static function is_onboarding_wizard_displayed() { | |
| 473 | + return get_transient( self::TRANSIENT_NAME ) === self::TRANSIENT_VALUE; | |
| 474 | + } | |
| 475 | + | |
| 476 | + /** | |
| 499 | 477 | * Checks if the plugin has already performed a redirect to avoid repeated redirections. |
| 500 | 478 | * |
| 501 | 479 | * @return bool Returns true if already redirected, otherwise false. |
| 502 | 480 | */ |
| @@ -548,11 +526,9 @@ | ||
| 548 | 526 | * @return void |
| 549 | 527 | */ |
| 550 | 528 | private static function set_available_addons() { |
| 551 | 529 | $pro_is_installed = FrmAppHelper::pro_is_installed(); |
| 552 | - $plugins = get_plugins(); | |
| 553 | 530 | |
| 554 | - // Base add-ons always included. | |
| 555 | 531 | self::$available_addons['spam-protection'] = array( |
| 556 | 532 | 'title' => esc_html__( 'Spam Protection', 'formidable' ), |
| 557 | 533 | 'is-checked' => true, |
| 558 | 534 | 'is-disabled' => true, |
| @@ -563,10 +539,8 @@ | ||
| 563 | 539 | 'is-checked' => true, |
| 564 | 540 | 'is-disabled' => true, |
| 565 | 541 | 'help-text' => esc_html__( 'Collect donations and payments with your forms. Offer physical products, digital goods, services, and more.', 'formidable' ), |
| 566 | 542 | ); |
| 567 | - | |
| 568 | - // Add-ons included when Pro is not installed. | |
| 569 | 543 | if ( ! $pro_is_installed ) { |
| 570 | 544 | self::$available_addons['visual-styler'] = array( |
| 571 | 545 | 'title' => esc_html__( 'Visual Styler', 'formidable' ), |
| 572 | 546 | 'is-checked' => true, |
| @@ -579,94 +553,81 @@ | ||
| 579 | 553 | 'is-disabled' => true, |
| 580 | 554 | 'help-text' => esc_html__( 'Save form submissions to your database for future reference and analysis.', 'formidable' ), |
| 581 | 555 | ); |
| 582 | 556 | } |
| 583 | - | |
| 584 | - // SMTP add-on if wp_mail_smtp is not installed. | |
| 585 | 557 | if ( ! function_exists( 'wp_mail_smtp' ) ) { |
| 586 | - $wp_mail_smtp_plugin = 'wp-mail-smtp/wp_mail_smtp.php'; | |
| 587 | - $is_installed_wp_mail_smtp = array_key_exists( $wp_mail_smtp_plugin, $plugins ); | |
| 588 | - | |
| 589 | 558 | self::$available_addons['wp-mail-smtp'] = array( |
| 590 | - 'title' => esc_html__( 'SMTP', 'formidable' ), | |
| 591 | - 'rel' => $is_installed_wp_mail_smtp ? $wp_mail_smtp_plugin : 'wp-mail-smtp', | |
| 592 | - 'is-checked' => false, | |
| 593 | - 'is-vendor' => true, | |
| 594 | - 'is-installed' => $is_installed_wp_mail_smtp, | |
| 595 | - 'help-text' => esc_html__( 'Improve email deliverability by routing WordPress emails through SMTP.', 'formidable' ), | |
| 559 | + 'title' => esc_html__( 'SMTP', 'formidable' ), | |
| 560 | + 'rel' => 'wp-mail-smtp', | |
| 561 | + 'is-checked' => false, | |
| 562 | + 'is-vendor' => true, | |
| 563 | + 'help-text' => esc_html__( 'Improve email deliverability by routing WordPress emails through SMTP.', 'formidable' ), | |
| 596 | 564 | ); |
| 597 | 565 | } |
| 598 | - | |
| 599 | - // Add-ons available when Pro is installed. | |
| 600 | 566 | if ( $pro_is_installed ) { |
| 601 | - $available_pro_addons = array( | |
| 602 | - 'formidable-views' => array( | |
| 603 | - 'addon_key' => 'views', | |
| 604 | - 'title' => __( 'Views', 'formidable' ), | |
| 605 | - 'plugin_file' => 'formidable-views/formidable-views.php', | |
| 606 | - ), | |
| 607 | - 'formidable-mailchimp' => array( | |
| 608 | - 'addon_key' => 'mailchimp', | |
| 609 | - 'title' => __( 'Mailchimp', 'formidable' ), | |
| 610 | - 'plugin_file' => 'formidable-mailchimp/formidable-mailchimp.php', | |
| 611 | - ), | |
| 612 | - 'formidable-registration' => array( | |
| 613 | - 'addon_key' => 'registration', | |
| 614 | - 'title' => __( 'User Registration', 'formidable' ), | |
| 615 | - 'plugin_file' => 'formidable-registration/formidable-registration.php', | |
| 616 | - ), | |
| 617 | - 'formidable-api' => array( | |
| 618 | - 'addon_key' => 'api', | |
| 619 | - 'title' => __( 'Form Rest API', 'formidable' ), | |
| 620 | - 'plugin_file' => 'formidable-api/formidable-api.php', | |
| 621 | - ), | |
| 622 | - 'formidable-signature' => array( | |
| 623 | - 'addon_key' => 'signature', | |
| 624 | - 'title' => __( 'Signature Forms', 'formidable' ), | |
| 625 | - 'plugin_file' => 'formidable-signature/signature.php', | |
| 626 | - ), | |
| 627 | - ); | |
| 567 | + $views_addon = FrmAddonsController::get_addon( 'views' ); | |
| 568 | + $mailchimp_addon = FrmAddonsController::get_addon( 'mailchimp' ); | |
| 569 | + $registration_addon = FrmAddonsController::get_addon( 'registration' ); | |
| 570 | + $api_addon = FrmAddonsController::get_addon( 'api' ); | |
| 571 | + $acf_addon = FrmAddonsController::get_addon( 'acf' ); | |
| 572 | + $signature_addon = FrmAddonsController::get_addon( 'signature' ); | |
| 628 | 573 | |
| 629 | - // Include ACF Forms add-on if ACF is installed. | |
| 630 | - if ( class_exists( 'ACF' ) ) { | |
| 631 | - $available_pro_addons['formidable-acf'] = array( | |
| 632 | - 'addon_key' => 'acf', | |
| 633 | - 'title' => __( 'ACF Forms', 'formidable' ), | |
| 634 | - 'plugin_file' => 'formidable-acf/formidable-acf.php', | |
| 574 | + if ( ! is_plugin_active( 'formidable-views/formidable-views.php' ) && isset( $views_addon['url'] ) ) { | |
| 575 | + self::$available_addons['formidable-views'] = array( | |
| 576 | + 'title' => esc_html__( 'Views', 'formidable' ), | |
| 577 | + 'rel' => $views_addon['url'], | |
| 578 | + 'is-checked' => false, | |
| 579 | + 'help-text' => $views_addon['excerpt'], | |
| 635 | 580 | ); |
| 636 | 581 | } |
| 637 | - | |
| 638 | - foreach ( $available_pro_addons as $key => $data ) { | |
| 639 | - $addon = FrmAddonsController::get_addon( $data['addon_key'] ); | |
| 640 | - $plugin_file = $data['plugin_file']; | |
| 641 | - | |
| 642 | - if ( ! is_plugin_active( $plugin_file ) && isset( $addon['url'] ) ) { | |
| 643 | - $is_installed = array_key_exists( $plugin_file, $plugins ); | |
| 644 | - | |
| 645 | - self::$available_addons[ $key ] = array( | |
| 646 | - 'title' => $data['title'], | |
| 647 | - 'rel' => $is_installed ? $plugin_file : $addon['url'], | |
| 648 | - 'is-checked' => false, | |
| 649 | - 'is-installed' => $is_installed, | |
| 650 | - 'help-text' => $addon['excerpt'], | |
| 651 | - ); | |
| 652 | - } | |
| 582 | + if ( ! is_plugin_active( 'formidable-mailchimp/formidable-mailchimp.php' ) && isset( $mailchimp_addon['url'] ) ) { | |
| 583 | + self::$available_addons['formidable-mailchimp'] = array( | |
| 584 | + 'title' => esc_html__( 'Mailchimp', 'formidable' ), | |
| 585 | + 'rel' => $mailchimp_addon['url'], | |
| 586 | + 'is-checked' => false, | |
| 587 | + 'help-text' => $mailchimp_addon['excerpt'], | |
| 588 | + ); | |
| 653 | 589 | } |
| 590 | + if ( ! is_plugin_active( 'formidable-registration/formidable-registration.php' ) && isset( $registration_addon['url'] ) ) { | |
| 591 | + self::$available_addons['formidable-registration'] = array( | |
| 592 | + 'title' => esc_html__( 'User Registration', 'formidable' ), | |
| 593 | + 'rel' => $registration_addon['url'], | |
| 594 | + 'is-checked' => false, | |
| 595 | + 'help-text' => $registration_addon['excerpt'], | |
| 596 | + ); | |
| 597 | + } | |
| 598 | + if ( ! is_plugin_active( 'formidable-api/formidable-api.php' ) && isset( $api_addon['url'] ) ) { | |
| 599 | + self::$available_addons['formidable-api'] = array( | |
| 600 | + 'title' => esc_html__( 'Form Rest API', 'formidable' ), | |
| 601 | + 'rel' => $api_addon['url'], | |
| 602 | + 'is-checked' => false, | |
| 603 | + 'help-text' => $api_addon['excerpt'], | |
| 604 | + ); | |
| 605 | + } | |
| 606 | + if ( class_exists( 'ACF' ) && ! is_plugin_active( 'formidable-acf/formidable-acf.php' ) && isset( $acf_addon['url'] ) ) { | |
| 607 | + self::$available_addons['formidable-acf'] = array( | |
| 608 | + 'title' => esc_html__( 'ACF Forms', 'formidable' ), | |
| 609 | + 'rel' => $acf_addon['url'], | |
| 610 | + 'is-checked' => false, | |
| 611 | + 'help-text' => $acf_addon['excerpt'], | |
| 612 | + ); | |
| 613 | + } | |
| 614 | + if ( ! is_plugin_active( 'formidable-signature/signature.php' ) && isset( $signature_addon['url'] ) ) { | |
| 615 | + self::$available_addons['formidable-signature'] = array( | |
| 616 | + 'title' => esc_html__( 'Signature Forms', 'formidable' ), | |
| 617 | + 'rel' => $signature_addon['url'], | |
| 618 | + 'is-checked' => false, | |
| 619 | + 'help-text' => $signature_addon['excerpt'], | |
| 620 | + ); | |
| 621 | + } | |
| 654 | 622 | }//end if |
| 655 | - | |
| 656 | - // Gravity Forms Migrator add-on. | |
| 657 | - $gravity_forms_plugin = 'formidable-gravity-forms-importer/formidable-gravity-forms-importer.php'; | |
| 658 | - | |
| 659 | - if ( class_exists( 'GFForms' ) && ! is_plugin_active( $gravity_forms_plugin ) ) { | |
| 660 | - $is_installed_gravity_forms = array_key_exists( $gravity_forms_plugin, $plugins ); | |
| 661 | - | |
| 623 | + if ( class_exists( 'GFForms' ) && ! is_plugin_active( 'formidable-gravity-forms-importer/formidable-gravity-forms-importer.php' ) ) { | |
| 662 | 624 | self::$available_addons['formidable-gravity-forms-importer'] = array( |
| 663 | - 'title' => esc_html__( 'Gravity Forms Migrator', 'formidable' ), | |
| 664 | - 'rel' => $is_installed_gravity_forms ? $gravity_forms_plugin : 'formidable-gravity-forms-importer', | |
| 665 | - 'is-checked' => false, | |
| 666 | - 'is-vendor' => true, | |
| 667 | - 'is-installed' => $is_installed_gravity_forms, | |
| 668 | - 'help-text' => esc_html__( 'Easily migrate your forms from Gravity Forms to Formidable.', 'formidable' ), | |
| 625 | + 'title' => esc_html__( 'Gravity Forms Migrator', 'formidable' ), | |
| 626 | + 'rel' => 'formidable-gravity-forms-importer', | |
| 627 | + 'is-checked' => false, | |
| 628 | + 'is-vendor' => true, | |
| 629 | + 'help-text' => esc_html__( 'Easily migrate your forms from Gravity Forms to Formidable.', 'formidable' ), | |
| 669 | 630 | ); |
| 670 | 631 | } |
| 671 | 632 | } |
| 672 | 633 | |
| @@ -700,19 +661,6 @@ | ||
| 700 | 661 | * @return array Current usage data. |
| 701 | 662 | */ |
| 702 | 663 | public static function get_usage_data() { |
| 703 | 664 | return get_option( self::USAGE_DATA_OPTION, array() ); |
| 704 | - } | |
| 705 | - | |
| 706 | - /** | |
| 707 | - * Validates if the Onboarding Wizard page is being displayed. | |
| 708 | - * | |
| 709 | - * @since 6.9 | |
| 710 | - * @deprecated 6.16 | |
| 711 | - * | |
| 712 | - * @return bool True if the Onboarding Wizard page is displayed, false otherwise. | |
| 713 | - */ | |
| 714 | - public static function is_onboarding_wizard_displayed() { | |
| 715 | - _deprecated_function( __METHOD__, '6.16' ); | |
| 716 | - return get_transient( self::TRANSIENT_NAME ) === self::TRANSIENT_VALUE; | |
| 717 | 665 | } |
| 718 | 666 | } |