| @@ -3,9 +3,8 @@ | ||
| 3 | 3 | * Handles the installation of a solution and any dependencies. |
| 4 | 4 | * This page is shown when a Formidable plugin is activated. |
| 5 | 5 | * |
| 6 | 6 | * @since 4.06.02 |
| 7 | - * @package Formidable | |
| 8 | 7 | */ |
| 9 | 8 | |
| 10 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | 10 | die( 'You are not allowed to call this page directly.' ); |
| @@ -20,9 +19,8 @@ | ||
| 20 | 19 | /** |
| 21 | 20 | * Hidden welcome page slug. |
| 22 | 21 | * |
| 23 | 22 | * @since 4.06.02 |
| 24 | - * @var string | |
| 25 | 23 | */ |
| 26 | 24 | protected $page = ''; |
| 27 | 25 | |
| 28 | 26 | protected $icon = 'frm_icon_font frm_settings_icon'; |
| @@ -163,9 +161,9 @@ | ||
| 163 | 161 | if ( ! $this->is_current_plugin() ) { |
| 164 | 162 | return; |
| 165 | 163 | } |
| 166 | 164 | |
| 167 | - delete_transient( FrmOnboardingWizardController::TRANSIENT_NAME ); | |
| 165 | + delete_transient( 'frm_activation_redirect' ); | |
| 168 | 166 | |
| 169 | 167 | // Initial install. |
| 170 | 168 | wp_safe_redirect( $this->settings_link() ); |
| 171 | 169 | exit; |
| @@ -177,9 +175,9 @@ | ||
| 177 | 175 | protected function settings_link() { |
| 178 | 176 | return admin_url( 'index.php?page=' . $this->page ); |
| 179 | 177 | } |
| 180 | 178 | |
| 181 | - /** | |
| 179 | + /* | |
| 182 | 180 | * Add page to global settings. |
| 183 | 181 | */ |
| 184 | 182 | public function add_settings( $sections ) { |
| 185 | 183 | wp_enqueue_style( 'formidable-pro-fields' ); |
| @@ -217,9 +215,9 @@ | ||
| 217 | 215 | if ( $steps['complete']['current'] ) { |
| 218 | 216 | // Always show this step in settings. |
| 219 | 217 | $step['current'] = true; |
| 220 | 218 | |
| 221 | - $new_class = $all_imported ? ' button frm_hidden' : ''; | |
| 219 | + $new_class = $all_imported ? ' button frm_hidden' : ''; | |
| 222 | 220 | $step['button_class'] = str_replace( 'frm_grey disabled', $new_class, $step['button_class'] ); |
| 223 | 221 | } |
| 224 | 222 | if ( $all_imported ) { |
| 225 | 223 | $step['description'] = __( 'The following form(s) have been created.', 'formidable' ); |
| @@ -226,10 +224,10 @@ | ||
| 226 | 224 | } |
| 227 | 225 | $this->show_app_install( $step ); |
| 228 | 226 | |
| 229 | 227 | if ( ! $all_imported ) { |
| 230 | - $step = $steps['complete']; | |
| 231 | - $step['current'] = false; | |
| 228 | + $step = $steps['complete']; | |
| 229 | + $step['current'] = false; | |
| 232 | 230 | $step['button_class'] .= ' frm_grey disabled'; |
| 233 | 231 | $this->show_page_links( $step ); |
| 234 | 232 | } |
| 235 | 233 | } |
| @@ -309,37 +307,37 @@ | ||
| 309 | 307 | protected function get_steps_data() { |
| 310 | 308 | $pro_installed = FrmAppHelper::pro_is_connected(); |
| 311 | 309 | |
| 312 | 310 | $steps = array( |
| 313 | - 'license' => array( | |
| 314 | - 'label' => __( 'Connect to FormidableForms.com', 'formidable' ), | |
| 315 | - 'description' => __( 'Create a connection to get plugin downloads.', 'formidable' ), | |
| 316 | - 'button_label' => __( 'Connect an Account', 'formidable' ), | |
| 317 | - 'current' => empty( $pro_installed ), | |
| 318 | - 'complete' => $pro_installed, | |
| 319 | - 'num' => 1, | |
| 311 | + 'license' => array( | |
| 312 | + 'label' => __( 'Connect to FormidableForms.com', 'formidable' ), | |
| 313 | + 'description' => __( 'Create a connection to get plugin downloads.', 'formidable' ), | |
| 314 | + 'button_label' => __( 'Connect an Account', 'formidable' ), | |
| 315 | + 'current' => empty( $pro_installed ), | |
| 316 | + 'complete' => $pro_installed, | |
| 317 | + 'num' => 1, | |
| 320 | 318 | ), |
| 321 | - 'plugin' => array( | |
| 322 | - 'label' => __( 'Install and Activate Add-Ons', 'formidable' ), | |
| 323 | - 'description' => __( 'Install any required add-ons from FormidableForms.com.', 'formidable' ), | |
| 324 | - 'button_label' => __( 'Install & Activate', 'formidable' ), | |
| 325 | - 'current' => false, | |
| 326 | - 'complete' => false, | |
| 327 | - 'num' => 2, | |
| 319 | + 'plugin' => array( | |
| 320 | + 'label' => __( 'Install and Activate Add-Ons', 'formidable' ), | |
| 321 | + 'description' => __( 'Install any required add-ons from FormidableForms.com.', 'formidable' ), | |
| 322 | + 'button_label' => __( 'Install & Activate', 'formidable' ), | |
| 323 | + 'current' => false, | |
| 324 | + 'complete' => false, | |
| 325 | + 'num' => 2, | |
| 328 | 326 | ), |
| 329 | - 'import' => array( | |
| 330 | - 'label' => __( 'Setup Forms, Views, and Pages', 'formidable' ), | |
| 331 | - 'description' => __( 'Build the forms, views, and pages automatically.', 'formidable' ), | |
| 332 | - 'button_label' => __( 'Create Now', 'formidable' ), | |
| 333 | - 'complete' => $this->is_complete(), | |
| 334 | - 'num' => 3, | |
| 327 | + 'import' => array( | |
| 328 | + 'label' => __( 'Setup Forms, Views, and Pages', 'formidable' ), | |
| 329 | + 'description' => __( 'Build the forms, views, and pages automatically.', 'formidable' ), | |
| 330 | + 'button_label' => __( 'Create Now', 'formidable' ), | |
| 331 | + 'complete' => $this->is_complete(), | |
| 332 | + 'num' => 3, | |
| 335 | 333 | ), |
| 336 | 334 | 'complete' => array( |
| 337 | - 'label' => __( 'Customize Your New Pages', 'formidable' ), | |
| 338 | - 'description' => __( 'Make any required changes and publish the page.', 'formidable' ), | |
| 339 | - 'button_label' => __( 'View Page', 'formidable' ), | |
| 340 | - 'complete' => false, | |
| 341 | - 'num' => 4, | |
| 335 | + 'label' => __( 'Customize Your New Pages', 'formidable' ), | |
| 336 | + 'description' => __( 'Make any required changes and publish the page.', 'formidable' ), | |
| 337 | + 'button_label' => __( 'View Page', 'formidable' ), | |
| 338 | + 'complete' => false, | |
| 339 | + 'num' => 4, | |
| 342 | 340 | ), |
| 343 | 341 | ); |
| 344 | 342 | |
| 345 | 343 | $this->adjust_plugin_install_step( $steps ); |
| @@ -351,9 +349,9 @@ | ||
| 351 | 349 | if ( $step['complete'] ) { |
| 352 | 350 | $steps[ $k ]['current'] = false; |
| 353 | 351 | } else { |
| 354 | 352 | $steps[ $k ]['current'] = ! $has_current; |
| 355 | - $has_current = true; | |
| 353 | + $has_current = true; | |
| 356 | 354 | } |
| 357 | 355 | } elseif ( $step['current'] ) { |
| 358 | 356 | $has_current = true; |
| 359 | 357 | } |
| @@ -358,15 +356,15 @@ | ||
| 358 | 356 | $has_current = true; |
| 359 | 357 | } |
| 360 | 358 | |
| 361 | 359 | // Set disabled buttons. |
| 362 | - $class = $step['button_class'] ?? ''; | |
| 360 | + $class = isset( $step['button_class'] ) ? $step['button_class'] : ''; | |
| 363 | 361 | $class .= ' button-primary frm-button-primary'; |
| 364 | 362 | if ( ! $steps[ $k ]['current'] ) { |
| 365 | 363 | $class .= ' frm_grey disabled'; |
| 366 | 364 | } |
| 367 | 365 | $steps[ $k ]['button_class'] = $class; |
| 368 | - }//end foreach | |
| 366 | + } | |
| 369 | 367 | |
| 370 | 368 | return $steps; |
| 371 | 369 | } |
| 372 | 370 | |
| @@ -390,8 +388,9 @@ | ||
| 390 | 388 | $plugin = FrmAddonsController::install_link( $plugin_key ); |
| 391 | 389 | if ( $plugin['status'] === 'active' ) { |
| 392 | 390 | continue; |
| 393 | 391 | } |
| 392 | + $links[ $plugin_key ] = $plugin; | |
| 394 | 393 | if ( isset( $plugin['url'] ) ) { |
| 395 | 394 | $rel[] = $plugin['url']; |
| 396 | 395 | } else { |
| 397 | 396 | // Add-on is required but not allowed. |
| @@ -406,9 +405,9 @@ | ||
| 406 | 405 | esc_html__( 'You need permission to download the Formidable %1$s plugin', 'formidable' ), |
| 407 | 406 | implode( ', ', $missing ) |
| 408 | 407 | ); |
| 409 | 408 | } else { |
| 410 | - $steps['plugin']['links'] = $rel; | |
| 409 | + $steps['plugin']['links'] = $rel; | |
| 411 | 410 | $steps['plugin']['button_class'] = 'frm-solution-multiple '; |
| 412 | 411 | } |
| 413 | 412 | |
| 414 | 413 | if ( $steps['license']['complete'] && ! $steps['plugin']['complete'] ) { |
| @@ -419,9 +418,9 @@ | ||
| 419 | 418 | /** |
| 420 | 419 | * @return void |
| 421 | 420 | */ |
| 422 | 421 | protected function step_top( $step ) { |
| 423 | - $section_class = empty( $step['current'] ) ? 'frm_grey' : ''; | |
| 422 | + $section_class = ( ! isset( $step['current'] ) || ! $step['current'] ) ? 'frm_grey' : ''; | |
| 424 | 423 | |
| 425 | 424 | ?> |
| 426 | 425 | <section class="step step-install <?php echo esc_attr( $section_class ); ?>"> |
| 427 | 426 | <aside class="num"> |
| @@ -491,9 +490,9 @@ | ||
| 491 | 490 | protected function show_plugin_install( $step ) { |
| 492 | 491 | $this->step_top( $step ); |
| 493 | 492 | |
| 494 | 493 | if ( ! isset( $step['error'] ) ) { |
| 495 | - $rel = $step['links'] ?? array(); | |
| 494 | + $rel = isset( $step['links'] ) ? $step['links'] : array(); | |
| 496 | 495 | |
| 497 | 496 | ?> |
| 498 | 497 | <a rel="<?php echo esc_attr( implode( ',', $rel ) ); ?>" class="<?php echo esc_attr( $step['button_class'] ); ?>"> |
| 499 | 498 | <?php echo esc_html( $step['button_label'] ); ?> |
| @@ -517,9 +516,9 @@ | ||
| 517 | 516 | |
| 518 | 517 | $api = new FrmFormApi(); |
| 519 | 518 | $addons = $api->get_api_info(); |
| 520 | 519 | |
| 521 | - $id = $this->download_id(); | |
| 520 | + $id = $this->download_id(); | |
| 522 | 521 | $has_file = isset( $addons[ $id ] ) && isset( $addons[ $id ]['beta'] ); |
| 523 | 522 | |
| 524 | 523 | if ( ! $step['current'] ) { |
| 525 | 524 | ?> |
| @@ -575,9 +574,9 @@ | ||
| 575 | 574 | echo '</fieldset>'; |
| 576 | 575 | } else { |
| 577 | 576 | echo '</form>'; |
| 578 | 577 | } |
| 579 | - }//end if | |
| 578 | + } | |
| 580 | 579 | |
| 581 | 580 | $this->step_bottom( $step ); |
| 582 | 581 | } |
| 583 | 582 | |
| @@ -595,11 +594,9 @@ | ||
| 595 | 594 | $this->show_import_options( $this->view_options(), 'view' ); |
| 596 | 595 | } |
| 597 | 596 | |
| 598 | 597 | /** |
| 599 | - * @param array $options | |
| 600 | 598 | * @param string $importing |
| 601 | - * @param string $xml | |
| 602 | 599 | * |
| 603 | 600 | * @psalm-param 'form'|'view' $importing |
| 604 | 601 | * |
| 605 | 602 | * @return void |
| @@ -613,9 +610,9 @@ | ||
| 613 | 610 | $count = count( $options ); |
| 614 | 611 | foreach ( $options as $info ) { |
| 615 | 612 | // Count the number of options displayed for css. |
| 616 | 613 | if ( $count > 1 && ! isset( $info['img'] ) ) { |
| 617 | - --$count; | |
| 614 | + $count --; | |
| 618 | 615 | } |
| 619 | 616 | } |
| 620 | 617 | $width = floor( ( 533 - ( ( $count - 1 ) * 20 ) ) / $count ); |
| 621 | 618 | unset( $count ); |
| @@ -621,9 +618,9 @@ | ||
| 621 | 618 | unset( $count ); |
| 622 | 619 | |
| 623 | 620 | $selected = false; |
| 624 | 621 | |
| 625 | - include FrmAppHelper::plugin_path() . '/classes/views/solutions/_import.php'; | |
| 622 | + include( FrmAppHelper::plugin_path() . '/classes/views/solutions/_import.php' ); | |
| 626 | 623 | } |
| 627 | 624 | |
| 628 | 625 | /** |
| 629 | 626 | * @return void |
| @@ -671,9 +668,9 @@ | ||
| 671 | 668 | * |
| 672 | 669 | * @return bool |
| 673 | 670 | */ |
| 674 | 671 | protected function is_current_plugin() { |
| 675 | - $to_redirect = get_transient( FrmOnboardingWizardController::TRANSIENT_NAME ); | |
| 672 | + $to_redirect = get_transient( 'frm_activation_redirect' ); | |
| 676 | 673 | return $to_redirect === $this->plugin_slug && empty( $this->is_complete() ); |
| 677 | 674 | } |
| 678 | 675 | |
| 679 | 676 | /** |
| @@ -784,8 +781,10 @@ | ||
| 784 | 781 | wp_enqueue_style( 'formidable-pro-fields' ); |
| 785 | 782 | ?> |
| 786 | 783 | <style> |
| 787 | 784 | #frm-welcome *, #frm-welcome *::before, #frm-welcome *::after { |
| 785 | + -webkit-box-sizing: border-box; | |
| 786 | + -moz-box-sizing: border-box; | |
| 788 | 787 | box-sizing: border-box; |
| 789 | 788 | } |
| 790 | 789 | #frm-welcome{ |
| 791 | 790 | width: 700px; |
| @@ -844,8 +843,10 @@ | ||
| 844 | 843 | border-radius: 3px; |
| 845 | 844 | } |
| 846 | 845 | #frm-welcome .step, |
| 847 | 846 | #frm-welcome .screenshot .cont { |
| 847 | + -webkit-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.05); | |
| 848 | + -moz-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.05); | |
| 848 | 849 | box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.05); |
| 849 | 850 | } |
| 850 | 851 | #frm-welcome .step { |
| 851 | 852 | background-color: #F9F9F9; |
| @@ -888,5 +889,6 @@ | ||
| 888 | 889 | } |
| 889 | 890 | </style> |
| 890 | 891 | <?php |
| 891 | 892 | } |
| 893 | + | |
| 892 | 894 | } |