PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.5.6
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.5.6
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 +126 -837 6.255.5.6 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;
@@ -14,13 +11,8 @@
14 11 return;
15 12 }
16 13
17 14 $menu_name = FrmAppHelper::get_menu_name();
18 -
19 - if ( in_array( $menu_name, array( 'Formidable', 'Forms' ), true ) ) {
20 - $menu_name .= wp_kses_post( FrmInboxController::get_notice_count() );
21 - }
22 -
23 15 add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', self::menu_icon(), self::get_menu_position() );
24 16 }
25 17
26 18 /**
@@ -66,22 +58,10 @@
66 58 $classes .= ' frm-admin-page-' . $page;
67 59 }
68 60 }
69 61
70 - if ( self::is_grey_page() ) {
71 - $classes .= ' frm-grey-body ';
72 - }
73 -
74 62 if ( FrmAppHelper::is_full_screen() ) {
75 - $full_screen_on = self::get_full_screen_setting();
76 - $add_class = '';
77 - if ( $full_screen_on ) {
78 - $add_class = ' frm-full-screen is-fullscreen-mode';
79 -
80 - // Load the CSS for .is-fullscreen-mode.
81 - wp_enqueue_style( 'wp-edit-post' );
82 - }
83 - $classes .= apply_filters( 'frm_admin_full_screen_class', $add_class );
63 + $classes .= apply_filters( 'frm_admin_full_screen_class', ' frm-full-screen folded' );
84 64 }
85 65
86 66 if ( ! FrmAppHelper::pro_is_installed() ) {
87 67 $classes .= ' frm-lite ';
@@ -86,38 +66,13 @@
86 66 if ( ! FrmAppHelper::pro_is_installed() ) {
87 67 $classes .= ' frm-lite ';
88 68 }
89 69
90 - if ( get_user_setting( 'unfold' ) && 'f' !== get_user_setting( 'mfold' ) ) {
91 - $classes .= ' frm-unfold ';
92 - }
93 -
94 70 return $classes;
95 71 }
96 72
97 73 /**
98 - * Get the full screen mode setting from the block editor.
99 - *
100 - * @since 6.1
101 - *
102 - * @return bool
103 - */
104 - private static function get_full_screen_setting() {
105 - global $wpdb;
106 - $meta_key = $wpdb->get_blog_prefix() . 'persisted_preferences';
107 -
108 - $prefs = get_user_meta( get_current_user_id(), $meta_key, true );
109 - if ( $prefs && isset( $prefs['core/edit-post']['fullscreenMode'] ) ) {
110 - return $prefs['core/edit-post']['fullscreenMode'];
111 - }
112 -
113 - return true;
114 - }
115 -
116 - /**
117 74 * @since 4.0
118 - *
119 - * @return string
120 75 */
121 76 private static function get_os() {
122 77 $agent = strtolower( FrmAppHelper::get_server_value( 'HTTP_USER_AGENT' ) );
123 78 $os = '';
@@ -138,9 +93,9 @@
138 93 $white_pages = array(
139 94 'formidable',
140 95 'formidable-entries',
141 96 'formidable-views',
142 - 'formidable-views-editor',
97 + 'formidable-pro-upgrade',
143 98 'formidable-addons',
144 99 'formidable-import',
145 100 'formidable-settings',
146 101 'formidable-styles',
@@ -145,25 +100,20 @@
145 100 'formidable-settings',
146 101 'formidable-styles',
147 102 'formidable-styles2',
148 103 'formidable-inbox',
149 - FrmFormTemplatesController::PAGE_SLUG,
150 - FrmOnboardingWizardController::PAGE_SLUG,
104 + 'formidable-welcome',
105 + 'formidable-applications',
151 106 );
152 107
153 - if ( ! class_exists( 'FrmTransHooksController', false ) && ! FrmTransLiteAppHelper::should_fallback_to_paypal() ) {
154 - // Only consider the payments page as a "white page" when the Payments submodule is off.
155 - // Otherwise this causes a lot of styling issues when the Stripe add-on (or Authorize.Net) is active.
108 + $get_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
109 + $is_white_page = in_array( $get_page, $white_pages, true );
156 110
157 - // Add an extra check to avoid white page styling on the PayPal "edit" action.
158 - // We fallback to the PayPal add on for the "edit" action since Stripe Lite does not have an edit view.
159 - if ( ! in_array( FrmAppHelper::simple_get( 'action' ), array( 'edit', 'new' ), true ) || ! is_callable( 'FrmPaymentsController::route' ) ) {
160 - $white_pages[] = 'formidable-payments';
161 - }
111 + if ( ! $is_white_page ) {
112 + $screen = get_current_screen();
113 + $is_white_page = ( $screen && strpos( $screen->id, 'frm_display' ) !== false );
162 114 }
163 115
164 - $is_white_page = self::is_page_in_list( $white_pages ) || self::is_grey_page() || FrmAppHelper::is_view_builder_page();
165 -
166 116 /**
167 117 * Allow another add on to style a page as a Formidable "white page", which adds a white background color.
168 118 *
169 119 * @since 5.3
@@ -174,62 +124,12 @@
174 124
175 125 return $is_white_page;
176 126 }
177 127
178 - /**
179 - * Add a grey bg instead of white.
180 - *
181 - * @since 6.8
182 - *
183 - * @return bool
184 - */
185 - private static function is_grey_page() {
186 - $grey_pages = array(
187 - 'formidable-applications',
188 - 'formidable-dashboard',
189 - 'formidable-views',
190 - );
191 -
192 - $is_grey_page = self::is_page_in_list( $grey_pages );
193 -
194 - /**
195 - * Filter to change FF wrapper background to grey.
196 - *
197 - * @since 6.8
198 - *
199 - * @param bool $is_grey_page
200 - * @return bool
201 - */
202 - return apply_filters( 'frm_is_grey_page', $is_grey_page );
203 - }
204 -
205 - /**
206 - * @since 6.8
207 - *
208 - * @param array $pages A list of page names to check.
209 - * @return bool
210 - */
211 - private static function is_page_in_list( $pages ) {
212 - $get_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
213 - return in_array( $get_page, $pages, true );
214 - }
215 -
216 - /**
217 - * @return void
218 - */
219 128 public static function load_wp_admin_style() {
220 129 FrmAppHelper::load_font_style();
221 130 }
222 131
223 - /**
224 - * @param int|object $form
225 - * @param bool $show_nav
226 - * @param string $title
227 - *
228 - * @psalm-param 'hide'|'show' $title
229 - *
230 - * @return void
231 - */
232 132 public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
233 133 $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
234 134 if ( empty( $show_nav ) || ! $form ) {
235 135 return;
@@ -243,14 +143,11 @@
243 143 $id = $form->id;
244 144 $current_page = self::get_current_page();
245 145 $nav_items = self::get_form_nav_items( $form );
246 146
247 - include FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php';
147 + include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
248 148 }
249 149
250 - /**
251 - * @return string
252 - */
253 150 private static function get_current_page() {
254 151 $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
255 152 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
256 153 $current_page = isset( $_GET['page'] ) ? $page : $post_type;
@@ -261,12 +158,8 @@
261 158
262 159 return $current_page;
263 160 }
264 161
265 - /**
266 - * @param object $form
267 - * @return array
268 - */
269 162 private static function get_form_nav_items( $form ) {
270 163 $id = $form->parent_form_id ? $form->parent_form_id : $form->id;
271 164
272 165 $nav_items = array(
@@ -277,15 +170,8 @@
277 170 'page' => 'formidable',
278 171 'permission' => 'frm_edit_forms',
279 172 ),
280 173 array(
281 - 'link' => FrmStylesHelper::get_list_url( $id ),
282 - 'label' => __( 'Style', 'formidable' ),
283 - 'current' => array(),
284 - 'page' => 'formidable-styles',
285 - 'permission' => 'frm_edit_forms',
286 - ),
287 - array(
288 174 'link' => admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . absint( $id ) ),
289 175 'label' => __( 'Settings', 'formidable' ),
290 176 'current' => array( 'settings' ),
291 177 'page' => 'formidable',
@@ -299,18 +185,18 @@
299 185 'permission' => 'frm_view_entries',
300 186 ),
301 187 );
302 188
303 - $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) && FrmProAppHelper::views_is_installed();
189 + $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) ? FrmProAppHelper::views_is_installed() : FrmAppHelper::pro_is_installed();
304 190
305 191 if ( ! $views_installed ) {
306 192 $nav_items[] = array(
307 - 'link' => admin_url( 'admin.php?page=formidable-views&form=' . absint( $id ) ),
308 - 'label' => __( 'Views', 'formidable' ),
309 - 'current' => array(),
310 - 'page' => 'formidable-views',
193 + 'link' => admin_url( 'admin.php?page=formidable-views&form=' . absint( $id ) ),
194 + 'label' => __( 'Views', 'formidable' ),
195 + 'current' => array(),
196 + 'page' => 'formidable-views',
311 197 'permission' => 'frm_view_entries',
312 - 'atts' => array(
198 + 'atts' => array(
313 199 'class' => 'frm_noallow',
314 200 ),
315 201 );
316 202 }
@@ -317,14 +203,14 @@
317 203
318 204 // Let people know reports and views exist.
319 205 if ( ! FrmAppHelper::pro_is_installed() ) {
320 206 $nav_items[] = array(
321 - 'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&form=' . absint( $id ) ),
322 - 'label' => __( 'Reports', 'formidable' ),
323 - 'current' => array( 'reports' ),
324 - 'page' => 'formidable',
207 + 'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&form=' . absint( $id ) ),
208 + 'label' => __( 'Reports', 'formidable' ),
209 + 'current' => array( 'reports' ),
210 + 'page' => 'formidable',
325 211 'permission' => 'frm_view_entries',
326 - 'atts' => array(
212 + 'atts' => array(
327 213 'class' => 'frm_noallow',
328 214 ),
329 215 );
330 216 }
@@ -333,38 +219,17 @@
333 219 'form_id' => $id,
334 220 'form' => $form,
335 221 );
336 222
337 - return (array) apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
223 + return apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
338 224 }
339 225
340 - /**
341 - * Adds a settings link to the plugins page
342 - *
343 - * @param array $links
344 - * @return array
345 - */
226 + // Adds a settings link to the plugins page
346 227 public static function settings_link( $links ) {
347 228 $settings = array();
348 229
349 230 if ( ! FrmAppHelper::pro_is_installed() ) {
350 - if ( FrmAddonsController::is_license_expired() ) {
351 - $label = __( 'Renew', 'formidable' );
352 - } else {
353 - $label = FrmSalesApi::get_best_sale_value( 'plugin_page_cta_text' );
354 - if ( ! $label ) {
355 - $label = __( 'Upgrade to Pro', 'formidable' );
356 - }
357 - }
358 -
359 - $upgrade_link = FrmSalesApi::get_best_sale_value( 'plugin_page_cta_link' );
360 - if ( $upgrade_link ) {
361 - $upgrade_link = FrmAppHelper::maybe_add_missing_utm( $upgrade_link, array( 'medium' => 'plugin-row' ) );
362 - } else {
363 - $upgrade_link = FrmAppHelper::admin_upgrade_link( 'plugin-row' );
364 - }
365 -
366 - $settings[] = '<a href="' . esc_url( $upgrade_link ) . '" target="_blank" rel="noopener"><b style="color:#1da867;font-weight:700;">' . esc_html( $label ) . '</b></a>';
231 + $settings[] = '<a href="' . esc_url( FrmAppHelper::admin_upgrade_link( 'plugin-row' ) ) . '" target="_blank" rel="noopener"><b>' . esc_html__( 'Upgrade to Pro', 'formidable' ) . '</b></a>';
367 232 }
368 233
369 234 $settings[] = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>';
370 235
@@ -370,14 +235,11 @@
370 235
371 236 return array_merge( $settings, $links );
372 237 }
373 238
374 - /**
375 - * @return void
376 - */
377 239 public static function pro_get_started_headline() {
378 240 self::review_request();
379 - FrmAppHelper::min_pro_version_notice( '6.0' );
241 + FrmAppHelper::min_pro_version_notice( '4.0' );
380 242 }
381 243
382 244 /**
383 245 * Add admin notices as needed for reviews
@@ -382,10 +244,8 @@
382 244 /**
383 245 * Add admin notices as needed for reviews
384 246 *
385 247 * @since 3.04.03
386 - *
387 - * @return void
388 248 */
389 249 private static function review_request() {
390 250 $reviews = new FrmReviews();
391 251 $reviews->review_request();
@@ -394,10 +254,8 @@
394 254 /**
395 255 * Save the request to hide the review
396 256 *
397 257 * @since 3.04.03
398 - *
399 - * @return void
400 258 */
401 259 public static function dismiss_review() {
402 260 FrmAppHelper::permission_check( 'frm_change_settings' );
403 261 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -407,10 +265,8 @@
407 265 }
408 266
409 267 /**
410 268 * @since 3.04.02
411 - *
412 - * @return void
413 269 */
414 270 public static function include_upgrade_overlay() {
415 271 self::enqueue_dialog_assets();
416 272 add_action( 'admin_footer', 'FrmAppController::upgrade_overlay_html' );
@@ -429,10 +285,8 @@
429 285 }
430 286
431 287 /**
432 288 * @since 3.06.03
433 - *
434 - * @return void
435 289 */
436 290 public static function upgrade_overlay_html() {
437 291 $is_pro = FrmAppHelper::pro_is_installed();
438 292 $upgrade_link = array(
@@ -444,39 +298,67 @@
444 298 $shared_path = $plugin_path . '/classes/views/shared/';
445 299
446 300 include $shared_path . 'upgrade_overlay.php';
447 301 include $shared_path . 'confirm-overlay.php';
302 +
303 + if ( FrmAppHelper::is_admin_page( 'formidable-welcome' ) || FrmAppHelper::on_form_listing_page() ) {
304 + self::new_form_overlay_html();
305 + }
448 306 }
449 307
450 - /**
451 - * Create a basic form with an email field.
452 - *
453 - * @param string $form_key
454 - * @param string $title
455 - * @param string $description
456 - * @return void
457 - */
458 - public static function api_email_form( $form_key, $title = '', $description = '' ) {
459 - $user = wp_get_current_user();
460 - $args = array(
461 - 'api_url' => 'https://sandbox.formidableforms.com/api/wp-json/frm/v2/forms/' . $form_key . '?return=html&exclude_script=jquery&exclude_style=formidable-css',
462 - 'title' => $title,
463 - 'description' => $description,
308 + private static function new_form_overlay_html() {
309 + FrmFormsController::before_list_templates();
310 +
311 + $plugin_path = FrmAppHelper::plugin_path();
312 + $path = $plugin_path . '/classes/views/frm-forms/';
313 + $expired = FrmFormsController::expired();
314 + $expiring = FrmAddonsController::is_license_expiring();
315 + $user = wp_get_current_user(); // $user used in leave-email.php to determine a default value for field
316 + $view_path = $path . 'new-form-overlay/';
317 + $modal_class = '';
318 + $upgrade_link = FrmAppHelper::admin_upgrade_link(
319 + array(
320 + 'medium' => 'new-template',
321 + 'content' => 'upgrade',
322 + )
464 323 );
465 - require FrmAppHelper::plugin_path() . '/classes/views/form-templates/modals/leave-email-modal.php';
324 + $renew_link = FrmAppHelper::admin_upgrade_link(
325 + array(
326 + 'medium' => 'new-template',
327 + 'content' => 'renew',
328 + )
329 + );
330 + $blocks_to_render = array();
331 +
332 + if ( ! FrmAppHelper::pro_is_installed() ) {
333 + // avoid rendering the email and code blocks for users who have upgraded or have a free license already
334 + $api = new FrmFormTemplateApi();
335 + if ( ! $api->has_free_access() ) {
336 + array_push( $blocks_to_render, 'email', 'code' );
337 + }
338 + }
339 +
340 + // avoid rendering the upgrade block for users with elite
341 + if ( 'elite' !== FrmAddonsController::license_type() ) {
342 + $blocks_to_render[] = 'upgrade';
343 + }
344 +
345 + // avoid rendering the renew block for users who are not currently expired
346 + if ( $expired ) {
347 + $blocks_to_render[] = 'renew';
348 + $modal_class = 'frm-expired';
349 + } elseif ( $expiring ) {
350 + $modal_class = 'frm-expiring';
351 + }
352 +
353 + include $path . 'new-form-overlay.php';
466 354 }
467 355
468 - /**
469 - * @return void
470 - */
471 356 public static function include_info_overlay() {
472 357 self::enqueue_dialog_assets();
473 358 add_action( 'admin_footer', 'FrmAppController::info_overlay_html' );
474 359 }
475 360
476 - /**
477 - * @return void
478 - */
479 361 public static function info_overlay_html() {
480 362 include FrmAppHelper::plugin_path() . '/classes/views/shared/info-overlay.php';
481 363 }
482 364
@@ -481,14 +363,13 @@
481 363 }
482 364
483 365 /**
484 366 * @since 3.04.02
485 - *
486 - * @return void
487 367 */
488 368 public static function remove_upsells() {
489 369 remove_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
490 - remove_action( 'frm_after_settings_tabs', 'FrmSettingsController::settings_cta' );
370 + remove_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' );
371 + remove_action( 'frm_add_form_style_tab_options', 'FrmFormsController::add_form_style_tab_options' );
491 372 remove_action( 'frm_after_field_options', 'FrmFormsController::logic_tip' );
492 373 }
493 374
494 375 /**
@@ -495,10 +376,8 @@
495 376 * If there are CURL problems on this server, wp_remote_post won't work for installing
496 377 * Use a javascript fallback instead.
497 378 *
498 379 * @since 2.0.3
499 - *
500 - * @return void
501 380 */
502 381 public static function install_js_fallback() {
503 382 FrmAppHelper::load_admin_wide_js();
504 383 ?>
@@ -510,9 +389,9 @@
510 389 /**
511 390 * Check if the database is outdated
512 391 *
513 392 * @since 2.0.1
514 - * @return bool
393 + * @return boolean
515 394 */
516 395 public static function needs_update() {
517 396 $needs_upgrade = self::compare_for_update(
518 397 array(
@@ -532,11 +411,8 @@
532 411 /**
533 412 * Check both version number and DB number for changes
534 413 *
535 414 * @since 3.0.04
536 - *
537 - * @param array $atts
538 - * @return bool
539 415 */
540 416 public static function compare_for_update( $atts ) {
541 417 $db_version = get_option( $atts['option'] );
542 418
@@ -555,49 +431,16 @@
555 431 /**
556 432 * Check for database update and trigger js loading
557 433 *
558 434 * @since 2.0.1
559 - *
560 - * @return void
561 435 */
562 436 public static function admin_init() {
563 - if ( FrmAppHelper::get_param( 'delete_all' ) && FrmAppHelper::is_admin_page( 'formidable' ) && 'trash' === FrmAppHelper::get_param( 'form_type' ) ) {
564 - FrmFormsController::delete_all();
565 - }
566 -
567 437 if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) {
568 438 FrmFormsController::duplicate();
569 439 }
570 440
571 - if ( FrmAppHelper::is_admin_page( 'formidable' ) && FrmAppHelper::simple_get( 'frm_add_tables' ) ) {
572 - self::add_missing_tables();
573 - }
441 + new FrmPersonalData(); // register personal data hooks
574 442
575 - if ( FrmAppHelper::is_style_editor_page() && 'save' === FrmAppHelper::get_param( 'frm_action' ) ) {
576 - // Hook in earlier than FrmStylesController::route so we can redirect before the headers have been sent.
577 - FrmStylesController::save_style();
578 - }
579 -
580 - if ( 'formidable-pro-upgrade' === FrmAppHelper::get_param( 'page' ) && ! FrmAppHelper::pro_is_installed() && current_user_can( 'frm_view_forms' ) ) {
581 - $redirect = FrmSalesApi::get_best_sale_value( 'menu_cta_link' );
582 - $utm = array(
583 - 'medium' => 'upgrade',
584 - 'content' => 'submenu-upgrade',
585 - );
586 -
587 - if ( $redirect ) {
588 - $redirect = FrmAppHelper::maybe_add_missing_utm( $redirect, $utm );
589 - } else {
590 - $redirect = FrmAppHelper::admin_upgrade_link( $utm );
591 - }
592 -
593 - wp_redirect( $redirect );
594 - die();
595 - }
596 -
597 - // Register personal data hooks.
598 - new FrmPersonalData();
599 -
600 443 if ( ! FrmAppHelper::doing_ajax() && self::needs_update() ) {
601 444 self::network_upgrade_site();
602 445 }
603 446
@@ -605,20 +448,13 @@
605 448 // don't continue during ajax calls
606 449 self::admin_js();
607 450 }
608 451
609 - self::trigger_page_load_hooks();
610 -
611 452 if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
612 - // Redirect to the "Form Templates" page if the 'frm_action' parameter matches specific actions.
613 - // This provides backward compatibility for old addons that use legacy modal templates.
614 - $action = FrmAppHelper::get_param( 'frm_action' );
615 - $trigger_name_modal = FrmAppHelper::get_param( 'triggerNewFormModal' );
616 - if ( $trigger_name_modal || in_array( $action, array( 'add_new', 'list_templates' ), true ) ) {
617 - $application_id = FrmAppHelper::simple_get( 'applicationId', 'absint' );
618 - $url_param = $application_id ? '&applicationId=' . $application_id : '';
453 + $action = FrmAppHelper::get_param( 'frm_action' );
619 454
620 - wp_safe_redirect( admin_url( 'admin.php?page=' . FrmFormTemplatesController::PAGE_SLUG . $url_param ) );
455 + if ( in_array( $action, array( 'add_new', 'list_templates' ), true ) ) {
456 + wp_safe_redirect( admin_url( 'admin.php?page=formidable&triggerNewFormModal=1' ) );
621 457 exit;
622 458 }
623 459
624 460 FrmInbox::maybe_disable_screen_options();
@@ -625,33 +461,10 @@
625 461 }
626 462 }
627 463
628 464 /**
629 - * Get the current page and check for a possible function to trigger.
630 - * If a class name matches the page name, and the class has a load_page() method, trigger it.
631 - *
632 - * @since 6.8
633 - *
634 465 * @return void
635 466 */
636 - private static function trigger_page_load_hooks() {
637 - $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
638 - if ( strpos( $page, 'formidable-' ) !== 0 ) {
639 - // Only trigger hooks on Formidable pages.
640 - return;
641 - }
642 -
643 - $page = str_replace( array( 'formidable-', '-' ), array( '', ' ' ), $page );
644 - $page = str_replace( ' ', '', ucwords( $page ) );
645 - $class = 'Frm' . $page . 'Controller';
646 - if ( class_exists( $class ) && method_exists( $class, 'load_page' ) ) {
647 - call_user_func( array( $class, 'load_page' ) );
648 - }
649 - }
650 -
651 - /**
652 - * @return void
653 - */
654 467 public static function admin_js() {
655 468 $plugin_url = FrmAppHelper::plugin_url();
656 469 $version = FrmAppHelper::plugin_version();
657 470
@@ -656,17 +469,8 @@
656 469 $version = FrmAppHelper::plugin_version();
657 470
658 471 FrmAppHelper::load_admin_wide_js();
659 472
660 - // Register component assets early to ensure they can be enqueued later in controllers.
661 - wp_register_style( 'formidable-animations', $plugin_url . '/css/admin/animations.css', array(), $version );
662 -
663 - if ( class_exists( 'FrmOverlayController' ) ) {
664 - // This should always exist.
665 - // But it may not have loaded properly when updating the plugin.
666 - FrmOverlayController::register_assets();
667 - }
668 -
669 473 wp_register_style( 'formidable_admin_global', $plugin_url . '/css/admin/frm_admin_global.css', array(), $version );
670 474 wp_enqueue_style( 'formidable_admin_global' );
671 475
672 476 wp_register_style( 'formidable-admin', $plugin_url . '/css/frm_admin.css', array(), $version );
@@ -676,16 +480,13 @@
676 480 wp_register_script( 'formidable_embed', $plugin_url . '/js/admin/embed.js', array( 'formidable_dom', 'jquery-ui-autocomplete' ), $version, true );
677 481 self::register_popper1();
678 482 wp_register_script( 'bootstrap_tooltip', $plugin_url . '/js/bootstrap.min.js', array( 'jquery', 'popper' ), '4.6.1', true );
679 483
680 - $settings_js_vars = array(
681 - 'currencies' => FrmCurrencyHelper::get_currencies(),
682 - );
683 - wp_register_script( 'formidable_settings', $plugin_url . '/js/admin/settings.js', array(), $version, true );
684 - wp_localize_script( 'formidable_settings', 'frmSettings', $settings_js_vars );
484 + $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
685 485
686 - if ( self::should_show_floating_links() ) {
687 - self::enqueue_floating_links( $plugin_url, $version );
486 + if ( 'formidable-applications' === $page ) {
487 + FrmApplicationsController::load_assets();
488 + return;
688 489 }
689 490
690 491 $dependencies = array(
691 492 'formidable_admin_global',
@@ -695,16 +496,14 @@
695 496 'jquery-ui-sortable',
696 497 'bootstrap_tooltip',
697 498 'bootstrap-multiselect',
698 499 'wp-i18n',
699 - // Required in WP versions older than 5.7
700 - 'wp-hooks',
500 + 'wp-hooks', // Required in WP versions older than 5.7
701 501 'formidable_dom',
702 502 'formidable_embed',
703 503 );
704 504
705 - if ( FrmAppHelper::is_style_editor_page( 'edit' ) ) {
706 - // We only need to load the color picker when editing styles.
505 + if ( FrmAppHelper::is_style_editor_page() ) {
707 506 $dependencies[] = 'wp-color-picker';
708 507 }
709 508
710 509 wp_register_script( 'formidable_admin', $plugin_url . '/js/formidable_admin.js', $dependencies, $version, true );
@@ -715,40 +514,24 @@
715 514 }
716 515
717 516 wp_register_script( 'bootstrap-multiselect', $plugin_url . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip', 'popper' ), '1.1.1', true );
718 517
719 - if ( ! class_exists( 'FrmTransHooksController', false ) ) {
720 - /**
721 - * Gateway fields are included for add-on compatibility but we do not want it to be visible.
722 - * They do however need to be visible when the payments submodule is active.
723 - */
724 - wp_add_inline_style(
725 - 'formidable-admin',
726 - '#frm_builder_page li[data-ftype="gateway"] { display: none; }'
727 - );
728 - }
729 -
730 - $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
731 518 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
732 519
733 520 global $pagenow;
734 521 if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow === 'edit.php' && $post_type === 'frm_display' ) ) {
735 - self::enqueue_global_settings_scripts( $page );
736 522
737 523 wp_enqueue_script( 'admin-widgets' );
738 524 wp_enqueue_style( 'widgets' );
739 525 self::maybe_deregister_popper2();
740 526 wp_enqueue_script( 'formidable_admin' );
741 - wp_set_script_translations( 'formidable_admin', 'formidable' );
742 527 wp_enqueue_script( 'formidable_embed' );
743 - wp_set_script_translations( 'formidable_embed', 'formidable' );
744 528 FrmAppHelper::localize_script( 'admin' );
745 529
746 - wp_enqueue_style( 'formidable-animations' );
747 530 wp_enqueue_style( 'formidable-admin' );
748 531 if ( 'formidable-styles' !== $page && 'formidable-styles2' !== $page ) {
749 532 wp_enqueue_style( 'formidable-grids' );
750 - self::maybe_enqueue_dropzone_css( $page );
533 + wp_enqueue_style( 'formidable-dropzone' );
751 534 } else {
752 535 wp_enqueue_style( 'formidable-grids' );
753 536 }
754 537
@@ -754,12 +537,8 @@
754 537
755 538 if ( 'formidable-entries' === $page ) {
756 539 // Load front end js for entries.
757 540 wp_enqueue_script( 'formidable' );
758 -
759 - // Registers and enqueues the entries page scripts.
760 - wp_register_script( 'formidable_entries', $plugin_url . '/js/admin/entries.js', array( 'formidable_admin', 'wp-dom-ready' ), $version, true );
761 - wp_enqueue_script( 'formidable_entries' );
762 541 }
763 542
764 543 do_action( 'frm_enqueue_builder_scripts' );
765 544 self::include_upgrade_overlay();
@@ -777,148 +556,22 @@
777 556 return;
778 557 }
779 558
780 559 if ( $post_type === 'frm_display' ) {
781 - self::enqueue_legacy_views_assets();
560 + wp_enqueue_style( 'formidable-grids' );
561 + wp_enqueue_script( 'jquery-ui-draggable' );
562 + self::maybe_deregister_popper2();
563 + wp_enqueue_script( 'formidable_admin' );
564 + wp_enqueue_style( 'formidable-admin' );
565 + FrmAppHelper::localize_script( 'admin' );
566 + self::include_info_overlay();
782 567 }
783 - }//end if
784 -
785 - if ( 'formidable-addons' === $page ) {
786 - wp_register_script( 'formidable_addons', $plugin_url . '/js/admin/addons.js', array( 'formidable_admin', 'wp-dom-ready' ), $version, true );
787 - wp_enqueue_script( 'formidable_addons' );
788 568 }
789 569
790 - self::enqueue_builder_assets( $plugin_url, $version );
791 - }
792 -
793 - /**
794 - * Enqueue the Form Builder assets.
795 - *
796 - * @since 6.24
797 - *
798 - * @param string $plugin_url The plugin URL.
799 - * @param string $version The plugin version.
800 - * @return void
801 - */
802 - private static function enqueue_builder_assets( $plugin_url, $version ) {
803 - wp_register_style( 'formidable-settings-components', $plugin_url . '/css/admin/frm-settings-components.css', array( 'formidable-admin', 'formidable-grids' ), $version );
804 - wp_register_script( 'formidable-settings-components', $plugin_url . '/js/formidable-settings-components.js', array( 'formidable_admin' ), $version, true );
805 -
806 - if ( ! FrmAppHelper::is_form_builder_page() ) {
807 - return;
808 - }
809 -
810 - wp_enqueue_style( 'formidable-settings-components' );
811 - wp_enqueue_script( 'formidable-settings-components' );
812 - }
813 -
814 - /**
815 - * Enqueues global settings scripts.
816 - *
817 - * @param string $page The `page` param in URL.
818 - */
819 - private static function enqueue_global_settings_scripts( $page ) {
820 - if ( 'formidable-settings' === $page ) {
821 - wp_enqueue_style( 'wp-color-picker' );
822 - wp_enqueue_script( 'formidable_settings' );
823 - }
824 - }
825 -
826 - /**
827 - * Avoid loading dropzone CSS on the form list page. It isn't required there.
828 - *
829 - * @since 6.11
830 - *
831 - * @param string $page
832 - * @return void
833 - */
834 - private static function maybe_enqueue_dropzone_css( $page ) {
835 - if ( ! FrmAppHelper::pro_is_installed() ) {
836 - return;
837 - }
838 -
839 - $should_avoid_loading_dropzone = 'formidable' === $page && ! FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
840 - if ( ! $should_avoid_loading_dropzone ) {
841 - wp_enqueue_style( 'formidable-dropzone' );
842 - }
843 - }
844 -
845 - /**
846 - * The floating links are not shown on every page.
847 - * They are also not shown if white labeling is being used.
848 - *
849 - * @since 6.8.4
850 - *
851 - * @return bool
852 - */
853 - private static function should_show_floating_links() {
854 - if ( ! FrmAppHelper::is_formidable_branding() ) {
855 - return false;
856 - }
857 -
858 - return FrmAppHelper::is_formidable_admin() &&
859 - ! FrmAppHelper::is_style_editor_page() &&
860 - ! FrmAppHelper::is_admin_page( 'formidable-views-editor' ) &&
861 - ! FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
862 - }
863 -
864 - /**
865 - * @since 6.3.2
866 - *
867 - * @return void
868 - */
869 - public static function admin_enqueue_scripts() {
870 - self::load_wp_admin_style();
871 570 self::maybe_force_formidable_block_on_gutenberg_page();
872 -
873 - if ( FrmAppHelper::is_admin_page( 'formidable-settings' ) ) {
874 - wp_enqueue_style( FrmDashboardController::PAGE_SLUG, FrmAppHelper::plugin_url() . '/css/admin/dashboard.css', array(), FrmAppHelper::plugin_version() );
875 - }
876 -
877 - FrmUsageController::load_scripts();
878 571 }
879 572
880 573 /**
881 - * Enqueue required assets for the Legacy Views editor (Views v4.x).
882 - *
883 - * @since 6.1.2
884 - *
885 - * @return void
886 - */
887 - private static function enqueue_legacy_views_assets() {
888 - wp_enqueue_style( 'formidable-grids' );
889 - wp_enqueue_script( 'jquery-ui-draggable' );
890 - self::maybe_deregister_popper2();
891 - wp_enqueue_script( 'formidable_admin' );
892 - wp_add_inline_style(
893 - 'formidable-admin',
894 - '
895 - .frm-white-body.post-type-frm_display .columns-2 {
896 - display: block;
897 - overflow: visible;
898 - }
899 -
900 - .frm-white-body.post-type-frm_display .columns-2 > div {
901 - overflow-y: hidden;
902 - }
903 -
904 - .frm-white-body.post-type-frm_display #titlediv #title-prompt-text {
905 - padding: 3px 0 0 10px;
906 - }
907 -
908 - .post-type-frm_display #field-search-input,
909 - .post-type-frm_display #advanced-search-input {
910 - flex: 1;
911 - }
912 - '
913 - );
914 - wp_enqueue_style( 'formidable-admin' );
915 - wp_enqueue_script( 'formidable_legacy_views', FrmAppHelper::plugin_url() . '/js/admin/legacy-views.js', array( 'jquery', 'formidable_admin' ), FrmAppHelper::plugin_version() );
916 - FrmAppHelper::localize_script( 'admin' );
917 - self::include_info_overlay();
918 - }
919 -
920 - /**
921 574 * Fix a Duplicator Pro conflict because it uses Popper 2. See issue #3459.
922 575 *
923 576 * @since 5.2.02.01
924 577 *
@@ -945,45 +598,12 @@
945 598 *
946 599 * @return void
947 600 */
948 601 private static function register_popper1() {
949 - if ( ! self::should_register_popper() ) {
950 - return;
951 - }
952 602 wp_register_script( 'popper', FrmAppHelper::plugin_url() . '/js/popper.min.js', array( 'jquery' ), '1.16.0', true );
953 603 }
954 604
955 605 /**
956 - * Only register popper on Formidable pages.
957 - * This helps to avoid popper conflicts on other plugin pages, including the WP Bakery page editor.
958 - *
959 - * @since 6.11.1
960 - *
961 - * @return bool
962 - */
963 - private static function should_register_popper() {
964 - global $pagenow;
965 -
966 - $post_id = FrmAppHelper::simple_get( 'post', 'absint' );
967 - if ( 'post.php' === $pagenow && $post_id && 'frm_display' === get_post_type( $post_id ) ) {
968 - return true;
969 - }
970 -
971 - $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
972 - $is_views_post_type = 'frm_display' === $post_type;
973 - if ( in_array( $pagenow, array( 'post-new.php', 'edit.php' ), true ) && $is_views_post_type ) {
974 - return true;
975 - }
976 -
977 - $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
978 - if ( strpos( $page, 'formidable' ) === 0 ) {
979 - return true;
980 - }
981 -
982 - return in_array( $pagenow, array( 'term.php', 'edit-tags.php' ), true ) && FrmAppHelper::simple_get( 'taxonomy' ) === 'frm_application';
983 - }
984 -
985 - /**
986 606 * Automatically insert a Formidable block when loading Gutenberg when $_GET['frmForm' is set.
987 607 *
988 608 * @since 5.2
989 609 *
@@ -1005,12 +625,8 @@
1005 625
1006 626 /**
1007 627 * @since 5.3
1008 628 *
1009 - * @param string $block_name
1010 - * @param string $object_key
1011 - * @param array|string $object_id
1012 - *
1013 629 * @return void
1014 630 */
1015 631 public static function add_js_to_inject_gutenberg_block( $block_name, $object_key, $object_id ) {
1016 632 require FrmAppHelper::plugin_path() . '/classes/views/shared/edit-page-js.php';
@@ -1015,11 +631,8 @@
1015 631 public static function add_js_to_inject_gutenberg_block( $block_name, $object_key, $object_id ) {
1016 632 require FrmAppHelper::plugin_path() . '/classes/views/shared/edit-page-js.php';
1017 633 }
1018 634
1019 - /**
1020 - * @return void
1021 - */
1022 635 public static function load_lang() {
1023 636 load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
1024 637 }
1025 638
@@ -1026,10 +639,8 @@
1026 639 /**
1027 640 * Check if the styles are updated when a form is loaded on the front-end
1028 641 *
1029 642 * @since 3.0.1
1030 - *
1031 - * @return void
1032 643 */
1033 644 public static function maybe_update_styles() {
1034 645 if ( self::needs_update() ) {
1035 646 self::network_upgrade_site();
@@ -1037,23 +648,21 @@
1037 648 }
1038 649
1039 650 /**
1040 651 * @since 3.0
1041 - *
1042 - * @return void
1043 652 */
1044 653 public static function create_rest_routes() {
1045 654 $args = array(
1046 - 'methods' => 'GET',
1047 - 'callback' => 'FrmAppController::api_install',
1048 - 'permission_callback' => self::class . '::can_update_db',
655 + 'methods' => 'GET',
656 + 'callback' => 'FrmAppController::api_install',
657 + 'permission_callback' => __CLASS__ . '::can_update_db',
1049 658 );
1050 659
1051 660 register_rest_route( 'frm-admin/v1', '/install', $args );
1052 661
1053 662 $args = array(
1054 - 'methods' => 'GET',
1055 - 'callback' => 'FrmAddonsController::install_addon_api',
663 + 'methods' => 'GET',
664 + 'callback' => 'FrmAddonsController::install_addon_api',
1056 665 'permission_callback' => 'FrmAddonsController::can_install_addon_api',
1057 666 );
1058 667
1059 668 register_rest_route( 'frm-admin/v1', '/install-addon', $args );
@@ -1075,10 +684,8 @@
1075 684 *
1076 685 * @since 2.0.1
1077 686 *
1078 687 * @param int $blog_id Blog ID.
1079 - *
1080 - * @return void
1081 688 */
1082 689 public static function network_upgrade_site( $blog_id = 0 ) {
1083 690 // Flag to check if install is happening as intended.
1084 691 set_transient( 'frm_updating_api', true, MINUTE_IN_SECONDS );
@@ -1102,10 +709,8 @@
1102 709
1103 710 /**
1104 711 * Make sure WP_Site_Health has been included because it is required when calling rest_do_request.
1105 712 * Check first that the file exists because WP_Site_Health was only introduced in WordPress 5.2.
1106 - *
1107 - * @return void
1108 713 */
1109 714 private static function maybe_add_wp_site_health() {
1110 715 if ( ! class_exists( 'WP_Site_Health' ) ) {
1111 716 $wp_site_health_path = ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
@@ -1116,10 +721,8 @@
1116 721 }
1117 722
1118 723 /**
1119 724 * @since 3.0
1120 - *
1121 - * @return true
1122 725 */
1123 726 public static function api_install() {
1124 727 delete_transient( 'frm_updating_api' );
1125 728 if ( self::needs_update() ) {
@@ -1138,10 +741,8 @@
1138 741 * Silent database upgrade (no redirect).
1139 742 * Called via ajax request during network upgrade process.
1140 743 *
1141 744 * @since 2.0.1
1142 - *
1143 - * @return void
1144 745 */
1145 746 public static function ajax_install() {
1146 747 FrmAppHelper::permission_check( 'frm_change_settings' );
1147 748 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -1148,19 +749,13 @@
1148 749 self::api_install();
1149 750 wp_die();
1150 751 }
1151 752
1152 - /**
1153 - * @return void
1154 - */
1155 753 public static function install() {
1156 754 $frmdb = new FrmMigrate();
1157 755 $frmdb->upgrade();
1158 756 }
1159 757
1160 - /**
1161 - * @return void
1162 - */
1163 758 public static function uninstall() {
1164 759 FrmAppHelper::permission_check( 'administrator' );
1165 760 check_ajax_referer( 'frm_ajax', 'nonce' );
1166 761
@@ -1166,9 +761,9 @@
1166 761
1167 762 $frmdb = new FrmMigrate();
1168 763 $frmdb->uninstall();
1169 764
1170 - // Disable the plugin and redirect after uninstall so the tables don't get added right back.
765 + //disable the plugin and redirect after uninstall so the tables don't get added right back
1171 766 $plugins = array( FrmAppHelper::plugin_folder() . '/formidable.php', 'formidable-pro/formidable-pro.php' );
1172 767 deactivate_plugins( $plugins, false, false );
1173 768 echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
1174 769
@@ -1184,11 +779,8 @@
1184 779
1185 780 return $tables;
1186 781 }
1187 782
1188 - /**
1189 - * @return void
1190 - */
1191 783 public static function deauthorize() {
1192 784 FrmAppHelper::permission_check( 'frm_change_settings' );
1193 785 check_ajax_referer( 'frm_ajax', 'nonce' );
1194 786
@@ -1198,33 +790,8 @@
1198 790 delete_site_option( 'frmpro-authorized' );
1199 791 wp_die();
1200 792 }
1201 793
1202 - /**
1203 - * This is triggered when Formidable is activated.
1204 - *
1205 - * @return void
1206 - */
1207 - public static function handle_activation() {
1208 - self::maybe_activate_payment_cron();
1209 - }
1210 -
1211 - /**
1212 - * The payment cron is unscheduled when Formidable is deactivated.
1213 - * We need to add it back again on activation if Stripe is configured.
1214 - *
1215 - * @since 6.5
1216 - *
1217 - * @return void
1218 - */
1219 - private static function maybe_activate_payment_cron() {
1220 - if ( ! FrmStrpLiteConnectHelper::stripe_connect_is_setup() ) {
1221 - return;
1222 - }
1223 -
1224 - FrmTransLiteAppController::maybe_schedule_cron();
1225 - }
1226 -
1227 794 public static function set_footer_text( $text ) {
1228 795 if ( FrmAppHelper::is_formidable_admin() ) {
1229 796 $text = '';
1230 797 }
@@ -1232,334 +799,56 @@
1232 799 return $text;
1233 800 }
1234 801
1235 802 /**
1236 - * Add admin footer links.
1237 - *
1238 - * @since 6.4.1
1239 - *
1240 - * @return void
803 + * @deprecated 1.07.05
804 + * @codeCoverageIgnore
1241 805 */
1242 - public static function add_admin_footer_links() {
1243 - FrmFormsController::include_device_too_small_message();
1244 - if ( self::should_show_footer_links() ) {
1245 - include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php';
1246 - }
806 + public static function get_form_shortcode( $atts ) {
807 + return FrmDeprecated::get_form_shortcode( $atts );
1247 808 }
1248 809
1249 810 /**
1250 - * Check if the footer links should be shown.
1251 - *
1252 - * @since 6.7
1253 - *
1254 - * @return bool
811 + * @deprecated 2.5.4
812 + * @codeCoverageIgnore
1255 813 */
1256 - private static function should_show_footer_links() {
1257 - $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
1258 - $is_formidable_page = FrmAppHelper::is_formidable_admin() || 'frm_logs' === $post_type;
1259 - $show_footer_links = $is_formidable_page;
1260 - if ( FrmAppHelper::is_full_screen() || ! FrmAppHelper::is_formidable_branding() ) {
1261 - $show_footer_links = false;
1262 - }
1263 -
1264 - /**
1265 - * Filter whether to show the Formidable footer links.
1266 - *
1267 - * @since 6.7
1268 - *
1269 - * @param bool $show_footer_links
1270 - * @return bool
1271 - */
1272 - return apply_filters( 'frm_show_footer_links', $show_footer_links );
814 + public static function widget_text_filter( $content ) {
815 + return FrmDeprecated::widget_text_filter( $content );
1273 816 }
1274 817
1275 818 /**
1276 - * Show an error modal and terminate the script execution.
819 + * Deprecated in favor of wpmu_upgrade_site
1277 820 *
1278 - * @since 6.7
1279 - *
1280 - * @param array $error_args Arguments that control the behavior of the error modal.
1281 - *
1282 - * @return void
821 + * @deprecated 2.3
822 + * @codeCoverageIgnore
1283 823 */
1284 - public static function show_error_modal( $error_args ) {
1285 - add_filter( 'frm_show_footer_links', '__return_false' );
1286 -
1287 - $defaults = array(
1288 - 'title' => '',
1289 - 'body' => '',
1290 - 'cancel_url' => '',
1291 - 'cancel_classes' => '',
1292 - 'continue_url' => '',
1293 - 'continue_classes' => '',
1294 - 'icon' => 'frm_lock_simple',
1295 - );
1296 -
1297 - $error_args = wp_parse_args( $error_args, $defaults );
1298 - if ( ! isset( $error_args['cancel_text'] ) && ! empty( $error_args['cancel_url'] ) ) {
1299 - $error_args['cancel_text'] = __( 'Cancel', 'formidable' );
1300 - }
1301 -
1302 - if ( ! isset( $error_args['continue_text'] ) && ! empty( $error_args['continue_url'] ) ) {
1303 - $error_args['continue_text'] = __( 'Continue', 'formidable' );
1304 - }
1305 -
1306 - include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/error-modal.php';
824 + public static function front_head() {
825 + FrmDeprecated::front_head();
1307 826 }
1308 827
1309 828 /**
1310 - * Handles Floating Links' scripts and styles enqueueing.
1311 - *
1312 - * @since 6.4
1313 - *
1314 - * @param string $plugin_url URL of the plugin.
1315 - * @param string $version Current version of the plugin.
1316 - * @return void
829 + * @deprecated 3.0.04
830 + * @codeCoverageIgnore
1317 831 */
1318 - private static function enqueue_floating_links( $plugin_url, $version ) {
1319 - if ( ! $plugin_url || ! $version ) {
1320 - // If any required parameters are missing, exit early.
1321 - return;
1322 - }
1323 -
1324 - // Enqueue the Floating Links styles.
1325 - wp_enqueue_style( 's11-floating-links', $plugin_url . '/css/packages/s11-floating-links.css', array(), $version );
1326 -
1327 - // Enqueue the Floating Links script.
1328 - wp_enqueue_script( 's11-floating-links', $plugin_url . '/js/packages/floating-links/s11-floating-links.js', array( 'formidable_admin' ), $version, true );
1329 -
1330 - // Enqueue the config script.
1331 - wp_enqueue_script( 's11-floating-links-config', $plugin_url . '/js/packages/floating-links/config.js', array( 'wp-i18n' ), $version, true );
1332 -
1333 - if ( function_exists( 'wp_set_script_translations' ) ) {
1334 - wp_set_script_translations( 's11-floating-links-config', 's11-' );
1335 - }
1336 -
1337 - $floating_links_data = array(
1338 - 'proIsInstalled' => FrmAppHelper::pro_is_installed(),
1339 - );
1340 - wp_localize_script( 's11-floating-links-config', 's11FloatingLinksData', $floating_links_data );
1341 -
1342 - /**
1343 - * Prompt Pro to load additional floating links scripts.
1344 - * This is used to include images in the Inbox SlideIn when Pro is active.
1345 - *
1346 - * @since 6.8.4
1347 - */
1348 - do_action( 'frm_enqueue_floating_links' );
832 + public static function activation_install() {
833 + FrmDeprecated::activation_install();
1349 834 }
1350 835
1351 836 /**
1352 - * Check if we are in our admin pages.
1353 - *
1354 - * @return bool
837 + * @deprecated 3.0
838 + * @codeCoverageIgnore
1355 839 */
1356 - private static function in_our_pages() {
1357 - global $current_screen, $pagenow;
1358 - if ( FrmAppHelper::is_formidable_admin() ) {
1359 - return true;
1360 - }
1361 -
1362 - if ( ! empty( $current_screen->post_type ) && 'frm_logs' === $current_screen->post_type ) {
1363 - return true;
1364 - }
1365 -
1366 - if ( in_array( $pagenow, array( 'term.php', 'edit-tags.php' ), true ) && 'frm_application' === FrmAppHelper::simple_get( 'taxonomy' ) ) {
1367 - return true;
1368 - }
1369 -
1370 - return false;
840 + public static function page_route( $content ) {
841 + return FrmDeprecated::page_route( $content );
1371 842 }
1372 843
1373 844 /**
1374 - * Handles actions related to the current screen.
845 + * Include icons on page for Embed Form modal.
1375 846 *
1376 - * @since 6.19
847 + * @since 5.2
1377 848 *
1378 849 * @return void
1379 850 */
1380 - public static function handle_current_screen() {
1381 - if ( ! self::in_our_pages() ) {
1382 - return;
1383 - }
1384 -
1385 - self::filter_admin_notices();
1386 - self::remember_custom_sort();
1387 - }
1388 -
1389 - /**
1390 - * Hide all third-parties admin notices only in our admin pages.
1391 - *
1392 - * @return void
1393 - */
1394 - public static function filter_admin_notices() {
1395 - $actions = array(
1396 - 'admin_notices',
1397 - 'network_admin_notices',
1398 - 'user_admin_notices',
1399 - 'all_admin_notices',
1400 - );
1401 -
1402 - global $wp_filter;
1403 -
1404 - foreach ( $actions as $action ) {
1405 - if ( empty( $wp_filter[ $action ]->callbacks ) ) {
1406 - continue;
1407 - }
1408 - foreach ( $wp_filter[ $action ]->callbacks as $priority => $callbacks ) {
1409 - foreach ( $callbacks as $callback_name => $callback ) {
1410 - if ( self::is_our_callback_string( $callback_name ) || self::is_our_callback_array( $callback ) ) {
1411 - continue;
1412 - }
1413 - unset( $wp_filter[ $action ]->callbacks[ $priority ][ $callback_name ] );
1414 - }
1415 - }
1416 - }
1417 - }
1418 -
1419 - /**
1420 - * Remembers and applies user-specific sorting preferences.
1421 - *
1422 - * @return void
1423 - */
1424 - private static function remember_custom_sort() {
1425 - $screen = get_current_screen();
1426 - if ( ! $screen ) {
1427 - return;
1428 - }
1429 -
1430 - if ( ! FrmAppHelper::is_admin_list_page() && ! FrmAppHelper::is_admin_list_page( 'formidable-entries' ) ) {
1431 - return;
1432 - }
1433 -
1434 - $orderby = FrmAppHelper::get_param( 'orderby' );
1435 -
1436 - if ( ! $orderby ) {
1437 - return;
1438 - }
1439 -
1440 - $user_id = get_current_user_id();
1441 - $meta_key = 'frm_preferred_list_sort_' . $screen->id;
1442 - $order = FrmAppHelper::get_param( 'order' );
1443 -
1444 - $new_sort = array(
1445 - 'orderby' => $orderby,
1446 - 'order' => $order,
1447 - );
1448 -
1449 - $current_sort = get_user_meta( $user_id, $meta_key, true );
1450 -
1451 - if ( $new_sort !== $current_sort ) {
1452 - update_user_meta(
1453 - $user_id,
1454 - $meta_key,
1455 - array(
1456 - 'orderby' => $orderby,
1457 - 'order' => $order,
1458 - )
1459 - );
1460 - }
1461 - }
1462 -
1463 - /**
1464 - * Retrieve and apply any saved sorting preferences for the current screen.
1465 - *
1466 - * @since 6.19
1467 - *
1468 - * @param string &$orderby Reference to the current 'orderby' parameter.
1469 - * @param string &$order Reference to the current 'order' parameter.
1470 - * @return void
1471 - */
1472 - public static function apply_saved_sort_preference( &$orderby, &$order ) {
1473 - if ( ! function_exists( 'get_current_screen' ) ) {
1474 - return;
1475 - }
1476 -
1477 - $screen = get_current_screen();
1478 - if ( ! $screen ) {
1479 - return;
1480 - }
1481 -
1482 - $user_id = get_current_user_id();
1483 - $preferred_list_sort = get_user_meta( $user_id, 'frm_preferred_list_sort_' . $screen->id, true );
1484 -
1485 - if ( is_array( $preferred_list_sort ) && ! empty( $preferred_list_sort['orderby'] ) ) {
1486 - $orderby = $preferred_list_sort['orderby'];
1487 -
1488 - if ( ! empty( $preferred_list_sort['order'] ) ) {
1489 - $order = $preferred_list_sort['order'];
1490 - }
1491 - }
1492 - }
1493 -
1494 - /**
1495 - * Validate that the callback name is ours not from third-party.
1496 - *
1497 - * @param string $callback_name WordPress callback name.
1498 - *
1499 - * @return bool
1500 - */
1501 - private static function is_our_callback_string( $callback_name ) {
1502 - return 0 === stripos( $callback_name, 'frm' );
1503 - }
1504 -
1505 - /**
1506 - * Validate that the callback array is ours not from third-party.
1507 - *
1508 - * @param array $callback WordPress callback array.
1509 - *
1510 - * @return bool
1511 - */
1512 - private static function is_our_callback_array( $callback ) {
1513 - return ! empty( $callback['function'] ) &&
1514 - is_array( $callback['function'] ) &&
1515 - ! empty( $callback['function'][0] ) &&
1516 - self::is_our_callback_string( is_object( $callback['function'][0] ) ? get_class( $callback['function'][0] ) : $callback['function'][0] );
1517 - }
1518 -
1519 - /**
1520 - * In some cases, the DB tables may fail to install.
1521 - * This function tries to add them again when the user clicks the link to try again
1522 - * from the given inbox notice.
1523 - *
1524 - * @since 6.19
1525 - */
1526 - private static function add_missing_tables() {
1527 - FrmAppHelper::permission_check( 'frm_view_forms' );
1528 -
1529 - $inbox = new FrmInbox();
1530 - $error = $inbox->check_for_error();
1531 -
1532 - if ( ! $error || 'failed-to-create-tables' !== $error['key'] ) {
1533 - // Confirm the inbox item with this CTA exists.
1534 - wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
1535 - exit;
1536 - }
1537 -
1538 - global $wpdb;
1539 - $exists = $wpdb->get_results( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->prefix . 'frm_forms' ) );
1540 -
1541 - if ( $exists ) {
1542 - // Exit early if the table already exists.
1543 - wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
1544 - exit;
1545 - }
1546 -
1547 - delete_option( 'frm_db_version' );
1548 - wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
1549 - exit;
1550 - }
1551 -
1552 - /**
1553 - * Handles the small screen proceed action.
1554 - *
1555 - * @since 6.21
1556 - *
1557 - * @return void
1558 - */
1559 - public static function small_screen_proceed() {
1560 - FrmAppHelper::permission_check( 'frm_view_forms' );
1561 - check_ajax_referer( 'frm_ajax', 'nonce' );
1562 - update_user_option( get_current_user_id(), 'frm_ignore_small_screen_warning', true );
1563 - wp_send_json_success();
851 + public static function include_embed_form_icons() {
852 + _deprecated_function( __METHOD__, '5.3' );
1564 853 }
1565 854 }