| @@ -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; |
| @@ -62,15 +59,9 @@ | ||
| 62 | 59 | } |
| 63 | 60 | } |
| 64 | 61 | |
| 65 | 62 | if ( FrmAppHelper::is_full_screen() ) { |
| 66 | - $full_screen_on = self::get_full_screen_setting(); | |
| 67 | - $add_class = ''; | |
| 68 | - if ( $full_screen_on ) { | |
| 69 | - $add_class = ' frm-full-screen is-fullscreen-mode'; | |
| 70 | - wp_enqueue_style( 'wp-edit-post' ); // Load the CSS for .is-fullscreen-mode. | |
| 71 | - } | |
| 72 | - $classes .= apply_filters( 'frm_admin_full_screen_class', $add_class ); | |
| 63 | + $classes .= apply_filters( 'frm_admin_full_screen_class', ' frm-full-screen folded' ); | |
| 73 | 64 | } |
| 74 | 65 | |
| 75 | 66 | if ( ! FrmAppHelper::pro_is_installed() ) { |
| 76 | 67 | $classes .= ' frm-lite '; |
| @@ -79,30 +70,9 @@ | ||
| 79 | 70 | return $classes; |
| 80 | 71 | } |
| 81 | 72 | |
| 82 | 73 | /** |
| 83 | - * Get the full screen mode setting from the block editor. | |
| 84 | - * | |
| 85 | - * @since 6.1 | |
| 86 | - * | |
| 87 | - * @return bool | |
| 88 | - */ | |
| 89 | - private static function get_full_screen_setting() { | |
| 90 | - global $wpdb; | |
| 91 | - $meta_key = $wpdb->get_blog_prefix() . 'persisted_preferences'; | |
| 92 | - | |
| 93 | - $prefs = get_user_meta( get_current_user_id(), $meta_key, true ); | |
| 94 | - if ( $prefs && isset( $prefs['core/edit-post']['fullscreenMode'] ) ) { | |
| 95 | - return $prefs['core/edit-post']['fullscreenMode']; | |
| 96 | - } | |
| 97 | - | |
| 98 | - return true; | |
| 99 | - } | |
| 100 | - | |
| 101 | - /** | |
| 102 | 74 | * @since 4.0 |
| 103 | - * | |
| 104 | - * @return string | |
| 105 | 75 | */ |
| 106 | 76 | private static function get_os() { |
| 107 | 77 | $agent = strtolower( FrmAppHelper::get_server_value( 'HTTP_USER_AGENT' ) ); |
| 108 | 78 | $os = ''; |
| @@ -123,9 +93,8 @@ | ||
| 123 | 93 | $white_pages = array( |
| 124 | 94 | 'formidable', |
| 125 | 95 | 'formidable-entries', |
| 126 | 96 | 'formidable-views', |
| 127 | - 'formidable-views-editor', | |
| 128 | 97 | 'formidable-pro-upgrade', |
| 129 | 98 | 'formidable-addons', |
| 130 | 99 | 'formidable-import', |
| 131 | 100 | 'formidable-settings', |
| @@ -135,14 +104,8 @@ | ||
| 135 | 104 | 'formidable-welcome', |
| 136 | 105 | 'formidable-applications', |
| 137 | 106 | ); |
| 138 | 107 | |
| 139 | - if ( ! class_exists( 'FrmTransHooksController', false ) ) { | |
| 140 | - // Only consider the payments page as a "white page" when the Payments submodule is off. | |
| 141 | - // Otherwise this causes a lot of styling issues when the Stripe add-on (or Authorize.Net) is active. | |
| 142 | - $white_pages[] = 'formidable-payments'; | |
| 143 | - } | |
| 144 | - | |
| 145 | 108 | $get_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
| 146 | 109 | $is_white_page = in_array( $get_page, $white_pages, true ); |
| 147 | 110 | |
| 148 | 111 | if ( ! $is_white_page ) { |
| @@ -161,23 +124,12 @@ | ||
| 161 | 124 | |
| 162 | 125 | return $is_white_page; |
| 163 | 126 | } |
| 164 | 127 | |
| 165 | - /** | |
| 166 | - * @return void | |
| 167 | - */ | |
| 168 | 128 | public static function load_wp_admin_style() { |
| 169 | 129 | FrmAppHelper::load_font_style(); |
| 170 | 130 | } |
| 171 | 131 | |
| 172 | - /** | |
| 173 | - * @param bool $show_nav | |
| 174 | - * @param string $title | |
| 175 | - * | |
| 176 | - * @psalm-param 'hide'|'show' $title | |
| 177 | - * | |
| 178 | - * @return void | |
| 179 | - */ | |
| 180 | 132 | public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) { |
| 181 | 133 | $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' ); |
| 182 | 134 | if ( empty( $show_nav ) || ! $form ) { |
| 183 | 135 | return; |
| @@ -194,11 +146,8 @@ | ||
| 194 | 146 | |
| 195 | 147 | include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' ); |
| 196 | 148 | } |
| 197 | 149 | |
| 198 | - /** | |
| 199 | - * @return string | |
| 200 | - */ | |
| 201 | 150 | private static function get_current_page() { |
| 202 | 151 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
| 203 | 152 | $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' ); |
| 204 | 153 | $current_page = isset( $_GET['page'] ) ? $page : $post_type; |
| @@ -209,12 +158,8 @@ | ||
| 209 | 158 | |
| 210 | 159 | return $current_page; |
| 211 | 160 | } |
| 212 | 161 | |
| 213 | - /** | |
| 214 | - * @param object $form | |
| 215 | - * @return array | |
| 216 | - */ | |
| 217 | 162 | private static function get_form_nav_items( $form ) { |
| 218 | 163 | $id = $form->parent_form_id ? $form->parent_form_id : $form->id; |
| 219 | 164 | |
| 220 | 165 | $nav_items = array( |
| @@ -281,21 +226,17 @@ | ||
| 281 | 226 | 'form_id' => $id, |
| 282 | 227 | 'form' => $form, |
| 283 | 228 | ); |
| 284 | 229 | |
| 285 | - return (array) apply_filters( 'frm_form_nav_list', $nav_items, $nav_args ); | |
| 230 | + return apply_filters( 'frm_form_nav_list', $nav_items, $nav_args ); | |
| 286 | 231 | } |
| 287 | 232 | |
| 288 | 233 | // Adds a settings link to the plugins page |
| 289 | - /** | |
| 290 | - * @return array | |
| 291 | - */ | |
| 292 | 234 | public static function settings_link( $links ) { |
| 293 | 235 | $settings = array(); |
| 294 | 236 | |
| 295 | 237 | if ( ! FrmAppHelper::pro_is_installed() ) { |
| 296 | - $label = FrmAddonsController::is_license_expired() ? __( 'Renew', 'formidable' ) : __( 'Upgrade to Pro', 'formidable' ); | |
| 297 | - $settings[] = '<a href="' . esc_url( FrmAppHelper::admin_upgrade_link( 'plugin-row' ) ) . '" target="_blank" rel="noopener"><b style="color:#1da867;font-weight:700;">' . esc_html( $label ) . '</b></a>'; | |
| 238 | + $settings[] = '<a href="' . esc_url( FrmAppHelper::admin_upgrade_link( 'plugin-row' ) ) . '" target="_blank" rel="noopener"><b>' . esc_html__( 'Upgrade to Pro', 'formidable' ) . '</b></a>'; | |
| 298 | 239 | } |
| 299 | 240 | |
| 300 | 241 | $settings[] = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>'; |
| 301 | 242 | |
| @@ -301,11 +242,8 @@ | ||
| 301 | 242 | |
| 302 | 243 | return array_merge( $settings, $links ); |
| 303 | 244 | } |
| 304 | 245 | |
| 305 | - /** | |
| 306 | - * @return void | |
| 307 | - */ | |
| 308 | 246 | public static function pro_get_started_headline() { |
| 309 | 247 | self::review_request(); |
| 310 | 248 | FrmAppHelper::min_pro_version_notice( '4.0' ); |
| 311 | 249 | } |
| @@ -313,10 +251,8 @@ | ||
| 313 | 251 | /** |
| 314 | 252 | * Add admin notices as needed for reviews |
| 315 | 253 | * |
| 316 | 254 | * @since 3.04.03 |
| 317 | - * | |
| 318 | - * @return void | |
| 319 | 255 | */ |
| 320 | 256 | private static function review_request() { |
| 321 | 257 | $reviews = new FrmReviews(); |
| 322 | 258 | $reviews->review_request(); |
| @@ -325,10 +261,8 @@ | ||
| 325 | 261 | /** |
| 326 | 262 | * Save the request to hide the review |
| 327 | 263 | * |
| 328 | 264 | * @since 3.04.03 |
| 329 | - * | |
| 330 | - * @return void | |
| 331 | 265 | */ |
| 332 | 266 | public static function dismiss_review() { |
| 333 | 267 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 334 | 268 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| @@ -338,10 +272,8 @@ | ||
| 338 | 272 | } |
| 339 | 273 | |
| 340 | 274 | /** |
| 341 | 275 | * @since 3.04.02 |
| 342 | - * | |
| 343 | - * @return void | |
| 344 | 276 | */ |
| 345 | 277 | public static function include_upgrade_overlay() { |
| 346 | 278 | self::enqueue_dialog_assets(); |
| 347 | 279 | add_action( 'admin_footer', 'FrmAppController::upgrade_overlay_html' ); |
| @@ -360,10 +292,8 @@ | ||
| 360 | 292 | } |
| 361 | 293 | |
| 362 | 294 | /** |
| 363 | 295 | * @since 3.06.03 |
| 364 | - * | |
| 365 | - * @return void | |
| 366 | 296 | */ |
| 367 | 297 | public static function upgrade_overlay_html() { |
| 368 | 298 | $is_pro = FrmAppHelper::pro_is_installed(); |
| 369 | 299 | $upgrade_link = array( |
| @@ -381,11 +311,8 @@ | ||
| 381 | 311 | self::new_form_overlay_html(); |
| 382 | 312 | } |
| 383 | 313 | } |
| 384 | 314 | |
| 385 | - /** | |
| 386 | - * @return void | |
| 387 | - */ | |
| 388 | 315 | private static function new_form_overlay_html() { |
| 389 | 316 | FrmFormsController::before_list_templates(); |
| 390 | 317 | |
| 391 | 318 | $plugin_path = FrmAppHelper::plugin_path(); |
| @@ -432,34 +359,13 @@ | ||
| 432 | 359 | |
| 433 | 360 | include $path . 'new-form-overlay.php'; |
| 434 | 361 | } |
| 435 | 362 | |
| 436 | - /** | |
| 437 | - * Create a basic form with an email field. | |
| 438 | - * | |
| 439 | - * @param string $form_key | |
| 440 | - * @param string $title | |
| 441 | - * @param string $description | |
| 442 | - * @return void | |
| 443 | - */ | |
| 444 | - public static function api_email_form( $form_key, $title, $description ) { | |
| 445 | - $url = 'https://sandbox.formidableforms.com/api/wp-json/frm/v2/forms/' . $form_key . '?return=html&exclude_script=jquery&exclude_style=formidable-css'; | |
| 446 | - $view_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new-form-overlay/'; | |
| 447 | - $user = wp_get_current_user(); | |
| 448 | - require $view_path . 'leave-email.php'; | |
| 449 | - } | |
| 450 | - | |
| 451 | - /** | |
| 452 | - * @return void | |
| 453 | - */ | |
| 454 | 363 | public static function include_info_overlay() { |
| 455 | 364 | self::enqueue_dialog_assets(); |
| 456 | 365 | add_action( 'admin_footer', 'FrmAppController::info_overlay_html' ); |
| 457 | 366 | } |
| 458 | 367 | |
| 459 | - /** | |
| 460 | - * @return void | |
| 461 | - */ | |
| 462 | 368 | public static function info_overlay_html() { |
| 463 | 369 | include FrmAppHelper::plugin_path() . '/classes/views/shared/info-overlay.php'; |
| 464 | 370 | } |
| 465 | 371 | |
| @@ -464,10 +370,8 @@ | ||
| 464 | 370 | } |
| 465 | 371 | |
| 466 | 372 | /** |
| 467 | 373 | * @since 3.04.02 |
| 468 | - * | |
| 469 | - * @return void | |
| 470 | 374 | */ |
| 471 | 375 | public static function remove_upsells() { |
| 472 | 376 | remove_action( 'frm_before_settings', 'FrmSettingsController::license_box' ); |
| 473 | 377 | remove_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' ); |
| @@ -479,10 +383,8 @@ | ||
| 479 | 383 | * If there are CURL problems on this server, wp_remote_post won't work for installing |
| 480 | 384 | * Use a javascript fallback instead. |
| 481 | 385 | * |
| 482 | 386 | * @since 2.0.3 |
| 483 | - * | |
| 484 | - * @return void | |
| 485 | 387 | */ |
| 486 | 388 | public static function install_js_fallback() { |
| 487 | 389 | FrmAppHelper::load_admin_wide_js(); |
| 488 | 390 | ?> |
| @@ -516,11 +418,8 @@ | ||
| 516 | 418 | /** |
| 517 | 419 | * Check both version number and DB number for changes |
| 518 | 420 | * |
| 519 | 421 | * @since 3.0.04 |
| 520 | - * | |
| 521 | - * @param array $atts | |
| 522 | - * @return bool | |
| 523 | 422 | */ |
| 524 | 423 | public static function compare_for_update( $atts ) { |
| 525 | 424 | $db_version = get_option( $atts['option'] ); |
| 526 | 425 | |
| @@ -539,10 +438,8 @@ | ||
| 539 | 438 | /** |
| 540 | 439 | * Check for database update and trigger js loading |
| 541 | 440 | * |
| 542 | 441 | * @since 2.0.1 |
| 543 | - * | |
| 544 | - * @return void | |
| 545 | 442 | */ |
| 546 | 443 | public static function admin_init() { |
| 547 | 444 | if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) { |
| 548 | 445 | FrmFormsController::duplicate(); |
| @@ -563,8 +460,10 @@ | ||
| 563 | 460 | // don't continue during ajax calls |
| 564 | 461 | self::admin_js(); |
| 565 | 462 | } |
| 566 | 463 | |
| 464 | + self::disable_admin_menus(); | |
| 465 | + | |
| 567 | 466 | if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
| 568 | 467 | $action = FrmAppHelper::get_param( 'frm_action' ); |
| 569 | 468 | |
| 570 | 469 | if ( in_array( $action, array( 'add_new', 'list_templates' ), true ) ) { |
| @@ -573,72 +472,32 @@ | ||
| 573 | 472 | } |
| 574 | 473 | |
| 575 | 474 | FrmInbox::maybe_disable_screen_options(); |
| 576 | 475 | } |
| 577 | - | |
| 578 | - self::maybe_add_ip_warning(); | |
| 579 | 476 | } |
| 580 | 477 | |
| 581 | 478 | /** |
| 582 | - * Show a warning for the IP address setting if it hasn't been set. | |
| 479 | + * Remove the admin menus and hide the gaps on full screen pages. | |
| 583 | 480 | * |
| 584 | - * @since 6.1 | |
| 585 | - * | |
| 586 | - * @return void | |
| 481 | + * @since 6.0 | |
| 587 | 482 | */ |
| 588 | - private static function maybe_add_ip_warning() { | |
| 589 | - $settings = FrmAppHelper::get_settings(); | |
| 590 | - if ( false !== $settings->custom_header_ip ) { | |
| 591 | - // The setting has been changed from the false default (to either 1 or 0), so stop showing the message. | |
| 483 | + private static function disable_admin_menus() { | |
| 484 | + if ( ! FrmAppHelper::is_full_screen() ) { | |
| 592 | 485 | return; |
| 593 | 486 | } |
| 594 | 487 | |
| 595 | - if ( ! self::is_behind_proxy() ) { | |
| 596 | - // This message is only applicable when using a reverse proxy. | |
| 597 | - return; | |
| 598 | - } | |
| 599 | - | |
| 600 | - if ( FrmAppHelper::get_post_param( 'frm_action', '', 'sanitize_text_field' ) ) { | |
| 601 | - // Avoid the message on a POST action. We don't want to show the message if we're saving global settings. | |
| 602 | - return; | |
| 603 | - } | |
| 604 | - | |
| 605 | - $global_settings_link = admin_url( 'admin.php?page=formidable-settings' ) . '#frm_custom_header_ip'; | |
| 606 | - $message = sprintf( | |
| 607 | - // Translators: 1: Global Settings Link | |
| 608 | - __( 'IP addresses in form submissions may no longer be accurate! If you are experiencing issues, we recommend going to %1$s and enabling the "Use custom headers when retrieving IPs with form submissions." setting.', 'formidable' ), | |
| 609 | - '<a href="' . esc_url( $global_settings_link ) . '">Global Settings</a>' | |
| 488 | + wp_deregister_script( 'admin-bar' ); | |
| 489 | + wp_deregister_style( 'admin-bar' ); | |
| 490 | + remove_action( 'admin_footer', 'wp_admin_bar_render', 1000 ); | |
| 491 | + add_action( | |
| 492 | + 'admin_head', | |
| 493 | + function() { | |
| 494 | + echo '<style>html.wp-toolbar{padding-top:0}</style>'; | |
| 495 | + } | |
| 610 | 496 | ); |
| 611 | - $option_name = 'frm_dismiss_ip_address_notice'; | |
| 612 | - FrmAppHelper::add_dismissable_warning_message( $message, $option_name ); | |
| 613 | 497 | } |
| 614 | 498 | |
| 615 | 499 | /** |
| 616 | - * Check if any reverse proxy headers are set. | |
| 617 | - * | |
| 618 | - * @since 6.1 | |
| 619 | - * | |
| 620 | - * @return bool | |
| 621 | - */ | |
| 622 | - private static function is_behind_proxy() { | |
| 623 | - $custom_headers = FrmAppHelper::get_custom_header_keys_for_ip(); | |
| 624 | - foreach ( $custom_headers as $header ) { | |
| 625 | - if ( 'REMOTE_ADDR' === $header ) { | |
| 626 | - // We want to check every key but REMOTE_ADDR. REMOTE_ATTR is not unique to reverse proxy servers. | |
| 627 | - continue; | |
| 628 | - } | |
| 629 | - | |
| 630 | - $ip = trim( FrmAppHelper::get_server_value( $header ) ); | |
| 631 | - // Return true for anything that isn't empty but ignoring values like ::1. | |
| 632 | - if ( $ip && 0 !== strpos( $ip, '::' ) ) { | |
| 633 | - return true; | |
| 634 | - } | |
| 635 | - } | |
| 636 | - | |
| 637 | - return false; | |
| 638 | - } | |
| 639 | - | |
| 640 | - /** | |
| 641 | 500 | * @return void |
| 642 | 501 | */ |
| 643 | 502 | public static function admin_js() { |
| 644 | 503 | $plugin_url = FrmAppHelper::plugin_url(); |
| @@ -644,9 +503,8 @@ | ||
| 644 | 503 | $plugin_url = FrmAppHelper::plugin_url(); |
| 645 | 504 | $version = FrmAppHelper::plugin_version(); |
| 646 | 505 | |
| 647 | 506 | FrmAppHelper::load_admin_wide_js(); |
| 648 | - FrmOverlayController::register_assets(); | |
| 649 | 507 | |
| 650 | 508 | wp_register_style( 'formidable_admin_global', $plugin_url . '/css/admin/frm_admin_global.css', array(), $version ); |
| 651 | 509 | wp_enqueue_style( 'formidable_admin_global' ); |
| 652 | 510 | |
| @@ -660,19 +518,8 @@ | ||
| 660 | 518 | wp_register_script( 'formidable_settings', $plugin_url . '/js/admin/settings.js', array(), $version, true ); |
| 661 | 519 | |
| 662 | 520 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
| 663 | 521 | |
| 664 | - // Enqueue Floating Links. | |
| 665 | - $is_valid_page = | |
| 666 | - FrmAppHelper::is_formidable_admin() && | |
| 667 | - ! FrmAppHelper::is_style_editor_page() && | |
| 668 | - ! FrmAppHelper::is_admin_page( 'formidable-views-editor' ) && | |
| 669 | - ! FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); | |
| 670 | - if ( $is_valid_page && FrmAppHelper::is_formidable_branding() ) { | |
| 671 | - self::enqueue_floating_links( $plugin_url, $version ); | |
| 672 | - } | |
| 673 | - unset( $is_valid_page ); | |
| 674 | - | |
| 675 | 522 | if ( 'formidable-applications' === $page ) { |
| 676 | 523 | FrmApplicationsController::load_assets(); |
| 677 | 524 | return; |
| 678 | 525 | } |
| @@ -704,19 +551,8 @@ | ||
| 704 | 551 | } |
| 705 | 552 | |
| 706 | 553 | wp_register_script( 'bootstrap-multiselect', $plugin_url . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip', 'popper' ), '1.1.1', true ); |
| 707 | 554 | |
| 708 | - if ( ! class_exists( 'FrmTransHooksController', false ) ) { | |
| 709 | - /** | |
| 710 | - * Gateway fields are included for add-on compatibility but we do not want it to be visible. | |
| 711 | - * They do however need to be visible when the payments submodule is active. | |
| 712 | - */ | |
| 713 | - wp_add_inline_style( | |
| 714 | - 'formidable-admin', | |
| 715 | - '#frm_builder_page li[data-ftype="gateway"] { display: none; }' | |
| 716 | - ); | |
| 717 | - } | |
| 718 | - | |
| 719 | 555 | $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' ); |
| 720 | 556 | |
| 721 | 557 | global $pagenow; |
| 722 | 558 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow === 'edit.php' && $post_type === 'frm_display' ) ) { |
| @@ -757,64 +593,22 @@ | ||
| 757 | 593 | return; |
| 758 | 594 | } |
| 759 | 595 | |
| 760 | 596 | if ( $post_type === 'frm_display' ) { |
| 761 | - self::enqueue_legacy_views_assets(); | |
| 597 | + wp_enqueue_style( 'formidable-grids' ); | |
| 598 | + wp_enqueue_script( 'jquery-ui-draggable' ); | |
| 599 | + self::maybe_deregister_popper2(); | |
| 600 | + wp_enqueue_script( 'formidable_admin' ); | |
| 601 | + wp_enqueue_style( 'formidable-admin' ); | |
| 602 | + FrmAppHelper::localize_script( 'admin' ); | |
| 603 | + self::include_info_overlay(); | |
| 762 | 604 | } |
| 763 | 605 | } |
| 764 | 606 | |
| 765 | - } | |
| 766 | - | |
| 767 | - /** | |
| 768 | - * @since 6.3.2 | |
| 769 | - * | |
| 770 | - * @return void | |
| 771 | - */ | |
| 772 | - public static function admin_enqueue_scripts() { | |
| 773 | - self::load_wp_admin_style(); | |
| 774 | 607 | self::maybe_force_formidable_block_on_gutenberg_page(); |
| 775 | 608 | } |
| 776 | 609 | |
| 777 | 610 | /** |
| 778 | - * Enqueue required assets for the Legacy Views editor (Views v4.x). | |
| 779 | - * | |
| 780 | - * @since 6.1.2 | |
| 781 | - * | |
| 782 | - * @return void | |
| 783 | - */ | |
| 784 | - private static function enqueue_legacy_views_assets() { | |
| 785 | - wp_enqueue_style( 'formidable-grids' ); | |
| 786 | - wp_enqueue_script( 'jquery-ui-draggable' ); | |
| 787 | - self::maybe_deregister_popper2(); | |
| 788 | - wp_enqueue_script( 'formidable_admin' ); | |
| 789 | - wp_add_inline_style( | |
| 790 | - 'formidable-admin', | |
| 791 | - ' | |
| 792 | - .frm-white-body.post-type-frm_display .columns-2 { | |
| 793 | - display: block; | |
| 794 | - overflow: visible; | |
| 795 | - } | |
| 796 | - | |
| 797 | - .frm-white-body.post-type-frm_display .columns-2 > div { | |
| 798 | - overflow-y: hidden; | |
| 799 | - } | |
| 800 | - | |
| 801 | - .frm-white-body.post-type-frm_display #titlediv #title-prompt-text { | |
| 802 | - padding: 3px 0 0 10px; | |
| 803 | - } | |
| 804 | - | |
| 805 | - .post-type-frm_display #field-search-input, | |
| 806 | - .post-type-frm_display #advanced-search-input { | |
| 807 | - flex: 1; | |
| 808 | - } | |
| 809 | - ' | |
| 810 | - ); | |
| 811 | - wp_enqueue_style( 'formidable-admin' ); | |
| 812 | - FrmAppHelper::localize_script( 'admin' ); | |
| 813 | - self::include_info_overlay(); | |
| 814 | - } | |
| 815 | - | |
| 816 | - /** | |
| 817 | 611 | * Fix a Duplicator Pro conflict because it uses Popper 2. See issue #3459. |
| 818 | 612 | * |
| 819 | 613 | * @since 5.2.02.01 |
| 820 | 614 | * |
| @@ -868,12 +662,8 @@ | ||
| 868 | 662 | |
| 869 | 663 | /** |
| 870 | 664 | * @since 5.3 |
| 871 | 665 | * |
| 872 | - * @param string $block_name | |
| 873 | - * @param string $object_key | |
| 874 | - * @param array|string $object_id | |
| 875 | - * | |
| 876 | 666 | * @return void |
| 877 | 667 | */ |
| 878 | 668 | public static function add_js_to_inject_gutenberg_block( $block_name, $object_key, $object_id ) { |
| 879 | 669 | require FrmAppHelper::plugin_path() . '/classes/views/shared/edit-page-js.php'; |
| @@ -878,11 +668,8 @@ | ||
| 878 | 668 | public static function add_js_to_inject_gutenberg_block( $block_name, $object_key, $object_id ) { |
| 879 | 669 | require FrmAppHelper::plugin_path() . '/classes/views/shared/edit-page-js.php'; |
| 880 | 670 | } |
| 881 | 671 | |
| 882 | - /** | |
| 883 | - * @return void | |
| 884 | - */ | |
| 885 | 672 | public static function load_lang() { |
| 886 | 673 | load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
| 887 | 674 | } |
| 888 | 675 | |
| @@ -889,10 +676,8 @@ | ||
| 889 | 676 | /** |
| 890 | 677 | * Check if the styles are updated when a form is loaded on the front-end |
| 891 | 678 | * |
| 892 | 679 | * @since 3.0.1 |
| 893 | - * | |
| 894 | - * @return void | |
| 895 | 680 | */ |
| 896 | 681 | public static function maybe_update_styles() { |
| 897 | 682 | if ( self::needs_update() ) { |
| 898 | 683 | self::network_upgrade_site(); |
| @@ -900,10 +685,8 @@ | ||
| 900 | 685 | } |
| 901 | 686 | |
| 902 | 687 | /** |
| 903 | 688 | * @since 3.0 |
| 904 | - * | |
| 905 | - * @return void | |
| 906 | 689 | */ |
| 907 | 690 | public static function create_rest_routes() { |
| 908 | 691 | $args = array( |
| 909 | 692 | 'methods' => 'GET', |
| @@ -938,10 +721,8 @@ | ||
| 938 | 721 | * |
| 939 | 722 | * @since 2.0.1 |
| 940 | 723 | * |
| 941 | 724 | * @param int $blog_id Blog ID. |
| 942 | - * | |
| 943 | - * @return void | |
| 944 | 725 | */ |
| 945 | 726 | public static function network_upgrade_site( $blog_id = 0 ) { |
| 946 | 727 | // Flag to check if install is happening as intended. |
| 947 | 728 | set_transient( 'frm_updating_api', true, MINUTE_IN_SECONDS ); |
| @@ -965,10 +746,8 @@ | ||
| 965 | 746 | |
| 966 | 747 | /** |
| 967 | 748 | * Make sure WP_Site_Health has been included because it is required when calling rest_do_request. |
| 968 | 749 | * Check first that the file exists because WP_Site_Health was only introduced in WordPress 5.2. |
| 969 | - * | |
| 970 | - * @return void | |
| 971 | 750 | */ |
| 972 | 751 | private static function maybe_add_wp_site_health() { |
| 973 | 752 | if ( ! class_exists( 'WP_Site_Health' ) ) { |
| 974 | 753 | $wp_site_health_path = ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; |
| @@ -979,10 +758,8 @@ | ||
| 979 | 758 | } |
| 980 | 759 | |
| 981 | 760 | /** |
| 982 | 761 | * @since 3.0 |
| 983 | - * | |
| 984 | - * @return true | |
| 985 | 762 | */ |
| 986 | 763 | public static function api_install() { |
| 987 | 764 | delete_transient( 'frm_updating_api' ); |
| 988 | 765 | if ( self::needs_update() ) { |
| @@ -1001,10 +778,8 @@ | ||
| 1001 | 778 | * Silent database upgrade (no redirect). |
| 1002 | 779 | * Called via ajax request during network upgrade process. |
| 1003 | 780 | * |
| 1004 | 781 | * @since 2.0.1 |
| 1005 | - * | |
| 1006 | - * @return void | |
| 1007 | 782 | */ |
| 1008 | 783 | public static function ajax_install() { |
| 1009 | 784 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 1010 | 785 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| @@ -1011,19 +786,13 @@ | ||
| 1011 | 786 | self::api_install(); |
| 1012 | 787 | wp_die(); |
| 1013 | 788 | } |
| 1014 | 789 | |
| 1015 | - /** | |
| 1016 | - * @return void | |
| 1017 | - */ | |
| 1018 | 790 | public static function install() { |
| 1019 | 791 | $frmdb = new FrmMigrate(); |
| 1020 | 792 | $frmdb->upgrade(); |
| 1021 | 793 | } |
| 1022 | 794 | |
| 1023 | - /** | |
| 1024 | - * @return void | |
| 1025 | - */ | |
| 1026 | 795 | public static function uninstall() { |
| 1027 | 796 | FrmAppHelper::permission_check( 'administrator' ); |
| 1028 | 797 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 1029 | 798 | |
| @@ -1047,11 +816,8 @@ | ||
| 1047 | 816 | |
| 1048 | 817 | return $tables; |
| 1049 | 818 | } |
| 1050 | 819 | |
| 1051 | - /** | |
| 1052 | - * @return void | |
| 1053 | - */ | |
| 1054 | 820 | public static function deauthorize() { |
| 1055 | 821 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 1056 | 822 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 1057 | 823 | |
| @@ -1061,33 +827,8 @@ | ||
| 1061 | 827 | delete_site_option( 'frmpro-authorized' ); |
| 1062 | 828 | wp_die(); |
| 1063 | 829 | } |
| 1064 | 830 | |
| 1065 | - /** | |
| 1066 | - * This is triggered when Formidable is activated. | |
| 1067 | - * | |
| 1068 | - * @return void | |
| 1069 | - */ | |
| 1070 | - public static function handle_activation() { | |
| 1071 | - self::maybe_activate_payment_cron(); | |
| 1072 | - } | |
| 1073 | - | |
| 1074 | - /** | |
| 1075 | - * The payment cron is unscheduled when Formidable is deactivated. | |
| 1076 | - * We need to add it back again on activation if Stripe is configured. | |
| 1077 | - * | |
| 1078 | - * @since 6.5 | |
| 1079 | - * | |
| 1080 | - * @return void | |
| 1081 | - */ | |
| 1082 | - private static function maybe_activate_payment_cron() { | |
| 1083 | - if ( ! FrmStrpLiteConnectHelper::stripe_connect_is_setup() ) { | |
| 1084 | - return; | |
| 1085 | - } | |
| 1086 | - | |
| 1087 | - FrmTransLiteAppController::maybe_schedule_cron(); | |
| 1088 | - } | |
| 1089 | - | |
| 1090 | 831 | public static function set_footer_text( $text ) { |
| 1091 | 832 | if ( FrmAppHelper::is_formidable_admin() ) { |
| 1092 | 833 | $text = ''; |
| 1093 | 834 | } |
| @@ -1095,36 +836,36 @@ | ||
| 1095 | 836 | return $text; |
| 1096 | 837 | } |
| 1097 | 838 | |
| 1098 | 839 | /** |
| 1099 | - * Add admin footer links. | |
| 1100 | - * | |
| 1101 | - * @since 6.4.1 | |
| 1102 | - * | |
| 1103 | - * @return void | |
| 840 | + * @deprecated 1.07.05 | |
| 841 | + * @codeCoverageIgnore | |
| 1104 | 842 | */ |
| 1105 | - public static function add_admin_footer_links() { | |
| 1106 | - $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' ); | |
| 843 | + public static function get_form_shortcode( $atts ) { | |
| 844 | + return FrmDeprecated::get_form_shortcode( $atts ); | |
| 845 | + } | |
| 1107 | 846 | |
| 1108 | - // Check admin privileges, screen mode, and branding | |
| 1109 | - $is_not_admin = ! FrmAppHelper::is_formidable_admin() && $post_type !== 'frm_logs'; | |
| 1110 | - $is_full_screen = FrmAppHelper::is_full_screen(); | |
| 1111 | - $is_not_formidable_branding = ! FrmAppHelper::is_formidable_branding(); | |
| 847 | + /** | |
| 848 | + * @deprecated 2.5.4 | |
| 849 | + * @codeCoverageIgnore | |
| 850 | + */ | |
| 851 | + public static function widget_text_filter( $content ) { | |
| 852 | + return FrmDeprecated::widget_text_filter( $content ); | |
| 853 | + } | |
| 1112 | 854 | |
| 1113 | - // Exit if any of the above conditions are met | |
| 1114 | - if ( $is_not_admin || $is_full_screen || $is_not_formidable_branding ) { | |
| 1115 | - return; | |
| 1116 | - } | |
| 1117 | - | |
| 1118 | - include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php'; | |
| 855 | + /** | |
| 856 | + * Deprecated in favor of wpmu_upgrade_site | |
| 857 | + * | |
| 858 | + * @deprecated 2.3 | |
| 859 | + * @codeCoverageIgnore | |
| 860 | + */ | |
| 861 | + public static function front_head() { | |
| 862 | + FrmDeprecated::front_head(); | |
| 1119 | 863 | } |
| 1120 | 864 | |
| 1121 | 865 | /** |
| 1122 | 866 | * @deprecated 3.0.04 |
| 1123 | - * | |
| 1124 | 867 | * @codeCoverageIgnore |
| 1125 | - * | |
| 1126 | - * @return void | |
| 1127 | 868 | */ |
| 1128 | 869 | public static function activation_install() { |
| 1129 | 870 | FrmDeprecated::activation_install(); |
| 1130 | 871 | } |
| @@ -1145,52 +886,6 @@ | ||
| 1145 | 886 | * @return void |
| 1146 | 887 | */ |
| 1147 | 888 | public static function include_embed_form_icons() { |
| 1148 | 889 | _deprecated_function( __METHOD__, '5.3' ); |
| 1149 | - } | |
| 1150 | - | |
| 1151 | - /** | |
| 1152 | - * @deprecated 1.07.05 This is still referenced in the API add on as of v1.13. | |
| 1153 | - * @codeCoverageIgnore | |
| 1154 | - * | |
| 1155 | - * @param array $atts | |
| 1156 | - * @return string | |
| 1157 | - */ | |
| 1158 | - public static function get_form_shortcode( $atts ) { | |
| 1159 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode' ); | |
| 1160 | - return FrmFormsController::get_form_shortcode( $atts ); | |
| 1161 | - } | |
| 1162 | - | |
| 1163 | - /** | |
| 1164 | - * Handles Floating Links' scripts and styles enqueueing. | |
| 1165 | - * | |
| 1166 | - * @since 6.4 | |
| 1167 | - * | |
| 1168 | - * @param string $plugin_url URL of the plugin. | |
| 1169 | - * @param string $version Current version of the plugin. | |
| 1170 | - * @return void | |
| 1171 | - */ | |
| 1172 | - private static function enqueue_floating_links( $plugin_url, $version ) { | |
| 1173 | - if ( ! $plugin_url || ! $version ) { | |
| 1174 | - // If any required parameters are missing, exit early. | |
| 1175 | - return; | |
| 1176 | - } | |
| 1177 | - | |
| 1178 | - // Enqueue the Floating Links styles. | |
| 1179 | - wp_enqueue_style( 's11-floating-links', $plugin_url . '/css/packages/s11-floating-links.css', array(), $version ); | |
| 1180 | - | |
| 1181 | - // Enqueue the Floating Links script. | |
| 1182 | - wp_enqueue_script( 's11-floating-links', $plugin_url . '/js/packages/floating-links/s11-floating-links.js', array(), $version, true ); | |
| 1183 | - | |
| 1184 | - // Enqueue the config script. | |
| 1185 | - wp_enqueue_script( 's11-floating-links-config', $plugin_url . '/js/packages/floating-links/config.js', array( 'wp-i18n' ), $version, true ); | |
| 1186 | - | |
| 1187 | - if ( function_exists( 'wp_set_script_translations' ) ) { | |
| 1188 | - wp_set_script_translations( 's11-floating-links-config', 's11-' ); | |
| 1189 | - } | |
| 1190 | - | |
| 1191 | - $floating_links_data = array( | |
| 1192 | - 'proIsInstalled' => FrmAppHelper::pro_is_installed(), | |
| 1193 | - ); | |
| 1194 | - wp_localize_script( 's11-floating-links-config', 's11FloatingLinksData', $floating_links_data ); | |
| 1195 | 890 | } |
| 1196 | 891 | } |