PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.34
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.34
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 6.5.4 All 140 releases
formidable / classes / models / FrmSolution.php

FrmSolution.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.34, at classes/models/FrmSolution.php

969 lines 22.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Handles the installation of a solution and any dependencies.
4 * This page is shown when a Formidable plugin is activated.
5 *
6 * @since 4.06.02
7 *
8 * @package Formidable
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 die( 'You are not allowed to call this page directly.' );
13 }
14
15 class FrmSolution {
16
17 /**
18 * @var string
19 */
20 protected $plugin_slug = '';
21
22 /**
23 * @var string
24 */
25 protected $plugin_file = '';
26
27 /**
28 * Hidden welcome page slug.
29 *
30 * @since 4.06.02
31 *
32 * @var string
33 */
34 protected $page = '';
35
36 /**
37 * @var string
38 */
39 protected $icon = 'frmfont frm_settings_icon';
40
41 /**
42 * @param array $atts
43 */
44 public function __construct( $atts = array() ) {
45 if ( ! $this->plugin_slug ) {
46 return;
47 }
48
49 add_action( 'plugins_loaded', array( $this, 'load_hooks' ), 50 );
50 add_action( 'admin_init', array( $this, 'redirect' ), 9999 );
51
52 if ( ! $this->plugin_file ) {
53 $this->plugin_file = $this->plugin_slug . '.php';
54 }
55 }
56
57 /**
58 * Register all WP hooks.
59 *
60 * @since 4.06.02
61 *
62 * @return void
63 */
64 public function load_hooks() {
65 // If user is in admin ajax or doing cron, return.
66 if ( wp_doing_cron() ) {
67 return;
68 }
69
70 add_filter( 'frm_add_settings_section', array( $this, 'add_settings' ) );
71
72 if ( wp_doing_ajax() ) {
73 return;
74 }
75
76 // If user cannot manage_options, return.
77 if ( ! current_user_can( 'frm_change_settings' ) && ! FrmAppHelper::is_formidable_admin() ) {
78 return;
79 }
80
81 add_filter( 'plugin_action_links_' . $this->plugin_slug . '/' . $this->plugin_file, array( $this, 'plugin_links' ) );
82 add_action( 'admin_menu', array( $this, 'register' ) );
83 add_action( 'admin_head', array( $this, 'hide_menu' ) );
84 }
85
86 /**
87 * @param array $links
88 *
89 * @return array
90 */
91 public function plugin_links( $links ) {
92 if ( ! $this->is_complete() ) {
93 $settings = '<a href="' . esc_url( $this->settings_link() ) . '">' . esc_html__( 'Setup', 'formidable' ) . '</a>';
94 array_unshift( $links, $settings );
95 }
96
97 return $links;
98 }
99
100 /**
101 * Register the pages to be used for the Welcome screen (and tabs).
102 *
103 * These pages will be removed from the Dashboard menu, so they will
104 * not actually show. Sneaky, sneaky.
105 *
106 * @since 4.06.02
107 *
108 * @return void
109 */
110 public function register() {
111 // Getting started - shows after installation.
112 add_dashboard_page(
113 esc_html( $this->page_title() ),
114 esc_html( $this->page_title() ),
115 'frm_change_settings',
116 $this->page,
117 array( $this, 'output' )
118 );
119 }
120
121 /**
122 * Removed the dashboard pages from the admin menu.
123 *
124 * This means the pages are still available to us, but hidden.
125 *
126 * @since 4.06.02
127 *
128 * @return void
129 */
130 public function hide_menu() {
131 remove_submenu_page( 'index.php', $this->page );
132 }
133
134 /**
135 * @return string
136 *
137 * @psalm-return ''
138 */
139 protected function plugin_name() {
140 return '';
141 }
142
143 /**
144 * @return string
145 */
146 protected function page_title() {
147 return __( 'Welcome to Formidable Forms', 'formidable' );
148 }
149
150 /**
151 * @return string
152 */
153 protected function page_description() {
154 return __( 'Follow the steps below to get started.', 'formidable' );
155 }
156
157 /**
158 * Welcome screen redirect.
159 *
160 * This function checks if a new install or update has just occurred. If so,
161 * then we redirect the user to the appropriate page.
162 *
163 * @since 4.06.02
164 *
165 * @return void
166 */
167 public function redirect() {
168 $current_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
169
170 if ( $current_page === $this->page ) {
171 // Prevent endless loop.
172 return;
173 }
174
175 // Only do this for single site installs.
176 if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
177 return;
178 }
179
180 // Check if we should consider redirection.
181 if ( ! $this->is_current_plugin() ) {
182 return;
183 }
184
185 delete_transient( FrmOnboardingWizardController::TRANSIENT_NAME );
186
187 // Initial install.
188 wp_safe_redirect( $this->settings_link() );
189 exit;
190 }
191
192 /**
193 * @return string
194 */
195 protected function settings_link() {
196 return admin_url( 'index.php?page=' . $this->page );
197 }
198
199 /**
200 * Add page to global settings.
201 *
202 * @param array $sections Sections.
203 *
204 * @return array
205 */
206 public function add_settings( $sections ) {
207 wp_enqueue_style( 'formidable-pro-fields' );
208 $sections[ $this->plugin_slug ] = array(
209 'class' => $this,
210 'function' => 'settings_page',
211 'name' => $this->plugin_name(),
212 'icon' => $this->icon,
213 'ajax' => true,
214 );
215 return $sections;
216 }
217
218 /*
219 * Output for global settings.
220 */
221 /**
222 * @return void
223 */
224 public function settings_page() {
225 $steps = $this->get_steps_data();
226
227 if ( ! $steps['license']['complete'] || ( isset( $steps['plugin'] ) && ! $steps['plugin']['complete'] ) ) {
228 // Redirect to the welcome page if install hasn't been done.
229 $url = $this->settings_link();
230 echo '<script>window.location.replace("' . esc_url_raw( $url ) . '");</script>';
231 return;
232 }
233
234 $all_imported = $this->is_complete( 'all' );
235 $step = $steps['import'];
236 $step['label'] = '';
237 $step['nested'] = true;
238
239 if ( $steps['complete']['current'] ) {
240 // Always show this step in settings.
241 $step['current'] = true;
242
243 $new_class = $all_imported ? ' button frm_hidden' : '';
244 $step['button_class'] = str_replace( 'frm_grey disabled', $new_class, $step['button_class'] );
245 }
246
247 if ( $all_imported ) {
248 $step['description'] = __( 'The following form(s) have been created.', 'formidable' );
249 }
250
251 $this->show_app_install( $step );
252
253 if ( $all_imported ) {
254 return;
255 }
256
257 $step = $steps['complete'];
258 $step['current'] = false;
259 $step['button_class'] .= ' frm_grey disabled';
260
261 $this->show_page_links( $step );
262 }
263
264 /**
265 * Getting Started screen. Shows after first install.
266 *
267 * @return void
268 */
269 public function output() {
270 FrmAppHelper::include_svg();
271 $this->css();
272 $class = FrmAppHelper::pro_is_installed() ? 'pro' : 'lite';
273
274 echo '<div id="frm-welcome" class="wrap frm-wrap frm-admin-plugin-landing upgrade_to_pro ' . sanitize_html_class( $class ) . '">';
275
276 $this->header();
277 $this->main_content();
278
279 echo '</div>';
280 }
281
282 /**
283 * Heading section.
284 *
285 * @return void
286 */
287 protected function header() {
288 $size = array(
289 'height' => 90,
290 'width' => 90,
291 );
292
293 // phpcs:disable Generic.WhiteSpace.ScopeIndent
294 ?>
295 <section class="top">
296 <div class="frm-smtp-logos">
297 <?php FrmAppHelper::show_logo( $size ); ?>
298 <?php
299 FrmAppHelper::icon_by_class(
300 'frmfont frm_arrow_right_icon',
301 array(
302 'aria-label' => 'Install',
303 'style' => 'width:30px;height:30px;margin:0 35px;',
304 )
305 );
306 FrmAppHelper::icon_by_class(
307 'frmfont frm_wordpress_icon',
308 array(
309 'aria-label' => 'WordPress',
310 'style' => 'width:90px;height:90px;',
311 )
312 );
313 ?>
314 </div>
315 <h1><?php echo esc_html( $this->page_title() ); ?></h1>
316 <p><?php echo esc_html( $this->page_description() ); ?></p>
317 </section>
318 <?php
319 // phpcs:enable Generic.WhiteSpace.ScopeIndent
320 }
321
322 /**
323 * This is the welcome page content.
324 * Override me to insert different content.
325 *
326 * @return void
327 */
328 protected function main_content() {
329 $steps = $this->get_steps_data();
330 $this->license_box( $steps['license'] );
331
332 if ( isset( $steps['plugin'] ) ) {
333 $this->show_plugin_install( $steps['plugin'] );
334 }
335 $this->show_app_install( $steps['import'] );
336 $this->show_page_links( $steps['complete'] );
337 }
338
339 /**
340 * @return array
341 */
342 protected function get_steps_data() {
343 $pro_installed = FrmAppHelper::pro_is_connected();
344
345 $steps = array(
346 'license' => array(
347 'label' => __( 'Connect to FormidableForms.com', 'formidable' ),
348 'description' => __( 'Create a connection to get plugin downloads.', 'formidable' ),
349 'button_label' => __( 'Connect an Account', 'formidable' ),
350 'current' => ! $pro_installed,
351 'complete' => $pro_installed,
352 'num' => 1,
353 ),
354 'plugin' => array(
355 'label' => __( 'Install and Activate Add-Ons', 'formidable' ),
356 'description' => __( 'Install any required add-ons from FormidableForms.com.', 'formidable' ),
357 'button_label' => __( 'Install & Activate', 'formidable' ),
358 'current' => false,
359 'complete' => false,
360 'num' => 2,
361 ),
362 'import' => array(
363 'label' => __( 'Setup Forms, Views, and Pages', 'formidable' ),
364 'description' => __( 'Build the forms, views, and pages automatically.', 'formidable' ),
365 'button_label' => __( 'Create Now', 'formidable' ),
366 'complete' => $this->is_complete(),
367 'num' => 3,
368 ),
369 'complete' => array(
370 'label' => __( 'Customize Your New Pages', 'formidable' ),
371 'description' => __( 'Make any required changes and publish the page.', 'formidable' ),
372 'button_label' => __( 'View Page', 'formidable' ),
373 'complete' => false,
374 'num' => 4,
375 ),
376 );
377
378 $this->adjust_plugin_install_step( $steps );
379
380 $has_current = false;
381
382 foreach ( $steps as $k => $step ) {
383 // Set the current step.
384 if ( ! isset( $step['current'] ) ) {
385 if ( $step['complete'] ) {
386 $steps[ $k ]['current'] = false;
387 } else {
388 $steps[ $k ]['current'] = ! $has_current;
389 $has_current = true;
390 }
391 } elseif ( $step['current'] ) {
392 $has_current = true;
393 }
394
395 // Set disabled buttons.
396 $class = $step['button_class'] ?? '';
397 $class .= ' button-primary frm-button-primary';
398
399 if ( ! $steps[ $k ]['current'] ) {
400 $class .= ' frm_grey disabled';
401 }
402 $steps[ $k ]['button_class'] = $class;
403 }//end foreach
404
405 return $steps;
406 }
407
408 /**
409 * @param array $steps
410 *
411 * @return void
412 */
413 protected function adjust_plugin_install_step( &$steps ) {
414 $plugins = $this->required_plugins();
415
416 if ( ! $plugins ) {
417 unset( $steps['plugin'] );
418 $steps['import']['num'] = 2;
419 $steps['complete']['num'] = 3;
420 return;
421 }
422
423 $missing = array();
424 $rel = array();
425
426 foreach ( $plugins as $plugin_key ) {
427 $plugin = FrmAddonsController::install_link( $plugin_key );
428
429 if ( $plugin['status'] === 'active' ) {
430 continue;
431 }
432
433 if ( isset( $plugin['url'] ) ) {
434 $rel[] = $plugin['url'];
435 } else {
436 // Add-on is required but not allowed.
437 $missing[] = $plugin_key;
438 }
439 }
440
441 if ( ! $rel && ! $missing ) {
442 $steps['plugin']['complete'] = true;
443 } elseif ( $missing ) {
444 $steps['plugin']['error'] = sprintf(
445 /* translators: %1$s: Plugin name */
446 esc_html__( 'You need permission to download the Formidable %1$s plugin', 'formidable' ),
447 implode( ', ', $missing )
448 );
449 } else {
450 $steps['plugin']['links'] = $rel;
451 $steps['plugin']['button_class'] = 'frm-solution-multiple ';
452 }
453
454 if ( $steps['license']['complete'] && ! $steps['plugin']['complete'] ) {
455 $steps['plugin']['current'] = true;
456 }
457 }
458
459 /**
460 * @param array $step Step.
461 *
462 * @return void
463 */
464 protected function step_top( $step ) {
465 $section_class = ! empty( $step['current'] ) ? '' : 'frm_grey';
466
467 // phpcs:disable Generic.WhiteSpace.ScopeIndent
468 ?>
469 <section class="step step-install <?php echo esc_attr( $section_class ); ?>">
470 <aside class="num">
471 <?php
472 if ( ! empty( $step['complete'] ) ) {
473 FrmAppHelper::icon_by_class(
474 'frmfont frm_step_complete_icon',
475 array(
476 /* translators: %1$s: Step number */
477 'aria-label' => sprintf( __( 'Step %1$d', 'formidable' ), $step['num'] ),
478 'style' => 'width:50px;height:50px;',
479 )
480 );
481 } else {
482 ?>
483 <svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 100 100"><circle cx="50" cy="50" r="50" fill="#ccc"/><text x="50%" y="50%" text-anchor="middle" fill="#fff" stroke="#fff" stroke-width="2px" dy=".3em" font-size="3.7em"><?php echo esc_html( $step['num'] ); ?></text></svg><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?>
484 <?php
485 }
486 ?>
487 <i class="loader hidden"></i>
488 </aside>
489 <div>
490 <?php if ( $step['label'] ) { ?>
491 <h3 class="frm-step-heading"><?php echo esc_html( $step['label'] ); ?></h3>
492 <?php } ?>
493 <p><?php echo esc_html( $step['description'] ); ?></p>
494 <?php if ( isset( $step['error'] ) ) { ?>
495 <p class="frm_error"><?php echo esc_html( $step['error'] ); ?></p>
496 <?php } ?>
497 <?php
498 // phpcs:enable Generic.WhiteSpace.ScopeIndent
499 }
500
501 /**
502 * @param array $step Step.
503 *
504 * @return void
505 */
506 protected function step_bottom( $step ) {
507 // phpcs:disable Generic.WhiteSpace.ScopeIndent
508 ?>
509 </div>
510 </section>
511 <?php
512 // phpcs:enable Generic.WhiteSpace.ScopeIndent
513 }
514
515 /**
516 * Generate and output Connect step section HTML.
517 *
518 * @param array $step Step.
519 *
520 * @return void
521 */
522 protected function license_box( $step ) {
523 $this->step_top( $step );
524
525 if ( $step['complete'] ) {
526 // phpcs:disable Generic.WhiteSpace.ScopeIndent
527 ?>
528 <a href="#" class="<?php echo esc_attr( $step['button_class'] ); ?>">
529 <?php echo esc_html( $step['button_label'] ); ?>
530 </a>
531 <?php
532 // phpcs:enable Generic.WhiteSpace.ScopeIndent
533 } else {
534 FrmSettingsController::license_box();
535 }
536
537 $this->step_bottom( $step );
538 }
539
540 /**
541 * @param array $step Step.
542 *
543 * @return void
544 */
545 protected function show_plugin_install( $step ) {
546 $this->step_top( $step );
547
548 if ( ! isset( $step['error'] ) ) {
549 $rel = $step['links'] ?? array();
550
551 // phpcs:disable Generic.WhiteSpace.ScopeIndent
552 ?>
553 <a rel="<?php echo esc_attr( implode( ',', $rel ) ); ?>" class="<?php echo esc_attr( $step['button_class'] ); ?>">
554 <?php echo esc_html( $step['button_label'] ); ?>
555 </a>
556 <?php
557 // phpcs:enable Generic.WhiteSpace.ScopeIndent
558 }
559
560 $this->step_bottom( $step );
561 }
562
563 /**
564 * @param array $step Step.
565 *
566 * @return void
567 */
568 protected function show_app_install( $step ) {
569 $is_complete = $step['complete'];
570
571 if ( $this->form_options() && ! $is_complete ) {
572 $step['description'] = __( 'Select the form or view you would like to create.', 'formidable' );
573 }
574
575 $this->step_top( $step );
576
577 $api = new FrmFormApi();
578 $addons = $api->get_api_info();
579 $id = $this->download_id();
580 $has_file = isset( $addons[ $id ] ) && isset( $addons[ $id ]['beta'] );
581
582 // phpcs:disable Generic.WhiteSpace.ScopeIndent
583 if ( ! $step['current'] ) {
584 ?>
585 <a href="#" class="<?php echo esc_attr( $step['button_class'] ); ?>">
586 <?php echo esc_html( $step['button_label'] ); ?>
587 </a>
588 <?php
589
590 $this->step_bottom( $step );
591 return;
592 }
593
594 if ( ! $has_file ) {
595 echo '<p class="frm_error_style">' . esc_html__( 'We didn\'t find anything to import. Please contact our team.', 'formidable' ) . '</p>';
596 } elseif ( ! isset( $addons[ $id ]['beta']['package'] ) ) {
597 echo '<p class="frm_error_style">' . esc_html__( 'Looks like you may not have a current subscription for this solution. Please check your account.', 'formidable' ) . '</p>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
598 } else {
599 $xml = $addons[ $id ]['beta']['package'];
600
601 if ( is_array( $xml ) ) {
602 $xml = reset( $xml );
603 }
604
605 if ( isset( $step['nested'] ) ) {
606 echo '<fieldset id="frm-new-template" class="field-group">';
607 } else {
608 echo '<form name="frm-new-template" id="frm-new-template" method="post" class="field-group">';
609 }
610
611 ?>
612 <input type="hidden" name="link" id="frm_link" value="<?php echo esc_attr( $xml ); ?>" />
613 <input type="hidden" name="type" id="frm_action_type" value="frm_install_template" />
614 <input type="hidden" name="template_name" id="frm_template_name" value="" />
615 <input type="hidden" name="template_desc" id="frm_template_desc" value="" />
616 <input type="hidden" name="redirect" value="0" />
617 <input type="hidden" name="show_response" value="frm_install_error" />
618 <?php
619 $this->show_form_options( $xml );
620 $this->show_view_options();
621
622 if ( ! $this->is_complete( 'all' ) ) {
623 // Don't show on the settings page when complete.
624 $this->show_page_options();
625 }
626 ?>
627 <p>
628 <button <?php echo esc_html( isset( $step['nested'] ) ? '' : 'type="submit" ' ); ?>class="<?php echo esc_attr( $step['button_class'] ); ?>">
629 <?php echo esc_html( $step['button_label'] ); ?>
630 </button>
631 </p>
632 <p id="frm_install_error" class="frm_error_style frm_hidden"></p>
633 <?php
634 if ( isset( $step['nested'] ) ) {
635 echo '</fieldset>';
636 } else {
637 echo '</form>';
638 }
639 }//end if
640 // phpcs:enable Generic.WhiteSpace.ScopeIndent
641
642 $this->step_bottom( $step );
643 }
644
645 /**
646 * @param string $xml
647 *
648 * @return void
649 */
650 protected function show_form_options( $xml ) {
651 $this->show_import_options( $this->form_options(), 'form', $xml );
652 }
653
654 /**
655 * @return void
656 */
657 protected function show_view_options() {
658 $this->show_import_options( $this->view_options(), 'view' );
659 }
660
661 /**
662 * @param array $options
663 * @param string $importing
664 * @param string $xml
665 *
666 * @psalm-param 'form'|'view' $importing
667 *
668 * @return void
669 */
670 protected function show_import_options( $options, $importing, $xml = '' ) {
671 if ( ! $options ) {
672 return;
673 }
674
675 $imported = $this->previously_imported_forms();
676 $count = count( $options );
677
678 foreach ( $options as $info ) {
679 // Count the number of options displayed for css.
680 if ( $count > 1 && ! isset( $info['img'] ) ) {
681 --$count;
682 }
683 }
684
685 $width = floor( ( 533 - ( ( $count - 1 ) * 20 ) ) / $count );
686 unset( $count );
687
688 $selected = false;
689
690 include FrmAppHelper::plugin_path() . '/classes/views/solutions/_import.php';
691 }
692
693 /**
694 * @return void
695 */
696 protected function show_page_options() {
697 $pages = $this->needed_pages();
698
699 if ( ! $pages ) {
700 return;
701 }
702
703 echo '<h3>Choose New Page Title</h3>';
704
705 foreach ( $pages as $page ) {
706 // phpcs:disable Generic.WhiteSpace.ScopeIndent
707 ?>
708 <p>
709 <label for="pages_<?php echo esc_html( $page['type'] ); ?>">
710 <?php echo esc_html( $page['label'] ); ?>
711 </label>
712 <input type="text" name="pages[<?php echo esc_html( $page['type'] ); ?>]" value="<?php echo esc_attr( $page['name'] ); ?>" id="pages_<?php echo esc_html( $page['type'] ); ?>" required /><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?>
713 </p>
714 <?php
715 // phpcs:enable Generic.WhiteSpace.ScopeIndent
716 }
717 }
718
719 /**
720 * @param array $step
721 *
722 * @return void
723 */
724 protected function show_page_links( $step ) {
725 if ( $step['current'] ) {
726 return;
727 }
728
729 $this->step_top( $step );
730
731 // phpcs:disable Generic.WhiteSpace.ScopeIndent
732 ?>
733 <a href="#" target="_blank" rel="noopener" id="frm-redirect-link" class="<?php echo esc_attr( $step['button_class'] ); ?>">
734 <?php echo esc_html( $step['button_label'] ); ?>
735 </a>
736 <?php
737 // phpcs:enable Generic.WhiteSpace.ScopeIndent
738
739 $this->step_bottom( $step );
740 }
741
742 /**
743 * Only show the content for the correct plugin.
744 *
745 * @return bool
746 */
747 protected function is_current_plugin() {
748 $to_redirect = get_transient( FrmOnboardingWizardController::TRANSIENT_NAME );
749 return $to_redirect === $this->plugin_slug && ! $this->is_complete();
750 }
751
752 /**
753 * Override this function to indicate when install is complete.
754 *
755 * @param int|string $count
756 *
757 * @psalm-param 'all'|1 $count
758 *
759 * @return bool
760 */
761 protected function is_complete( $count = 1 ) {
762 $imported = $this->previously_imported_forms();
763
764 if ( $count === 'all' ) {
765 return count( $imported ) >= count( $this->form_options() );
766 }
767
768 return ! empty( $imported );
769 }
770
771 /**
772 * Get an array of all of the forms that have been imported.
773 *
774 * @return array
775 */
776 protected function previously_imported_forms() {
777 $imported = array();
778
779 foreach ( $this->form_options() as $form ) {
780 $was_imported = isset( $form['form'] ) ? FrmForm::get_id_by_key( $form['form'] ) : false;
781
782 if ( $was_imported ) {
783 $imported[ $form['form'] ] = $was_imported;
784 }
785 }
786
787 return $imported;
788 }
789
790 /**
791 * In the new plugin has any dependencies, include them here.
792 *
793 * @return array
794 */
795 protected function required_plugins() {
796 return array();
797 }
798
799 /**
800 * This needs to be overridden.
801 *
802 * @return int
803 */
804 protected function download_id() {
805 return 0;
806 }
807
808 /**
809 * Give options for which forms to import.
810 *
811 * @return array
812 */
813 protected function form_options() {
814 /**
815 * Example:
816 * array(
817 * 'unique-key' => array(
818 * 'keys' => 'forms keys here',
819 * 'name' => 'displayed label here',
820 * 'img' => 'svg code',
821 * ),
822 * )
823 */
824 return array();
825 }
826
827 /**
828 * Give options for which view to use.
829 *
830 * @return array
831 */
832 protected function view_options() {
833 return array();
834 }
835
836 /**
837 * If the pages aren't imported automatically, set the page names.
838 *
839 * @return array
840 */
841 protected function needed_pages() {
842 /**
843 * Example:
844 * array(
845 * array(
846 * 'label' => 'Page Name',
847 * 'name' => 'Default name',
848 * 'type' => 'form' or 'view',
849 * ),
850 * )
851 */
852
853 return array();
854 }
855
856 /**
857 * @return void
858 */
859 private function css() {
860 wp_enqueue_style( 'formidable-pro-fields' );
861 ?>
862 <style>
863 #frm-welcome *, #frm-welcome *::before, #frm-welcome *::after {
864 box-sizing: border-box;
865 }
866 #frm-welcome{
867 width: 700px;
868 margin: 0 auto;
869 }
870 #frm-welcome p {
871 font-size: 15px;
872 }
873 #frm-welcome section{
874 margin: 50px 0;
875 text-align: left;
876 clear: both;
877 }
878 #frm-welcome .top{
879 text-align: center;
880 }
881 .frm-smtp-logos {
882 margin-bottom: 38px;
883 }
884 .frm-smtp-logos svg {
885 vertical-align: middle;
886 }
887 #frm-welcome .top h1 {
888 font-size: 26px;
889 font-weight: 600;
890 margin-bottom: 0;
891 padding: 0;
892 }
893 #frm-welcome .top p {
894 font-size: 17px;
895 color: #777;
896 margin-top: .5em;
897 }
898 #frm-welcome .screenshot ul {
899 display: inline-block;
900 margin: 0 0 0 30px;
901 list-style-type: none;
902 max-width: calc(100% - 350px);
903 }
904 #frm-welcome .screenshot li {
905 margin: 16px 0;
906 padding: 0;
907 font-size: 15px;
908 color: #777;
909 }
910 #frm-welcome .screenshot .cont img {
911 max-width: 100%;
912 display: block;
913 }
914 #frm-welcome .screenshot .cont {
915 display: inline-block;
916 position: relative;
917 width: 315px;
918 padding: 5px;
919 background-color: #fff;
920 border-radius: 3px;
921 }
922 #frm-welcome .step,
923 #frm-welcome .screenshot .cont {
924 box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.05);
925 }
926 #frm-welcome .step {
927 background-color: #F9F9F9;
928 border: 1px solid #E5E5E5;
929 margin: 0 0 25px;
930 }
931 #frm-welcome .screenshot > *,
932 #frm-welcome .step > * {
933 vertical-align: middle;
934 }
935 #frm-welcome .step p {
936 font-size: 16px;
937 color: #777777;
938 }
939 #frm-welcome .step .num {
940 display: inline-block;
941 position: relative;
942 width: 100px;
943 height: 50px;
944 text-align: center;
945 }
946 #frm-welcome .step > div {
947 display: inline-block;
948 width: calc(100% - 104px);
949 background-color: #fff;
950 padding: 30px;
951 border-left: 1px solid #eee;
952 }
953 #frm-welcome .step h3.frm-step-heading {
954 font-size: 24px;
955 line-height: 22px;
956 margin-top: 0;
957 margin-bottom: 15px;
958 }
959 #frm-welcome .button.disabled {
960 cursor: default;
961 }
962 #frm-welcome #frm-using-lite {
963 display: none;
964 }
965 </style>
966 <?php
967 }
968 }
969