PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0
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
← All changes | classes/controllers/FrmAppController.php +69 -410 6.35.0 View file →
@@ -4,11 +4,8 @@
4 4 }
5 5
6 6 class FrmAppController {
7 7
8 - /**
9 - * @return void
10 - */
11 8 public static function menu() {
12 9 FrmAppHelper::maybe_add_permissions();
13 10 if ( ! current_user_can( 'frm_view_forms' ) ) {
14 11 return;
@@ -17,13 +14,10 @@
17 14 $menu_name = FrmAppHelper::get_menu_name();
18 15 add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', self::menu_icon(), self::get_menu_position() );
19 16 }
20 17
21 - /**
22 - * @return int
23 - */
24 18 private static function get_menu_position() {
25 - return (int) apply_filters( 'frm_menu_position', 29 );
19 + return apply_filters( 'frm_menu_position', '29.3' );
26 20 }
27 21
28 22 /**
29 23 * @since 3.05
@@ -62,47 +56,16 @@
62 56 }
63 57 }
64 58
65 59 if ( FrmAppHelper::is_full_screen() ) {
66 - $full_screen_on = self::get_full_screen_setting();
67 - $add_class = '';
68 - if ( $full_screen_on ) {
69 - $add_class = ' frm-full-screen is-fullscreen-mode';
70 - wp_enqueue_style( 'wp-edit-post' ); // Load the CSS for .is-fullscreen-mode.
71 - }
72 - $classes .= apply_filters( 'frm_admin_full_screen_class', $add_class );
60 + $classes .= apply_filters( 'frm_admin_full_screen_class', ' frm-full-screen folded' );
73 61 }
74 62
75 - if ( ! FrmAppHelper::pro_is_installed() ) {
76 - $classes .= ' frm-lite ';
77 - }
78 -
79 63 return $classes;
80 64 }
81 65
82 66 /**
83 - * Get the full screen mode setting from the block editor.
84 - *
85 - * @since 6.1
86 - *
87 - * @return bool
88 - */
89 - private static function get_full_screen_setting() {
90 - global $wpdb;
91 - $meta_key = $wpdb->get_blog_prefix() . 'persisted_preferences';
92 -
93 - $prefs = get_user_meta( get_current_user_id(), $meta_key, true );
94 - if ( $prefs && isset( $prefs['core/edit-post']['fullscreenMode'] ) ) {
95 - return $prefs['core/edit-post']['fullscreenMode'];
96 - }
97 -
98 - return true;
99 - }
100 -
101 - /**
102 67 * @since 4.0
103 - *
104 - * @return string
105 68 */
106 69 private static function get_os() {
107 70 $agent = strtolower( FrmAppHelper::get_server_value( 'HTTP_USER_AGENT' ) );
108 71 $os = '';
@@ -123,9 +86,8 @@
123 86 $white_pages = array(
124 87 'formidable',
125 88 'formidable-entries',
126 89 'formidable-views',
127 - 'formidable-views-editor',
128 90 'formidable-pro-upgrade',
129 91 'formidable-addons',
130 92 'formidable-import',
131 93 'formidable-settings',
@@ -132,13 +94,12 @@
132 94 'formidable-styles',
133 95 'formidable-styles2',
134 96 'formidable-inbox',
135 97 'formidable-welcome',
136 - 'formidable-applications',
137 98 );
138 99
139 100 $get_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
140 - $is_white_page = in_array( $get_page, $white_pages, true );
101 + $is_white_page = in_array( $get_page, $white_pages );
141 102
142 103 if ( ! $is_white_page ) {
143 104 $screen = get_current_screen();
144 105 $is_white_page = ( $screen && strpos( $screen->id, 'frm_display' ) !== false );
@@ -143,35 +104,15 @@
143 104 $screen = get_current_screen();
144 105 $is_white_page = ( $screen && strpos( $screen->id, 'frm_display' ) !== false );
145 106 }
146 107
147 - /**
148 - * Allow another add on to style a page as a Formidable "white page", which adds a white background color.
149 - *
150 - * @since 5.3
151 - *
152 - * @param bool $is_white_page
153 - */
154 - $is_white_page = apply_filters( 'frm_is_white_page', $is_white_page );
155 -
156 108 return $is_white_page;
157 109 }
158 110
159 - /**
160 - * @return void
161 - */
162 111 public static function load_wp_admin_style() {
163 112 FrmAppHelper::load_font_style();
164 113 }
165 114
166 - /**
167 - * @param bool $show_nav
168 - * @param string $title
169 - *
170 - * @psalm-param 'hide'|'show' $title
171 - *
172 - * @return void
173 - */
174 115 public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
175 116 $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
176 117 if ( empty( $show_nav ) || ! $form ) {
177 118 return;
@@ -188,11 +129,8 @@
188 129
189 130 include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
190 131 }
191 132
192 - /**
193 - * @return string
194 - */
195 133 private static function get_current_page() {
196 134 $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
197 135 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
198 136 $current_page = isset( $_GET['page'] ) ? $page : $post_type;
@@ -203,12 +141,8 @@
203 141
204 142 return $current_page;
205 143 }
206 144
207 - /**
208 - * @param object $form
209 - * @return array
210 - */
211 145 private static function get_form_nav_items( $form ) {
212 146 $id = $form->parent_form_id ? $form->parent_form_id : $form->id;
213 147
214 148 $nav_items = array(
@@ -219,15 +153,8 @@
219 153 'page' => 'formidable',
220 154 'permission' => 'frm_edit_forms',
221 155 ),
222 156 array(
223 - 'link' => FrmStylesHelper::get_list_url( $id ),
224 - 'label' => __( 'Style', 'formidable' ),
225 - 'current' => array(),
226 - 'page' => 'formidable-styles',
227 - 'permission' => 'frm_edit_forms',
228 - ),
229 - array(
230 157 'link' => admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . absint( $id ) ),
231 158 'label' => __( 'Settings', 'formidable' ),
232 159 'current' => array( 'settings' ),
233 160 'page' => 'formidable',
@@ -233,9 +160,9 @@
233 160 'page' => 'formidable',
234 161 'permission' => 'frm_edit_forms',
235 162 ),
236 163 array(
237 - 'link' => admin_url( 'admin.php?page=formidable-entries&frm_action=list&form=' . absint( $id ) ),
164 + 'link' => admin_url( 'admin.php?page=formidable-entries&frm-full=1&frm_action=list&form=' . absint( $id ) ),
238 165 'label' => __( 'Entries', 'formidable' ),
239 166 'current' => array(),
240 167 'page' => 'formidable-entries',
241 168 'permission' => 'frm_view_entries',
@@ -245,9 +172,9 @@
245 172 $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) ? FrmProAppHelper::views_is_installed() : FrmAppHelper::pro_is_installed();
246 173
247 174 if ( ! $views_installed ) {
248 175 $nav_items[] = array(
249 - 'link' => admin_url( 'admin.php?page=formidable-views&form=' . absint( $id ) ),
176 + 'link' => admin_url( 'admin.php?page=formidable-views&frm-full=1&form=' . absint( $id ) ),
250 177 'label' => __( 'Views', 'formidable' ),
251 178 'current' => array(),
252 179 'page' => 'formidable-views',
253 180 'permission' => 'frm_view_entries',
@@ -259,9 +186,9 @@
259 186
260 187 // Let people know reports and views exist.
261 188 if ( ! FrmAppHelper::pro_is_installed() ) {
262 189 $nav_items[] = array(
263 - 'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&form=' . absint( $id ) ),
190 + 'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&frm-full=1&form=' . absint( $id ) ),
264 191 'label' => __( 'Reports', 'formidable' ),
265 192 'current' => array( 'reports' ),
266 193 'page' => 'formidable',
267 194 'permission' => 'frm_view_entries',
@@ -275,15 +202,12 @@
275 202 'form_id' => $id,
276 203 'form' => $form,
277 204 );
278 205
279 - return (array) apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
206 + return apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
280 207 }
281 208
282 209 // Adds a settings link to the plugins page
283 - /**
284 - * @return array
285 - */
286 210 public static function settings_link( $links ) {
287 211 $settings = array();
288 212
289 213 if ( ! FrmAppHelper::pro_is_installed() ) {
@@ -294,11 +218,8 @@
294 218
295 219 return array_merge( $settings, $links );
296 220 }
297 221
298 - /**
299 - * @return void
300 - */
301 222 public static function pro_get_started_headline() {
302 223 self::review_request();
303 224 FrmAppHelper::min_pro_version_notice( '4.0' );
304 225 }
@@ -306,10 +227,8 @@
306 227 /**
307 228 * Add admin notices as needed for reviews
308 229 *
309 230 * @since 3.04.03
310 - *
311 - * @return void
312 231 */
313 232 private static function review_request() {
314 233 $reviews = new FrmReviews();
315 234 $reviews->review_request();
@@ -318,10 +237,8 @@
318 237 /**
319 238 * Save the request to hide the review
320 239 *
321 240 * @since 3.04.03
322 - *
323 - * @return void
324 241 */
325 242 public static function dismiss_review() {
326 243 FrmAppHelper::permission_check( 'frm_change_settings' );
327 244 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -331,32 +248,18 @@
331 248 }
332 249
333 250 /**
334 251 * @since 3.04.02
335 - *
336 - * @return void
337 252 */
338 253 public static function include_upgrade_overlay() {
339 - self::enqueue_dialog_assets();
340 - add_action( 'admin_footer', 'FrmAppController::upgrade_overlay_html' );
341 - }
342 -
343 - /**
344 - * Enqueue scripts and styles required for modals.
345 - *
346 - * @since 5.3
347 - *
348 - * @return void
349 - */
350 - public static function enqueue_dialog_assets() {
351 254 wp_enqueue_script( 'jquery-ui-dialog' );
352 255 wp_enqueue_style( 'jquery-ui-dialog' );
256 +
257 + add_action( 'admin_footer', 'FrmAppController::upgrade_overlay_html' );
353 258 }
354 259
355 260 /**
356 261 * @since 3.06.03
357 - *
358 - * @return void
359 262 */
360 263 public static function upgrade_overlay_html() {
361 264 $is_pro = FrmAppHelper::pro_is_installed();
362 265 $upgrade_link = array(
@@ -369,16 +272,13 @@
369 272
370 273 include $shared_path . 'upgrade_overlay.php';
371 274 include $shared_path . 'confirm-overlay.php';
372 275
373 - if ( FrmAppHelper::is_admin_page( 'formidable-welcome' ) || FrmAppHelper::on_form_listing_page() ) {
276 + if ( ( FrmAppHelper::is_admin_page( 'formidable' ) || FrmAppHelper::is_admin_page( 'formidable-welcome' ) ) && in_array( FrmAppHelper::get_param( 'frm_action' ), array( '', 'list', 'trash' ), true ) ) {
374 277 self::new_form_overlay_html();
375 278 }
376 279 }
377 280
378 - /**
379 - * @return void
380 - */
381 281 private static function new_form_overlay_html() {
382 282 FrmFormsController::before_list_templates();
383 283
384 284 $plugin_path = FrmAppHelper::plugin_path();
@@ -425,27 +325,21 @@
425 325
426 326 include $path . 'new-form-overlay.php';
427 327 }
428 328
429 - /**
430 - * @return void
431 - */
432 329 public static function include_info_overlay() {
433 - self::enqueue_dialog_assets();
330 + wp_enqueue_script( 'jquery-ui-dialog' );
331 + wp_enqueue_style( 'jquery-ui-dialog' );
332 +
434 333 add_action( 'admin_footer', 'FrmAppController::info_overlay_html' );
435 334 }
436 335
437 - /**
438 - * @return void
439 - */
440 336 public static function info_overlay_html() {
441 - include FrmAppHelper::plugin_path() . '/classes/views/shared/info-overlay.php';
337 + include( FrmAppHelper::plugin_path() . '/classes/views/shared/info-overlay.php' );
442 338 }
443 339
444 340 /**
445 341 * @since 3.04.02
446 - *
447 - * @return void
448 342 */
449 343 public static function remove_upsells() {
450 344 remove_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
451 345 remove_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' );
@@ -450,8 +344,13 @@
450 344 remove_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
451 345 remove_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' );
452 346 remove_action( 'frm_add_form_style_tab_options', 'FrmFormsController::add_form_style_tab_options' );
453 347 remove_action( 'frm_after_field_options', 'FrmFormsController::logic_tip' );
348 +
349 + if ( is_callable( 'FrmProAddonsController::renewal_message' ) ) {
350 + // These functions moved to Pro in 4.09.01
351 + remove_action( 'frm_page_footer', 'FrmAppHelper::renewal_message' );
352 + }
454 353 }
455 354
456 355 /**
457 356 * If there are CURL problems on this server, wp_remote_post won't work for installing
@@ -457,17 +356,12 @@
457 356 * If there are CURL problems on this server, wp_remote_post won't work for installing
458 357 * Use a javascript fallback instead.
459 358 *
460 359 * @since 2.0.3
461 - *
462 - * @return void
463 360 */
464 361 public static function install_js_fallback() {
465 362 FrmAppHelper::load_admin_wide_js();
466 - ?>
467 - <div id="frm_install_message"></div>
468 - <script>jQuery(document).ready( frm_install_now );</script>
469 - <?php
363 + echo '<div id="hidden frm_install_message"></div><script type="text/javascript">jQuery(document).ready(function(){frm_install_now();});</script>';
470 364 }
471 365
472 366 /**
473 367 * Check if the database is outdated
@@ -494,11 +388,8 @@
494 388 /**
495 389 * Check both version number and DB number for changes
496 390 *
497 391 * @since 3.0.04
498 - *
499 - * @param array $atts
500 - * @return bool
501 392 */
502 393 public static function compare_for_update( $atts ) {
503 394 $db_version = get_option( $atts['option'] );
504 395
@@ -517,21 +408,10 @@
517 408 /**
518 409 * Check for database update and trigger js loading
519 410 *
520 411 * @since 2.0.1
521 - *
522 - * @return void
523 412 */
524 413 public static function admin_init() {
525 - if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) {
526 - FrmFormsController::duplicate();
527 - }
528 -
529 - if ( FrmAppHelper::is_style_editor_page() && 'save' === FrmAppHelper::get_param( 'frm_action' ) ) {
530 - // Hook in earlier than FrmStylesController::route so we can redirect before the headers have been sent.
531 - FrmStylesController::save_style();
532 - }
533 -
534 414 new FrmPersonalData(); // register personal data hooks
535 415
536 416 if ( ! FrmAppHelper::doing_ajax() && self::needs_update() ) {
537 417 self::network_upgrade_site();
@@ -541,110 +421,19 @@
541 421 // don't continue during ajax calls
542 422 self::admin_js();
543 423 }
544 424
545 - if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
546 - $action = FrmAppHelper::get_param( 'frm_action' );
547 -
548 - if ( in_array( $action, array( 'add_new', 'list_templates' ), true ) ) {
549 - wp_safe_redirect( admin_url( 'admin.php?page=formidable&triggerNewFormModal=1' ) );
550 - exit;
551 - }
552 -
553 - FrmInbox::maybe_disable_screen_options();
425 + if ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( FrmAppHelper::get_param( 'frm_action' ), array( 'add_new', 'list_templates' ), true ) ) {
426 + wp_safe_redirect( admin_url( 'admin.php?page=formidable&triggerNewFormModal=1' ) );
427 + exit;
554 428 }
555 -
556 - self::maybe_add_ip_warning();
557 429 }
558 430
559 - /**
560 - * Show a warning for the IP address setting if it hasn't been set.
561 - *
562 - * @since 6.1
563 - *
564 - * @return void
565 - */
566 - private static function maybe_add_ip_warning() {
567 - $settings = FrmAppHelper::get_settings();
568 - if ( false !== $settings->custom_header_ip ) {
569 - // The setting has been changed from the false default (to either 1 or 0), so stop showing the message.
570 - return;
571 - }
572 -
573 - if ( ! self::is_behind_proxy() ) {
574 - // This message is only applicable when using a reverse proxy.
575 - return;
576 - }
577 -
578 - if ( FrmAppHelper::get_post_param( 'frm_action', '', 'sanitize_text_field' ) ) {
579 - // Avoid the message on a POST action. We don't want to show the message if we're saving global settings.
580 - return;
581 - }
582 -
583 - $global_settings_link = admin_url( 'admin.php?page=formidable-settings' ) . '#frm_custom_header_ip';
584 - $message = sprintf(
585 - // Translators: 1: Global Settings Link
586 - __( 'IP addresses in form submissions may no longer be accurate! If you are experiencing issues, we recommend going to %1$s and enabling the "Use custom headers when retrieving IPs with form submissions." setting.', 'formidable' ),
587 - '<a href="' . esc_url( $global_settings_link ) . '">Global Settings</a>'
588 - );
589 - $option_name = 'frm_dismiss_ip_address_notice';
590 - FrmAppHelper::add_dismissable_warning_message( $message, $option_name );
591 - }
592 -
593 - /**
594 - * Check if any reverse proxy headers are set.
595 - *
596 - * @since 6.1
597 - *
598 - * @return bool
599 - */
600 - private static function is_behind_proxy() {
601 - $custom_headers = FrmAppHelper::get_custom_header_keys_for_ip();
602 - foreach ( $custom_headers as $header ) {
603 - if ( 'REMOTE_ADDR' === $header ) {
604 - // We want to check every key but REMOTE_ADDR. REMOTE_ATTR is not unique to reverse proxy servers.
605 - continue;
606 - }
607 -
608 - $ip = trim( FrmAppHelper::get_server_value( $header ) );
609 - // Return true for anything that isn't empty but ignoring values like ::1.
610 - if ( $ip && 0 !== strpos( $ip, '::' ) ) {
611 - return true;
612 - }
613 - }
614 -
615 - return false;
616 - }
617 -
618 - /**
619 - * @return void
620 - */
621 431 public static function admin_js() {
622 - $plugin_url = FrmAppHelper::plugin_url();
623 - $version = FrmAppHelper::plugin_version();
624 -
432 + $version = FrmAppHelper::plugin_version();
625 433 FrmAppHelper::load_admin_wide_js();
626 434
627 - wp_register_style( 'formidable_admin_global', $plugin_url . '/css/admin/frm_admin_global.css', array(), $version );
628 - wp_enqueue_style( 'formidable_admin_global' );
629 -
630 - wp_register_style( 'formidable-admin', $plugin_url . '/css/frm_admin.css', array(), $version );
631 - wp_register_style( 'formidable-grids', $plugin_url . '/css/frm_grids.css', array(), $version );
632 -
633 - wp_register_script( 'formidable_dom', $plugin_url . '/js/admin/dom.js', array( 'jquery', 'jquery-ui-dialog', 'wp-i18n' ), $version, true );
634 - wp_register_script( 'formidable_embed', $plugin_url . '/js/admin/embed.js', array( 'formidable_dom', 'jquery-ui-autocomplete' ), $version, true );
635 - self::register_popper1();
636 - wp_register_script( 'bootstrap_tooltip', $plugin_url . '/js/bootstrap.min.js', array( 'jquery', 'popper' ), '4.6.1', true );
637 - wp_register_script( 'formidable_settings', $plugin_url . '/js/admin/settings.js', array(), $version, true );
638 -
639 - $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
640 -
641 - if ( 'formidable-applications' === $page ) {
642 - FrmApplicationsController::load_assets();
643 - return;
644 - }
645 -
646 - $dependencies = array(
435 + $dependecies = array(
647 436 'formidable_admin_global',
648 437 'jquery',
649 438 'jquery-ui-core',
650 439 'jquery-ui-draggable',
@@ -651,37 +440,32 @@
651 440 'jquery-ui-sortable',
652 441 'bootstrap_tooltip',
653 442 'bootstrap-multiselect',
654 443 'wp-i18n',
655 - 'wp-hooks', // Required in WP versions older than 5.7
656 - 'formidable_dom',
657 - 'formidable_embed',
658 444 );
659 445
660 - if ( FrmAppHelper::is_style_editor_page( 'edit' ) ) {
661 - // We only need to load the color picker when editing styles.
662 - $dependencies[] = 'wp-color-picker';
446 + if ( FrmAppHelper::is_admin_page( 'formidable-styles' ) || FrmAppHelper::is_admin_page( 'formidable-styles2' ) ) {
447 + $dependecies[] = 'wp-color-picker';
663 448 }
664 449
665 - wp_register_script( 'formidable_admin', $plugin_url . '/js/formidable_admin.js', $dependencies, $version, true );
450 + wp_register_script( 'formidable_admin', FrmAppHelper::plugin_url() . '/js/formidable_admin.js', $dependecies, $version, true );
451 + wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
452 + wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
453 + wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version );
666 454
667 - if ( FrmAppHelper::on_form_listing_page() ) {
668 - // For the existing page dropdown in the Form embed modal.
669 - wp_enqueue_script( 'jquery-ui-autocomplete' );
670 - }
455 + // load multselect js
456 + $depends_on = array( 'jquery', 'bootstrap_tooltip' );
457 + wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', $depends_on, '0.9.8', true );
671 458
672 - wp_register_script( 'bootstrap-multiselect', $plugin_url . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip', 'popper' ), '1.1.1', true );
673 -
459 + $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
674 460 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
675 461
676 462 global $pagenow;
677 - if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow === 'edit.php' && $post_type === 'frm_display' ) ) {
463 + if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) {
678 464
679 465 wp_enqueue_script( 'admin-widgets' );
680 466 wp_enqueue_style( 'widgets' );
681 - self::maybe_deregister_popper2();
682 467 wp_enqueue_script( 'formidable_admin' );
683 - wp_enqueue_script( 'formidable_embed' );
684 468 FrmAppHelper::localize_script( 'admin' );
685 469
686 470 wp_enqueue_style( 'formidable-admin' );
687 471 if ( 'formidable-styles' !== $page && 'formidable-styles2' !== $page ) {
@@ -687,9 +471,12 @@
687 471 if ( 'formidable-styles' !== $page && 'formidable-styles2' !== $page ) {
688 472 wp_enqueue_style( 'formidable-grids' );
689 473 wp_enqueue_style( 'formidable-dropzone' );
690 474 } else {
691 - wp_enqueue_style( 'formidable-grids' );
475 + $settings = FrmAppHelper::get_settings();
476 + if ( empty( $settings->old_css ) ) {
477 + wp_enqueue_style( 'formidable-grids' );
478 + }
692 479 }
693 480
694 481 if ( 'formidable-entries' === $page ) {
695 482 // Load front end js for entries.
@@ -711,124 +498,19 @@
711 498 } else {
712 499 return;
713 500 }
714 501
715 - if ( $post_type === 'frm_display' ) {
716 - self::enqueue_legacy_views_assets();
502 + if ( $post_type == 'frm_display' ) {
503 + wp_enqueue_style( 'formidable-grids' );
504 + wp_enqueue_script( 'jquery-ui-draggable' );
505 + wp_enqueue_script( 'formidable_admin' );
506 + wp_enqueue_style( 'formidable-admin' );
507 + FrmAppHelper::localize_script( 'admin' );
508 + self::include_info_overlay();
717 509 }
718 510 }
719 -
720 - self::maybe_force_formidable_block_on_gutenberg_page();
721 511 }
722 512
723 - /**
724 - * Enqueue required assets for the Legacy Views editor (Views v4.x).
725 - *
726 - * @since 6.1.2
727 - *
728 - * @return void
729 - */
730 - private static function enqueue_legacy_views_assets() {
731 - wp_enqueue_style( 'formidable-grids' );
732 - wp_enqueue_script( 'jquery-ui-draggable' );
733 - self::maybe_deregister_popper2();
734 - wp_enqueue_script( 'formidable_admin' );
735 - wp_add_inline_style(
736 - 'formidable-admin',
737 - '
738 - .frm-white-body.post-type-frm_display .columns-2 {
739 - display: block;
740 - overflow: visible;
741 - }
742 -
743 - .frm-white-body.post-type-frm_display .columns-2 > div {
744 - overflow-y: hidden;
745 - }
746 -
747 - .frm-white-body.post-type-frm_display #titlediv #title-prompt-text {
748 - padding: 3px 0 0 10px;
749 - }
750 -
751 - .post-type-frm_display #field-search-input,
752 - .post-type-frm_display #advanced-search-input {
753 - flex: 1;
754 - }
755 - '
756 - );
757 - wp_enqueue_style( 'formidable-admin' );
758 - FrmAppHelper::localize_script( 'admin' );
759 - self::include_info_overlay();
760 - }
761 -
762 - /**
763 - * Fix a Duplicator Pro conflict because it uses Popper 2. See issue #3459.
764 - *
765 - * @since 5.2.02.01
766 - *
767 - * @return void
768 - */
769 - private static function maybe_deregister_popper2() {
770 - global $wp_scripts;
771 -
772 - if ( ! array_key_exists( 'popper', $wp_scripts->registered ) ) {
773 - return;
774 - }
775 -
776 - $popper = $wp_scripts->registered['popper'];
777 - if ( version_compare( $popper->ver, '2.0', '>=' ) ) {
778 - wp_deregister_script( 'popper' );
779 - self::register_popper1();
780 - }
781 - }
782 -
783 - /**
784 - * Register Popper required for Bootstrap 4.
785 - *
786 - * @since 5.2.02.01
787 - *
788 - * @return void
789 - */
790 - private static function register_popper1() {
791 - wp_register_script( 'popper', FrmAppHelper::plugin_url() . '/js/popper.min.js', array( 'jquery' ), '1.16.0', true );
792 - }
793 -
794 - /**
795 - * Automatically insert a Formidable block when loading Gutenberg when $_GET['frmForm' is set.
796 - *
797 - * @since 5.2
798 - *
799 - * @return void
800 - */
801 - private static function maybe_force_formidable_block_on_gutenberg_page() {
802 - global $pagenow;
803 - if ( 'post.php' !== $pagenow ) {
804 - return;
805 - }
806 -
807 - $form_id = FrmAppHelper::simple_get( 'frmForm', 'absint' );
808 - if ( ! $form_id ) {
809 - return;
810 - }
811 -
812 - self::add_js_to_inject_gutenberg_block( 'formidable/simple-form', 'formId', $form_id );
813 - }
814 -
815 - /**
816 - * @since 5.3
817 - *
818 - * @param string $block_name
819 - * @param string $object_key
820 - * @param array|string $object_id
821 - *
822 - * @return void
823 - */
824 - public static function add_js_to_inject_gutenberg_block( $block_name, $object_key, $object_id ) {
825 - require FrmAppHelper::plugin_path() . '/classes/views/shared/edit-page-js.php';
826 - }
827 -
828 - /**
829 - * @return void
830 - */
831 513 public static function load_lang() {
832 514 load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
833 515 }
834 516
@@ -835,10 +517,8 @@
835 517 /**
836 518 * Check if the styles are updated when a form is loaded on the front-end
837 519 *
838 520 * @since 3.0.1
839 - *
840 - * @return void
841 521 */
842 522 public static function maybe_update_styles() {
843 523 if ( self::needs_update() ) {
844 524 self::network_upgrade_site();
@@ -846,10 +526,8 @@
846 526 }
847 527
848 528 /**
849 529 * @since 3.0
850 - *
851 - * @return void
852 530 */
853 531 public static function create_rest_routes() {
854 532 $args = array(
855 533 'methods' => 'GET',
@@ -884,10 +562,8 @@
884 562 *
885 563 * @since 2.0.1
886 564 *
887 565 * @param int $blog_id Blog ID.
888 - *
889 - * @return void
890 566 */
891 567 public static function network_upgrade_site( $blog_id = 0 ) {
892 568 // Flag to check if install is happening as intended.
893 569 set_transient( 'frm_updating_api', true, MINUTE_IN_SECONDS );
@@ -911,10 +587,8 @@
911 587
912 588 /**
913 589 * Make sure WP_Site_Health has been included because it is required when calling rest_do_request.
914 590 * Check first that the file exists because WP_Site_Health was only introduced in WordPress 5.2.
915 - *
916 - * @return void
917 591 */
918 592 private static function maybe_add_wp_site_health() {
919 593 if ( ! class_exists( 'WP_Site_Health' ) ) {
920 594 $wp_site_health_path = ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
@@ -925,10 +599,8 @@
925 599 }
926 600
927 601 /**
928 602 * @since 3.0
929 - *
930 - * @return true
931 603 */
932 604 public static function api_install() {
933 605 delete_transient( 'frm_updating_api' );
934 606 if ( self::needs_update() ) {
@@ -947,29 +619,19 @@
947 619 * Silent database upgrade (no redirect).
948 620 * Called via ajax request during network upgrade process.
949 621 *
950 622 * @since 2.0.1
951 - *
952 - * @return void
953 623 */
954 624 public static function ajax_install() {
955 - FrmAppHelper::permission_check( 'frm_change_settings' );
956 - check_ajax_referer( 'frm_ajax', 'nonce' );
957 625 self::api_install();
958 626 wp_die();
959 627 }
960 628
961 - /**
962 - * @return void
963 - */
964 629 public static function install() {
965 630 $frmdb = new FrmMigrate();
966 631 $frmdb->upgrade();
967 632 }
968 633
969 - /**
970 - * @return void
971 - */
972 634 public static function uninstall() {
973 635 FrmAppHelper::permission_check( 'administrator' );
974 636 check_ajax_referer( 'frm_ajax', 'nonce' );
975 637
@@ -993,11 +655,8 @@
993 655
994 656 return $tables;
995 657 }
996 658
997 - /**
998 - * @return void
999 - */
1000 659 public static function deauthorize() {
1001 660 FrmAppHelper::permission_check( 'frm_change_settings' );
1002 661 check_ajax_referer( 'frm_ajax', 'nonce' );
1003 662
@@ -1016,45 +675,45 @@
1016 675 return $text;
1017 676 }
1018 677
1019 678 /**
1020 - * @deprecated 3.0.04
1021 - *
679 + * @deprecated 1.07.05
1022 680 * @codeCoverageIgnore
1023 - *
1024 - * @return void
1025 681 */
1026 - public static function activation_install() {
1027 - FrmDeprecated::activation_install();
682 + public static function get_form_shortcode( $atts ) {
683 + return FrmDeprecated::get_form_shortcode( $atts );
1028 684 }
1029 685
1030 686 /**
1031 - * @deprecated 3.0
687 + * @deprecated 2.5.4
1032 688 * @codeCoverageIgnore
1033 689 */
1034 - public static function page_route( $content ) {
1035 - return FrmDeprecated::page_route( $content );
690 + public static function widget_text_filter( $content ) {
691 + return FrmDeprecated::widget_text_filter( $content );
1036 692 }
1037 693
1038 694 /**
1039 - * Include icons on page for Embed Form modal.
695 + * Deprecated in favor of wpmu_upgrade_site
1040 696 *
1041 - * @since 5.2
1042 - *
1043 - * @return void
697 + * @deprecated 2.3
698 + * @codeCoverageIgnore
1044 699 */
1045 - public static function include_embed_form_icons() {
1046 - _deprecated_function( __METHOD__, '5.3' );
700 + public static function front_head() {
701 + FrmDeprecated::front_head();
1047 702 }
1048 703
1049 704 /**
1050 - * @deprecated 1.07.05 This is still referenced in the API add on as of v1.13.
705 + * @deprecated 3.0.04
1051 706 * @codeCoverageIgnore
1052 - *
1053 - * @param array $atts
1054 - * @return string
1055 707 */
1056 - public static function get_form_shortcode( $atts ) {
1057 - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode' );
1058 - return FrmFormsController::get_form_shortcode( $atts );
708 + public static function activation_install() {
709 + FrmDeprecated::activation_install();
710 + }
711 +
712 + /**
713 + * @deprecated 3.0
714 + * @codeCoverageIgnore
715 + */
716 + public static function page_route( $content ) {
717 + return FrmDeprecated::page_route( $content );
1059 718 }
1060 719 }