PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.4
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.4
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 +132 -895 6.25.15.4 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,58 +58,17 @@
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 - if ( ! FrmAppHelper::pro_is_installed() ) {
87 - $classes .= ' frm-lite ';
88 - }
89 -
90 - if ( get_user_setting( 'unfold' ) && 'f' !== get_user_setting( 'mfold' ) ) {
91 - $classes .= ' frm-unfold ';
92 - }
93 -
94 66 return $classes;
95 67 }
96 68
97 69 /**
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 70 * @since 4.0
118 - *
119 - * @return string
120 71 */
121 72 private static function get_os() {
122 73 $agent = strtolower( FrmAppHelper::get_server_value( 'HTTP_USER_AGENT' ) );
123 74 $os = '';
@@ -138,9 +89,9 @@
138 89 $white_pages = array(
139 90 'formidable',
140 91 'formidable-entries',
141 92 'formidable-views',
142 - 'formidable-views-editor',
93 + 'formidable-pro-upgrade',
143 94 'formidable-addons',
144 95 'formidable-import',
145 96 'formidable-settings',
146 97 'formidable-styles',
@@ -145,25 +96,20 @@
145 96 'formidable-settings',
146 97 'formidable-styles',
147 98 'formidable-styles2',
148 99 'formidable-inbox',
149 - FrmFormTemplatesController::PAGE_SLUG,
150 - FrmOnboardingWizardController::PAGE_SLUG,
100 + 'formidable-welcome',
101 + 'formidable-applications',
151 102 );
152 103
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.
104 + $get_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
105 + $is_white_page = in_array( $get_page, $white_pages, true );
156 106
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 - }
107 + if ( ! $is_white_page ) {
108 + $screen = get_current_screen();
109 + $is_white_page = ( $screen && strpos( $screen->id, 'frm_display' ) !== false );
162 110 }
163 111
164 - $is_white_page = self::is_page_in_list( $white_pages ) || self::is_grey_page() || FrmAppHelper::is_view_builder_page();
165 -
166 112 /**
167 113 * Allow another add on to style a page as a Formidable "white page", which adds a white background color.
168 114 *
169 115 * @since 5.3
@@ -174,62 +120,12 @@
174 120
175 121 return $is_white_page;
176 122 }
177 123
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 124 public static function load_wp_admin_style() {
220 125 FrmAppHelper::load_font_style();
221 126 }
222 127
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 128 public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
233 129 $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
234 130 if ( empty( $show_nav ) || ! $form ) {
235 131 return;
@@ -243,14 +139,11 @@
243 139 $id = $form->id;
244 140 $current_page = self::get_current_page();
245 141 $nav_items = self::get_form_nav_items( $form );
246 142
247 - include FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php';
143 + include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
248 144 }
249 145
250 - /**
251 - * @return string
252 - */
253 146 private static function get_current_page() {
254 147 $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
255 148 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
256 149 $current_page = isset( $_GET['page'] ) ? $page : $post_type;
@@ -261,12 +154,8 @@
261 154
262 155 return $current_page;
263 156 }
264 157
265 - /**
266 - * @param object $form
267 - * @return array
268 - */
269 158 private static function get_form_nav_items( $form ) {
270 159 $id = $form->parent_form_id ? $form->parent_form_id : $form->id;
271 160
272 161 $nav_items = array(
@@ -277,15 +166,8 @@
277 166 'page' => 'formidable',
278 167 'permission' => 'frm_edit_forms',
279 168 ),
280 169 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 170 'link' => admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . absint( $id ) ),
289 171 'label' => __( 'Settings', 'formidable' ),
290 172 'current' => array( 'settings' ),
291 173 'page' => 'formidable',
@@ -291,9 +173,9 @@
291 173 'page' => 'formidable',
292 174 'permission' => 'frm_edit_forms',
293 175 ),
294 176 array(
295 - 'link' => admin_url( 'admin.php?page=formidable-entries&frm_action=list&form=' . absint( $id ) ),
177 + 'link' => admin_url( 'admin.php?page=formidable-entries&frm-full=1&frm_action=list&form=' . absint( $id ) ),
296 178 'label' => __( 'Entries', 'formidable' ),
297 179 'current' => array(),
298 180 'page' => 'formidable-entries',
299 181 'permission' => 'frm_view_entries',
@@ -299,18 +181,18 @@
299 181 'permission' => 'frm_view_entries',
300 182 ),
301 183 );
302 184
303 - $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) && FrmProAppHelper::views_is_installed();
185 + $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) ? FrmProAppHelper::views_is_installed() : FrmAppHelper::pro_is_installed();
304 186
305 187 if ( ! $views_installed ) {
306 188 $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',
189 + 'link' => admin_url( 'admin.php?page=formidable-views&frm-full=1&form=' . absint( $id ) ),
190 + 'label' => __( 'Views', 'formidable' ),
191 + 'current' => array(),
192 + 'page' => 'formidable-views',
311 193 'permission' => 'frm_view_entries',
312 - 'atts' => array(
194 + 'atts' => array(
313 195 'class' => 'frm_noallow',
314 196 ),
315 197 );
316 198 }
@@ -317,14 +199,14 @@
317 199
318 200 // Let people know reports and views exist.
319 201 if ( ! FrmAppHelper::pro_is_installed() ) {
320 202 $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',
203 + 'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&frm-full=1&form=' . absint( $id ) ),
204 + 'label' => __( 'Reports', 'formidable' ),
205 + 'current' => array( 'reports' ),
206 + 'page' => 'formidable',
325 207 'permission' => 'frm_view_entries',
326 - 'atts' => array(
208 + 'atts' => array(
327 209 'class' => 'frm_noallow',
328 210 ),
329 211 );
330 212 }
@@ -333,38 +215,17 @@
333 215 'form_id' => $id,
334 216 'form' => $form,
335 217 );
336 218
337 - return (array) apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
219 + return apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
338 220 }
339 221
340 - /**
341 - * Adds a settings link to the plugins page
342 - *
343 - * @param array $links
344 - * @return array
345 - */
222 + // Adds a settings link to the plugins page
346 223 public static function settings_link( $links ) {
347 224 $settings = array();
348 225
349 226 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>';
227 + $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 228 }
368 229
369 230 $settings[] = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>';
370 231
@@ -370,14 +231,11 @@
370 231
371 232 return array_merge( $settings, $links );
372 233 }
373 234
374 - /**
375 - * @return void
376 - */
377 235 public static function pro_get_started_headline() {
378 236 self::review_request();
379 - FrmAppHelper::min_pro_version_notice( '6.20' );
237 + FrmAppHelper::min_pro_version_notice( '4.0' );
380 238 }
381 239
382 240 /**
383 241 * Add admin notices as needed for reviews
@@ -382,10 +240,8 @@
382 240 /**
383 241 * Add admin notices as needed for reviews
384 242 *
385 243 * @since 3.04.03
386 - *
387 - * @return void
388 244 */
389 245 private static function review_request() {
390 246 $reviews = new FrmReviews();
391 247 $reviews->review_request();
@@ -394,10 +250,8 @@
394 250 /**
395 251 * Save the request to hide the review
396 252 *
397 253 * @since 3.04.03
398 - *
399 - * @return void
400 254 */
401 255 public static function dismiss_review() {
402 256 FrmAppHelper::permission_check( 'frm_change_settings' );
403 257 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -407,10 +261,8 @@
407 261 }
408 262
409 263 /**
410 264 * @since 3.04.02
411 - *
412 - * @return void
413 265 */
414 266 public static function include_upgrade_overlay() {
415 267 self::enqueue_dialog_assets();
416 268 add_action( 'admin_footer', 'FrmAppController::upgrade_overlay_html' );
@@ -429,10 +281,8 @@
429 281 }
430 282
431 283 /**
432 284 * @since 3.06.03
433 - *
434 - * @return void
435 285 */
436 286 public static function upgrade_overlay_html() {
437 287 $is_pro = FrmAppHelper::pro_is_installed();
438 288 $upgrade_link = array(
@@ -444,39 +294,67 @@
444 294 $shared_path = $plugin_path . '/classes/views/shared/';
445 295
446 296 include $shared_path . 'upgrade_overlay.php';
447 297 include $shared_path . 'confirm-overlay.php';
298 +
299 + if ( FrmAppHelper::is_admin_page( 'formidable-welcome' ) || FrmAppHelper::on_form_listing_page() ) {
300 + self::new_form_overlay_html();
301 + }
448 302 }
449 303
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,
304 + private static function new_form_overlay_html() {
305 + FrmFormsController::before_list_templates();
306 +
307 + $plugin_path = FrmAppHelper::plugin_path();
308 + $path = $plugin_path . '/classes/views/frm-forms/';
309 + $expired = FrmFormsController::expired();
310 + $expiring = FrmAddonsController::is_license_expiring();
311 + $user = wp_get_current_user(); // $user used in leave-email.php to determine a default value for field
312 + $view_path = $path . 'new-form-overlay/';
313 + $modal_class = '';
314 + $upgrade_link = FrmAppHelper::admin_upgrade_link(
315 + array(
316 + 'medium' => 'new-template',
317 + 'content' => 'upgrade',
318 + )
464 319 );
465 - require FrmAppHelper::plugin_path() . '/classes/views/form-templates/modals/leave-email-modal.php';
320 + $renew_link = FrmAppHelper::admin_upgrade_link(
321 + array(
322 + 'medium' => 'new-template',
323 + 'content' => 'renew',
324 + )
325 + );
326 + $blocks_to_render = array();
327 +
328 + if ( ! FrmAppHelper::pro_is_installed() ) {
329 + // avoid rendering the email and code blocks for users who have upgraded or have a free license already
330 + $api = new FrmFormTemplateApi();
331 + if ( ! $api->has_free_access() ) {
332 + array_push( $blocks_to_render, 'email', 'code' );
333 + }
334 + }
335 +
336 + // avoid rendering the upgrade block for users with elite
337 + if ( 'elite' !== FrmAddonsController::license_type() ) {
338 + $blocks_to_render[] = 'upgrade';
339 + }
340 +
341 + // avoid rendering the renew block for users who are not currently expired
342 + if ( $expired ) {
343 + $blocks_to_render[] = 'renew';
344 + $modal_class = 'frm-expired';
345 + } elseif ( $expiring ) {
346 + $modal_class = 'frm-expiring';
347 + }
348 +
349 + include $path . 'new-form-overlay.php';
466 350 }
467 351
468 - /**
469 - * @return void
470 - */
471 352 public static function include_info_overlay() {
472 353 self::enqueue_dialog_assets();
473 354 add_action( 'admin_footer', 'FrmAppController::info_overlay_html' );
474 355 }
475 356
476 - /**
477 - * @return void
478 - */
479 357 public static function info_overlay_html() {
480 358 include FrmAppHelper::plugin_path() . '/classes/views/shared/info-overlay.php';
481 359 }
482 360
@@ -481,15 +359,19 @@
481 359 }
482 360
483 361 /**
484 362 * @since 3.04.02
485 - *
486 - * @return void
487 363 */
488 364 public static function remove_upsells() {
489 365 remove_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
490 - remove_action( 'frm_after_settings_tabs', 'FrmSettingsController::settings_cta' );
366 + remove_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' );
367 + remove_action( 'frm_add_form_style_tab_options', 'FrmFormsController::add_form_style_tab_options' );
491 368 remove_action( 'frm_after_field_options', 'FrmFormsController::logic_tip' );
369 +
370 + if ( is_callable( 'FrmProAddonsController::renewal_message' ) ) {
371 + // These functions moved to Pro in 4.09.01
372 + remove_action( 'frm_page_footer', 'FrmAppHelper::renewal_message' );
373 + }
492 374 }
493 375
494 376 /**
495 377 * If there are CURL problems on this server, wp_remote_post won't work for installing
@@ -495,17 +377,12 @@
495 377 * If there are CURL problems on this server, wp_remote_post won't work for installing
496 378 * Use a javascript fallback instead.
497 379 *
498 380 * @since 2.0.3
499 - *
500 - * @return void
501 381 */
502 382 public static function install_js_fallback() {
503 383 FrmAppHelper::load_admin_wide_js();
504 - ?>
505 - <div id="frm_install_message"></div>
506 - <script>jQuery(document).ready( frm_install_now );</script>
507 - <?php
384 + echo '<div id="hidden frm_install_message"></div><script type="text/javascript">jQuery(document).ready(function(){frm_install_now();});</script>';
508 385 }
509 386
510 387 /**
511 388 * Check if the database is outdated
@@ -510,9 +387,9 @@
510 387 /**
511 388 * Check if the database is outdated
512 389 *
513 390 * @since 2.0.1
514 - * @return bool
391 + * @return boolean
515 392 */
516 393 public static function needs_update() {
517 394 $needs_upgrade = self::compare_for_update(
518 395 array(
@@ -532,11 +409,8 @@
532 409 /**
533 410 * Check both version number and DB number for changes
534 411 *
535 412 * @since 3.0.04
536 - *
537 - * @param array $atts
538 - * @return bool
539 413 */
540 414 public static function compare_for_update( $atts ) {
541 415 $db_version = get_option( $atts['option'] );
542 416
@@ -555,49 +429,12 @@
555 429 /**
556 430 * Check for database update and trigger js loading
557 431 *
558 432 * @since 2.0.1
559 - *
560 - * @return void
561 433 */
562 434 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 - }
435 + new FrmPersonalData(); // register personal data hooks
566 436
567 - if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) {
568 - FrmFormsController::duplicate();
569 - }
570 -
571 - if ( FrmAppHelper::is_admin_page( 'formidable' ) && FrmAppHelper::simple_get( 'frm_add_tables' ) ) {
572 - self::add_missing_tables();
573 - }
574 -
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 - 'campaign' => '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 437 if ( ! FrmAppHelper::doing_ajax() && self::needs_update() ) {
601 438 self::network_upgrade_site();
602 439 }
603 440
@@ -605,20 +442,13 @@
605 442 // don't continue during ajax calls
606 443 self::admin_js();
607 444 }
608 445
609 - self::trigger_page_load_hooks();
610 -
611 446 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 : '';
447 + $action = FrmAppHelper::get_param( 'frm_action' );
619 448
620 - wp_safe_redirect( admin_url( 'admin.php?page=' . FrmFormTemplatesController::PAGE_SLUG . $url_param ) );
449 + if ( in_array( $action, array( 'add_new', 'list_templates' ), true ) ) {
450 + wp_safe_redirect( admin_url( 'admin.php?page=formidable&triggerNewFormModal=1' ) );
621 451 exit;
622 452 }
623 453
624 454 FrmInbox::maybe_disable_screen_options();
@@ -625,33 +455,10 @@
625 455 }
626 456 }
627 457
628 458 /**
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 459 * @return void
635 460 */
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 461 public static function admin_js() {
655 462 $plugin_url = FrmAppHelper::plugin_url();
656 463 $version = FrmAppHelper::plugin_version();
657 464
@@ -656,17 +463,8 @@
656 463 $version = FrmAppHelper::plugin_version();
657 464
658 465 FrmAppHelper::load_admin_wide_js();
659 466
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 467 wp_register_style( 'formidable_admin_global', $plugin_url . '/css/admin/frm_admin_global.css', array(), $version );
670 468 wp_enqueue_style( 'formidable_admin_global' );
671 469
672 470 wp_register_style( 'formidable-admin', $plugin_url . '/css/frm_admin.css', array(), $version );
@@ -676,16 +474,13 @@
676 474 wp_register_script( 'formidable_embed', $plugin_url . '/js/admin/embed.js', array( 'formidable_dom', 'jquery-ui-autocomplete' ), $version, true );
677 475 self::register_popper1();
678 476 wp_register_script( 'bootstrap_tooltip', $plugin_url . '/js/bootstrap.min.js', array( 'jquery', 'popper' ), '4.6.1', true );
679 477
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 );
478 + $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
685 479
686 - if ( self::should_show_floating_links() ) {
687 - self::enqueue_floating_links( $plugin_url, $version );
480 + if ( 'formidable-applications' === $page ) {
481 + FrmApplicationsController::load_assets();
482 + return;
688 483 }
689 484
690 485 $dependencies = array(
691 486 'formidable_admin_global',
@@ -695,16 +490,13 @@
695 490 'jquery-ui-sortable',
696 491 'bootstrap_tooltip',
697 492 'bootstrap-multiselect',
698 493 'wp-i18n',
699 - // Required in WP versions older than 5.7
700 - 'wp-hooks',
701 494 'formidable_dom',
702 495 'formidable_embed',
703 496 );
704 497
705 - if ( FrmAppHelper::is_style_editor_page( 'edit' ) ) {
706 - // We only need to load the color picker when editing styles.
498 + if ( FrmAppHelper::is_admin_page( 'formidable-styles' ) || FrmAppHelper::is_admin_page( 'formidable-styles2' ) ) {
707 499 $dependencies[] = 'wp-color-picker';
708 500 }
709 501
710 502 wp_register_script( 'formidable_admin', $plugin_url . '/js/formidable_admin.js', $dependencies, $version, true );
@@ -715,40 +507,24 @@
715 507 }
716 508
717 509 wp_register_script( 'bootstrap-multiselect', $plugin_url . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip', 'popper' ), '1.1.1', true );
718 510
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 511 $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
732 512
733 513 global $pagenow;
734 514 if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow === 'edit.php' && $post_type === 'frm_display' ) ) {
735 - self::enqueue_global_settings_scripts( $page );
736 515
737 516 wp_enqueue_script( 'admin-widgets' );
738 517 wp_enqueue_style( 'widgets' );
739 518 self::maybe_deregister_popper2();
740 519 wp_enqueue_script( 'formidable_admin' );
741 - wp_set_script_translations( 'formidable_admin', 'formidable' );
742 520 wp_enqueue_script( 'formidable_embed' );
743 - wp_set_script_translations( 'formidable_embed', 'formidable' );
744 521 FrmAppHelper::localize_script( 'admin' );
745 522
746 - wp_enqueue_style( 'formidable-animations' );
747 523 wp_enqueue_style( 'formidable-admin' );
748 524 if ( 'formidable-styles' !== $page && 'formidable-styles2' !== $page ) {
749 525 wp_enqueue_style( 'formidable-grids' );
750 - self::maybe_enqueue_dropzone_css( $page );
526 + wp_enqueue_style( 'formidable-dropzone' );
751 527 } else {
752 528 wp_enqueue_style( 'formidable-grids' );
753 529 }
754 530
@@ -754,12 +530,8 @@
754 530
755 531 if ( 'formidable-entries' === $page ) {
756 532 // Load front end js for entries.
757 533 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 534 }
763 535
764 536 do_action( 'frm_enqueue_builder_scripts' );
765 537 self::include_upgrade_overlay();
@@ -777,157 +549,22 @@
777 549 return;
778 550 }
779 551
780 552 if ( $post_type === 'frm_display' ) {
781 - self::enqueue_legacy_views_assets();
553 + wp_enqueue_style( 'formidable-grids' );
554 + wp_enqueue_script( 'jquery-ui-draggable' );
555 + self::maybe_deregister_popper2();
556 + wp_enqueue_script( 'formidable_admin' );
557 + wp_enqueue_style( 'formidable-admin' );
558 + FrmAppHelper::localize_script( 'admin' );
559 + self::include_info_overlay();
782 560 }
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 561 }
789 562
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 - $should_show = 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 - * Filters whether the floating links should be displayed.
865 - *
866 - * @since 6.25.1
867 - *
868 - * @param bool $should_show Whether the floating links should be shown.
869 - */
870 - return apply_filters( 'frm_should_show_floating_links', $should_show );
871 - }
872 -
873 - /**
874 - * @since 6.3.2
875 - *
876 - * @return void
877 - */
878 - public static function admin_enqueue_scripts() {
879 - self::load_wp_admin_style();
880 563 self::maybe_force_formidable_block_on_gutenberg_page();
881 -
882 - if ( FrmAppHelper::is_admin_page( 'formidable-settings' ) ) {
883 - wp_enqueue_style( FrmDashboardController::PAGE_SLUG, FrmAppHelper::plugin_url() . '/css/admin/dashboard.css', array(), FrmAppHelper::plugin_version() );
884 - }
885 -
886 - FrmUsageController::load_scripts();
887 564 }
888 565
889 566 /**
890 - * Enqueue required assets for the Legacy Views editor (Views v4.x).
891 - *
892 - * @since 6.1.2
893 - *
894 - * @return void
895 - */
896 - private static function enqueue_legacy_views_assets() {
897 - wp_enqueue_style( 'formidable-grids' );
898 - wp_enqueue_script( 'jquery-ui-draggable' );
899 - self::maybe_deregister_popper2();
900 - wp_enqueue_script( 'formidable_admin' );
901 - wp_add_inline_style(
902 - 'formidable-admin',
903 - '
904 - .frm-white-body.post-type-frm_display .columns-2 {
905 - display: block;
906 - overflow: visible;
907 - }
908 -
909 - .frm-white-body.post-type-frm_display .columns-2 > div {
910 - overflow-y: hidden;
911 - }
912 -
913 - .frm-white-body.post-type-frm_display #titlediv #title-prompt-text {
914 - padding: 3px 0 0 10px;
915 - }
916 -
917 - .post-type-frm_display #field-search-input,
918 - .post-type-frm_display #advanced-search-input {
919 - flex: 1;
920 - }
921 - '
922 - );
923 - wp_enqueue_style( 'formidable-admin' );
924 - wp_enqueue_script( 'formidable_legacy_views', FrmAppHelper::plugin_url() . '/js/admin/legacy-views.js', array( 'jquery', 'formidable_admin' ), FrmAppHelper::plugin_version() );
925 - FrmAppHelper::localize_script( 'admin' );
926 - self::include_info_overlay();
927 - }
928 -
929 - /**
930 567 * Fix a Duplicator Pro conflict because it uses Popper 2. See issue #3459.
931 568 *
932 569 * @since 5.2.02.01
933 570 *
@@ -954,45 +591,12 @@
954 591 *
955 592 * @return void
956 593 */
957 594 private static function register_popper1() {
958 - if ( ! self::should_register_popper() ) {
959 - return;
960 - }
961 595 wp_register_script( 'popper', FrmAppHelper::plugin_url() . '/js/popper.min.js', array( 'jquery' ), '1.16.0', true );
962 596 }
963 597
964 598 /**
965 - * Only register popper on Formidable pages.
966 - * This helps to avoid popper conflicts on other plugin pages, including the WP Bakery page editor.
967 - *
968 - * @since 6.11.1
969 - *
970 - * @return bool
971 - */
972 - private static function should_register_popper() {
973 - global $pagenow;
974 -
975 - $post_id = FrmAppHelper::simple_get( 'post', 'absint' );
976 - if ( 'post.php' === $pagenow && $post_id && 'frm_display' === get_post_type( $post_id ) ) {
977 - return true;
978 - }
979 -
980 - $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
981 - $is_views_post_type = 'frm_display' === $post_type;
982 - if ( in_array( $pagenow, array( 'post-new.php', 'edit.php' ), true ) && $is_views_post_type ) {
983 - return true;
984 - }
985 -
986 - $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
987 - if ( strpos( $page, 'formidable' ) === 0 ) {
988 - return true;
989 - }
990 -
991 - return in_array( $pagenow, array( 'term.php', 'edit-tags.php' ), true ) && FrmAppHelper::simple_get( 'taxonomy' ) === 'frm_application';
992 - }
993 -
994 - /**
995 599 * Automatically insert a Formidable block when loading Gutenberg when $_GET['frmForm' is set.
996 600 *
997 601 * @since 5.2
998 602 *
@@ -1014,12 +618,8 @@
1014 618
1015 619 /**
1016 620 * @since 5.3
1017 621 *
1018 - * @param string $block_name
1019 - * @param string $object_key
1020 - * @param array|string $object_id
1021 - *
1022 622 * @return void
1023 623 */
1024 624 public static function add_js_to_inject_gutenberg_block( $block_name, $object_key, $object_id ) {
1025 625 require FrmAppHelper::plugin_path() . '/classes/views/shared/edit-page-js.php';
@@ -1024,11 +624,8 @@
1024 624 public static function add_js_to_inject_gutenberg_block( $block_name, $object_key, $object_id ) {
1025 625 require FrmAppHelper::plugin_path() . '/classes/views/shared/edit-page-js.php';
1026 626 }
1027 627
1028 - /**
1029 - * @return void
1030 - */
1031 628 public static function load_lang() {
1032 629 load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
1033 630 }
1034 631
@@ -1035,10 +632,8 @@
1035 632 /**
1036 633 * Check if the styles are updated when a form is loaded on the front-end
1037 634 *
1038 635 * @since 3.0.1
1039 - *
1040 - * @return void
1041 636 */
1042 637 public static function maybe_update_styles() {
1043 638 if ( self::needs_update() ) {
1044 639 self::network_upgrade_site();
@@ -1046,23 +641,21 @@
1046 641 }
1047 642
1048 643 /**
1049 644 * @since 3.0
1050 - *
1051 - * @return void
1052 645 */
1053 646 public static function create_rest_routes() {
1054 647 $args = array(
1055 - 'methods' => 'GET',
1056 - 'callback' => 'FrmAppController::api_install',
1057 - 'permission_callback' => self::class . '::can_update_db',
648 + 'methods' => 'GET',
649 + 'callback' => 'FrmAppController::api_install',
650 + 'permission_callback' => __CLASS__ . '::can_update_db',
1058 651 );
1059 652
1060 653 register_rest_route( 'frm-admin/v1', '/install', $args );
1061 654
1062 655 $args = array(
1063 - 'methods' => 'GET',
1064 - 'callback' => 'FrmAddonsController::install_addon_api',
656 + 'methods' => 'GET',
657 + 'callback' => 'FrmAddonsController::install_addon_api',
1065 658 'permission_callback' => 'FrmAddonsController::can_install_addon_api',
1066 659 );
1067 660
1068 661 register_rest_route( 'frm-admin/v1', '/install-addon', $args );
@@ -1084,10 +677,8 @@
1084 677 *
1085 678 * @since 2.0.1
1086 679 *
1087 680 * @param int $blog_id Blog ID.
1088 - *
1089 - * @return void
1090 681 */
1091 682 public static function network_upgrade_site( $blog_id = 0 ) {
1092 683 // Flag to check if install is happening as intended.
1093 684 set_transient( 'frm_updating_api', true, MINUTE_IN_SECONDS );
@@ -1111,10 +702,8 @@
1111 702
1112 703 /**
1113 704 * Make sure WP_Site_Health has been included because it is required when calling rest_do_request.
1114 705 * Check first that the file exists because WP_Site_Health was only introduced in WordPress 5.2.
1115 - *
1116 - * @return void
1117 706 */
1118 707 private static function maybe_add_wp_site_health() {
1119 708 if ( ! class_exists( 'WP_Site_Health' ) ) {
1120 709 $wp_site_health_path = ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
@@ -1125,10 +714,8 @@
1125 714 }
1126 715
1127 716 /**
1128 717 * @since 3.0
1129 - *
1130 - * @return true
1131 718 */
1132 719 public static function api_install() {
1133 720 delete_transient( 'frm_updating_api' );
1134 721 if ( self::needs_update() ) {
@@ -1147,29 +734,19 @@
1147 734 * Silent database upgrade (no redirect).
1148 735 * Called via ajax request during network upgrade process.
1149 736 *
1150 737 * @since 2.0.1
1151 - *
1152 - * @return void
1153 738 */
1154 739 public static function ajax_install() {
1155 - FrmAppHelper::permission_check( 'frm_change_settings' );
1156 - check_ajax_referer( 'frm_ajax', 'nonce' );
1157 740 self::api_install();
1158 741 wp_die();
1159 742 }
1160 743
1161 - /**
1162 - * @return void
1163 - */
1164 744 public static function install() {
1165 745 $frmdb = new FrmMigrate();
1166 746 $frmdb->upgrade();
1167 747 }
1168 748
1169 - /**
1170 - * @return void
1171 - */
1172 749 public static function uninstall() {
1173 750 FrmAppHelper::permission_check( 'administrator' );
1174 751 check_ajax_referer( 'frm_ajax', 'nonce' );
1175 752
@@ -1175,9 +752,9 @@
1175 752
1176 753 $frmdb = new FrmMigrate();
1177 754 $frmdb->uninstall();
1178 755
1179 - // Disable the plugin and redirect after uninstall so the tables don't get added right back.
756 + //disable the plugin and redirect after uninstall so the tables don't get added right back
1180 757 $plugins = array( FrmAppHelper::plugin_folder() . '/formidable.php', 'formidable-pro/formidable-pro.php' );
1181 758 deactivate_plugins( $plugins, false, false );
1182 759 echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
1183 760
@@ -1193,11 +770,8 @@
1193 770
1194 771 return $tables;
1195 772 }
1196 773
1197 - /**
1198 - * @return void
1199 - */
1200 774 public static function deauthorize() {
1201 775 FrmAppHelper::permission_check( 'frm_change_settings' );
1202 776 check_ajax_referer( 'frm_ajax', 'nonce' );
1203 777
@@ -1207,33 +781,8 @@
1207 781 delete_site_option( 'frmpro-authorized' );
1208 782 wp_die();
1209 783 }
1210 784
1211 - /**
1212 - * This is triggered when Formidable is activated.
1213 - *
1214 - * @return void
1215 - */
1216 - public static function handle_activation() {
1217 - self::maybe_activate_payment_cron();
1218 - }
1219 -
1220 - /**
1221 - * The payment cron is unscheduled when Formidable is deactivated.
1222 - * We need to add it back again on activation if Stripe is configured.
1223 - *
1224 - * @since 6.5
1225 - *
1226 - * @return void
1227 - */
1228 - private static function maybe_activate_payment_cron() {
1229 - if ( ! FrmStrpLiteConnectHelper::stripe_connect_is_setup() ) {
1230 - return;
1231 - }
1232 -
1233 - FrmTransLiteAppController::maybe_schedule_cron();
1234 - }
1235 -
1236 785 public static function set_footer_text( $text ) {
1237 786 if ( FrmAppHelper::is_formidable_admin() ) {
1238 787 $text = '';
1239 788 }
@@ -1241,368 +790,56 @@
1241 790 return $text;
1242 791 }
1243 792
1244 793 /**
1245 - * Add admin footer links.
1246 - *
1247 - * @since 6.4.1
1248 - *
1249 - * @return void
794 + * @deprecated 1.07.05
795 + * @codeCoverageIgnore
1250 796 */
1251 - public static function add_admin_footer_links() {
1252 - FrmFormsController::include_device_too_small_message();
1253 - if ( self::should_show_footer_links() ) {
1254 - include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php';
1255 - }
797 + public static function get_form_shortcode( $atts ) {
798 + return FrmDeprecated::get_form_shortcode( $atts );
1256 799 }
1257 800
1258 801 /**
1259 - * Check if the footer links should be shown.
1260 - *
1261 - * @since 6.7
1262 - *
1263 - * @return bool
802 + * @deprecated 2.5.4
803 + * @codeCoverageIgnore
1264 804 */
1265 - private static function should_show_footer_links() {
1266 - $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
1267 - $is_formidable_page = FrmAppHelper::is_formidable_admin() || 'frm_logs' === $post_type;
1268 - $show_footer_links = $is_formidable_page;
1269 - if ( FrmAppHelper::is_full_screen() || ! FrmAppHelper::is_formidable_branding() ) {
1270 - $show_footer_links = false;
1271 - }
1272 -
1273 - /**
1274 - * Filter whether to show the Formidable footer links.
1275 - *
1276 - * @since 6.7
1277 - *
1278 - * @param bool $show_footer_links
1279 - * @return bool
1280 - */
1281 - return apply_filters( 'frm_show_footer_links', $show_footer_links );
805 + public static function widget_text_filter( $content ) {
806 + return FrmDeprecated::widget_text_filter( $content );
1282 807 }
1283 808
1284 809 /**
1285 - * Show an error modal and terminate the script execution.
810 + * Deprecated in favor of wpmu_upgrade_site
1286 811 *
1287 - * @since 6.7
1288 - *
1289 - * @param array $error_args Arguments that control the behavior of the error modal.
1290 - *
1291 - * @return void
812 + * @deprecated 2.3
813 + * @codeCoverageIgnore
1292 814 */
1293 - public static function show_error_modal( $error_args ) {
1294 - add_filter( 'frm_show_footer_links', '__return_false' );
1295 -
1296 - $defaults = array(
1297 - 'title' => '',
1298 - 'body' => '',
1299 - 'cancel_url' => '',
1300 - 'cancel_classes' => '',
1301 - 'continue_url' => '',
1302 - 'continue_classes' => '',
1303 - 'icon' => 'frm_lock_simple',
1304 - );
1305 -
1306 - $error_args = wp_parse_args( $error_args, $defaults );
1307 - if ( ! isset( $error_args['cancel_text'] ) && ! empty( $error_args['cancel_url'] ) ) {
1308 - $error_args['cancel_text'] = __( 'Cancel', 'formidable' );
1309 - }
1310 -
1311 - if ( ! isset( $error_args['continue_text'] ) && ! empty( $error_args['continue_url'] ) ) {
1312 - $error_args['continue_text'] = __( 'Continue', 'formidable' );
1313 - }
1314 -
1315 - include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/error-modal.php';
815 + public static function front_head() {
816 + FrmDeprecated::front_head();
1316 817 }
1317 818
1318 819 /**
1319 - * Handles Floating Links' scripts and styles enqueueing.
1320 - *
1321 - * @since 6.4
1322 - *
1323 - * @param string $plugin_url URL of the plugin.
1324 - * @param string $version Current version of the plugin.
1325 - * @return void
820 + * @deprecated 3.0.04
821 + * @codeCoverageIgnore
1326 822 */
1327 - private static function enqueue_floating_links( $plugin_url, $version ) {
1328 - if ( ! $plugin_url || ! $version ) {
1329 - // If any required parameters are missing, exit early.
1330 - return;
1331 - }
1332 -
1333 - // Enqueue the Floating Links styles.
1334 - wp_enqueue_style( 's11-floating-links', $plugin_url . '/css/packages/s11-floating-links.css', array(), $version );
1335 -
1336 - // Enqueue the Floating Links script.
1337 - wp_enqueue_script( 's11-floating-links', $plugin_url . '/js/packages/floating-links/s11-floating-links.js', array( 'formidable_admin' ), $version, true );
1338 -
1339 - // Enqueue the config script.
1340 - wp_enqueue_script( 's11-floating-links-config', $plugin_url . '/js/packages/floating-links/config.js', array( 'wp-i18n' ), $version, true );
1341 -
1342 - if ( function_exists( 'wp_set_script_translations' ) ) {
1343 - wp_set_script_translations( 's11-floating-links-config', 's11-' );
1344 - }
1345 -
1346 - $upgrade_utm = array(
1347 - 'campaign' => 'floating-links',
1348 - 'content' => 'floating-links-upgrade',
1349 - );
1350 - $docs_utm = array(
1351 - 'campaign' => 'floating-links',
1352 - 'content' => 'floating-links-docs',
1353 - );
1354 - $floating_links_data = array(
1355 - 'proIsInstalled' => FrmAppHelper::pro_is_installed(),
1356 - 'upgradeUrl' => FrmAppHelper::admin_upgrade_link( $upgrade_utm ),
1357 - 'documentationUrl' => FrmAppHelper::admin_upgrade_link( $docs_utm, 'knowledgebase/' ),
1358 - );
1359 - wp_localize_script( 's11-floating-links-config', 's11FloatingLinksData', $floating_links_data );
1360 -
1361 - /**
1362 - * Prompt Pro to load additional floating links scripts.
1363 - * This is used to include images in the Inbox SlideIn when Pro is active.
1364 - *
1365 - * @since 6.8.4
1366 - */
1367 - do_action( 'frm_enqueue_floating_links' );
823 + public static function activation_install() {
824 + FrmDeprecated::activation_install();
1368 825 }
1369 826
1370 827 /**
1371 - * Check if we are in our admin pages.
1372 - *
1373 - * @return bool
828 + * @deprecated 3.0
829 + * @codeCoverageIgnore
1374 830 */
1375 - private static function in_our_pages() {
1376 - global $current_screen, $pagenow;
1377 - if ( FrmAppHelper::is_formidable_admin() ) {
1378 - return true;
1379 - }
1380 -
1381 - if ( ! empty( $current_screen->post_type ) && 'frm_logs' === $current_screen->post_type ) {
1382 - return true;
1383 - }
1384 -
1385 - if ( in_array( $pagenow, array( 'term.php', 'edit-tags.php' ), true ) && 'frm_application' === FrmAppHelper::simple_get( 'taxonomy' ) ) {
1386 - return true;
1387 - }
1388 -
1389 - return false;
831 + public static function page_route( $content ) {
832 + return FrmDeprecated::page_route( $content );
1390 833 }
1391 834
1392 835 /**
1393 - * Handles actions related to the current screen.
836 + * Include icons on page for Embed Form modal.
1394 837 *
1395 - * @since 6.19
838 + * @since 5.2
1396 839 *
1397 840 * @return void
1398 841 */
1399 - public static function handle_current_screen() {
1400 - if ( ! self::in_our_pages() ) {
1401 - return;
1402 - }
1403 -
1404 - self::filter_admin_notices();
1405 - self::remember_custom_sort();
1406 - }
1407 -
1408 - /**
1409 - * Hide all third-parties admin notices only in our admin pages.
1410 - *
1411 - * @return void
1412 - */
1413 - public static function filter_admin_notices() {
1414 - $actions = array(
1415 - 'admin_notices',
1416 - 'network_admin_notices',
1417 - 'user_admin_notices',
1418 - 'all_admin_notices',
1419 - );
1420 -
1421 - global $wp_filter;
1422 -
1423 - foreach ( $actions as $action ) {
1424 - if ( empty( $wp_filter[ $action ]->callbacks ) ) {
1425 - continue;
1426 - }
1427 - foreach ( $wp_filter[ $action ]->callbacks as $priority => $callbacks ) {
1428 - foreach ( $callbacks as $callback_name => $callback ) {
1429 - if ( self::is_our_callback_string( $callback_name ) || self::is_our_callback_array( $callback ) ) {
1430 - continue;
1431 - }
1432 - unset( $wp_filter[ $action ]->callbacks[ $priority ][ $callback_name ] );
1433 - }
1434 - }
1435 - }
1436 - }
1437 -
1438 - /**
1439 - * Remembers and applies user-specific sorting preferences.
1440 - *
1441 - * @return void
1442 - */
1443 - private static function remember_custom_sort() {
1444 - $meta_key = self::get_sort_pref_user_meta_key();
1445 - if ( false === $meta_key ) {
1446 - return;
1447 - }
1448 -
1449 - $is_form_list = FrmAppHelper::is_admin_list_page();
1450 - $is_entry_list = FrmAppHelper::is_admin_list_page( 'formidable-entries' );
1451 - if ( ! $is_form_list && ! $is_entry_list ) {
1452 - return;
1453 - }
1454 -
1455 - $orderby = FrmAppHelper::get_param( 'orderby' );
1456 - if ( ! $orderby ) {
1457 - return;
1458 - }
1459 -
1460 - $user_id = get_current_user_id();
1461 - $order = FrmAppHelper::get_param( 'order' );
1462 - $new_sort = array(
1463 - 'orderby' => $orderby,
1464 - 'order' => $order,
1465 - );
1466 - $previous_meta = get_user_meta( $user_id, $meta_key, true );
1467 - $current_sort = $previous_meta;
1468 - $form_id = $is_entry_list ? FrmAppHelper::simple_get( 'form', 'absint' ) : 0;
1469 -
1470 - if ( is_array( $current_sort ) && $form_id && is_int( $form_id ) && isset( $current_sort[ $form_id ] ) ) {
1471 - $current_sort = $current_sort[ $form_id ];
1472 - }
1473 -
1474 - if ( $new_sort !== $current_sort ) {
1475 - $new_meta = $new_sort;
1476 -
1477 - if ( $is_entry_list && $form_id && is_int( $form_id ) ) {
1478 - // Index meta by form ID.
1479 - $temp_meta = is_array( $previous_meta ) ? $previous_meta : array();
1480 - $temp_meta[ $form_id ] = $new_meta;
1481 - $new_meta = $temp_meta;
1482 - unset( $temp_meta );
1483 - }
1484 -
1485 - update_user_meta( $user_id, $meta_key, $new_meta );
1486 - }
1487 - }
1488 -
1489 - /**
1490 - * Retrieve and apply any saved sorting preferences for the current screen.
1491 - *
1492 - * @since 6.19
1493 - *
1494 - * @param string &$orderby Reference to the current 'orderby' parameter.
1495 - * @param string &$order Reference to the current 'order' parameter.
1496 - * @return void
1497 - */
1498 - public static function apply_saved_sort_preference( &$orderby, &$order ) {
1499 - $meta_key = self::get_sort_pref_user_meta_key();
1500 - if ( false === $meta_key ) {
1501 - return;
1502 - }
1503 -
1504 - $user_id = get_current_user_id();
1505 - $preferred_list_sort = get_user_meta( $user_id, $meta_key, true );
1506 - $form_id = FrmAppHelper::simple_get( 'form', 'absint' );
1507 -
1508 - if ( is_array( $preferred_list_sort ) && $form_id && is_int( $form_id ) && isset( $preferred_list_sort[ $form_id ] ) ) {
1509 - $preferred_list_sort = $preferred_list_sort[ $form_id ];
1510 - }
1511 -
1512 - if ( is_array( $preferred_list_sort ) && ! empty( $preferred_list_sort['orderby'] ) ) {
1513 - $orderby = $preferred_list_sort['orderby'];
1514 -
1515 - if ( ! empty( $preferred_list_sort['order'] ) ) {
1516 - $order = $preferred_list_sort['order'];
1517 - }
1518 - }
1519 - }
1520 -
1521 - /**
1522 - * Get a simple user meta key that only includes the screen ID.
1523 - *
1524 - * @since 6.25.1
1525 - *
1526 - * @return false|string
1527 - */
1528 - private static function get_sort_pref_user_meta_key() {
1529 - if ( ! function_exists( 'get_current_screen' ) ) {
1530 - return false;
1531 - }
1532 -
1533 - $screen = get_current_screen();
1534 - return $screen ? 'frm_preferred_list_sort_' . $screen->id : false;
1535 - }
1536 -
1537 - /**
1538 - * Validate that the callback name is ours not from third-party.
1539 - *
1540 - * @param string $callback_name WordPress callback name.
1541 - *
1542 - * @return bool
1543 - */
1544 - private static function is_our_callback_string( $callback_name ) {
1545 - return 0 === stripos( $callback_name, 'frm' );
1546 - }
1547 -
1548 - /**
1549 - * Validate that the callback array is ours not from third-party.
1550 - *
1551 - * @param array $callback WordPress callback array.
1552 - *
1553 - * @return bool
1554 - */
1555 - private static function is_our_callback_array( $callback ) {
1556 - return ! empty( $callback['function'] ) &&
1557 - is_array( $callback['function'] ) &&
1558 - ! empty( $callback['function'][0] ) &&
1559 - self::is_our_callback_string( is_object( $callback['function'][0] ) ? get_class( $callback['function'][0] ) : $callback['function'][0] );
1560 - }
1561 -
1562 - /**
1563 - * In some cases, the DB tables may fail to install.
1564 - * This function tries to add them again when the user clicks the link to try again
1565 - * from the given inbox notice.
1566 - *
1567 - * @since 6.19
1568 - */
1569 - private static function add_missing_tables() {
1570 - FrmAppHelper::permission_check( 'frm_view_forms' );
1571 -
1572 - $inbox = new FrmInbox();
1573 - $error = $inbox->check_for_error();
1574 -
1575 - if ( ! $error || 'failed-to-create-tables' !== $error['key'] ) {
1576 - // Confirm the inbox item with this CTA exists.
1577 - wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
1578 - exit;
1579 - }
1580 -
1581 - global $wpdb;
1582 - $exists = $wpdb->get_results( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->prefix . 'frm_forms' ) );
1583 -
1584 - if ( $exists ) {
1585 - // Exit early if the table already exists.
1586 - wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
1587 - exit;
1588 - }
1589 -
1590 - delete_option( 'frm_db_version' );
1591 - wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
1592 - exit;
1593 - }
1594 -
1595 - /**
1596 - * Handles the small screen proceed action.
1597 - *
1598 - * @since 6.21
1599 - *
1600 - * @return void
1601 - */
1602 - public static function small_screen_proceed() {
1603 - FrmAppHelper::permission_check( 'frm_view_forms' );
1604 - check_ajax_referer( 'frm_ajax', 'nonce' );
1605 - update_user_option( get_current_user_id(), 'frm_ignore_small_screen_warning', true );
1606 - wp_send_json_success();
842 + public static function include_embed_form_icons() {
843 + _deprecated_function( __METHOD__, '5.3' );
1607 844 }
1608 845 }