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