| @@ -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( |
| @@ -225,15 +170,8 @@ | ||
| 225 | 170 | 'page' => 'formidable', |
| 226 | 171 | 'permission' => 'frm_edit_forms', |
| 227 | 172 | ), |
| 228 | 173 | array( |
| 229 | - 'link' => FrmStylesHelper::get_list_url( $id ), | |
| 230 | - 'label' => __( 'Style', 'formidable' ), | |
| 231 | - 'current' => array(), | |
| 232 | - 'page' => 'formidable-styles', | |
| 233 | - 'permission' => 'frm_edit_forms', | |
| 234 | - ), | |
| 235 | - array( | |
| 236 | 174 | 'link' => admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . absint( $id ) ), |
| 237 | 175 | 'label' => __( 'Settings', 'formidable' ), |
| 238 | 176 | 'current' => array( 'settings' ), |
| 239 | 177 | 'page' => 'formidable', |
| @@ -239,9 +177,9 @@ | ||
| 239 | 177 | 'page' => 'formidable', |
| 240 | 178 | 'permission' => 'frm_edit_forms', |
| 241 | 179 | ), |
| 242 | 180 | array( |
| 243 | - 'link' => admin_url( 'admin.php?page=formidable-entries&frm_action=list&form=' . absint( $id ) ), | |
| 181 | + 'link' => admin_url( 'admin.php?page=formidable-entries&frm-full=1&frm_action=list&form=' . absint( $id ) ), | |
| 244 | 182 | 'label' => __( 'Entries', 'formidable' ), |
| 245 | 183 | 'current' => array(), |
| 246 | 184 | 'page' => 'formidable-entries', |
| 247 | 185 | 'permission' => 'frm_view_entries', |
| @@ -251,9 +189,9 @@ | ||
| 251 | 189 | $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) ? FrmProAppHelper::views_is_installed() : FrmAppHelper::pro_is_installed(); |
| 252 | 190 | |
| 253 | 191 | if ( ! $views_installed ) { |
| 254 | 192 | $nav_items[] = array( |
| 255 | - 'link' => admin_url( 'admin.php?page=formidable-views&form=' . absint( $id ) ), | |
| 193 | + 'link' => admin_url( 'admin.php?page=formidable-views&frm-full=1&form=' . absint( $id ) ), | |
| 256 | 194 | 'label' => __( 'Views', 'formidable' ), |
| 257 | 195 | 'current' => array(), |
| 258 | 196 | 'page' => 'formidable-views', |
| 259 | 197 | 'permission' => 'frm_view_entries', |
| @@ -265,9 +203,9 @@ | ||
| 265 | 203 | |
| 266 | 204 | // Let people know reports and views exist. |
| 267 | 205 | if ( ! FrmAppHelper::pro_is_installed() ) { |
| 268 | 206 | $nav_items[] = array( |
| 269 | - 'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&form=' . absint( $id ) ), | |
| 207 | + 'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&frm-full=1&form=' . absint( $id ) ), | |
| 270 | 208 | 'label' => __( 'Reports', 'formidable' ), |
| 271 | 209 | 'current' => array( 'reports' ), |
| 272 | 210 | 'page' => 'formidable', |
| 273 | 211 | 'permission' => 'frm_view_entries', |
| @@ -281,20 +219,17 @@ | ||
| 281 | 219 | 'form_id' => $id, |
| 282 | 220 | 'form' => $form, |
| 283 | 221 | ); |
| 284 | 222 | |
| 285 | - return (array) apply_filters( 'frm_form_nav_list', $nav_items, $nav_args ); | |
| 223 | + return apply_filters( 'frm_form_nav_list', $nav_items, $nav_args ); | |
| 286 | 224 | } |
| 287 | 225 | |
| 288 | 226 | // Adds a settings link to the plugins page |
| 289 | - /** | |
| 290 | - * @return array | |
| 291 | - */ | |
| 292 | 227 | public static function settings_link( $links ) { |
| 293 | 228 | $settings = array(); |
| 294 | 229 | |
| 295 | 230 | if ( ! FrmAppHelper::pro_is_installed() ) { |
| 296 | - $settings[] = '<a href="' . esc_url( FrmAppHelper::admin_upgrade_link( 'plugin-row' ) ) . '" target="_blank" rel="noopener"><b style="color:#1da867;font-weight:700;">' . esc_html__( 'Upgrade to Pro', 'formidable' ) . '</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>'; | |
| 297 | 232 | } |
| 298 | 233 | |
| 299 | 234 | $settings[] = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>'; |
| 300 | 235 | |
| @@ -300,11 +235,8 @@ | ||
| 300 | 235 | |
| 301 | 236 | return array_merge( $settings, $links ); |
| 302 | 237 | } |
| 303 | 238 | |
| 304 | - /** | |
| 305 | - * @return void | |
| 306 | - */ | |
| 307 | 239 | public static function pro_get_started_headline() { |
| 308 | 240 | self::review_request(); |
| 309 | 241 | FrmAppHelper::min_pro_version_notice( '4.0' ); |
| 310 | 242 | } |
| @@ -312,10 +244,8 @@ | ||
| 312 | 244 | /** |
| 313 | 245 | * Add admin notices as needed for reviews |
| 314 | 246 | * |
| 315 | 247 | * @since 3.04.03 |
| 316 | - * | |
| 317 | - * @return void | |
| 318 | 248 | */ |
| 319 | 249 | private static function review_request() { |
| 320 | 250 | $reviews = new FrmReviews(); |
| 321 | 251 | $reviews->review_request(); |
| @@ -324,10 +254,8 @@ | ||
| 324 | 254 | /** |
| 325 | 255 | * Save the request to hide the review |
| 326 | 256 | * |
| 327 | 257 | * @since 3.04.03 |
| 328 | - * | |
| 329 | - * @return void | |
| 330 | 258 | */ |
| 331 | 259 | public static function dismiss_review() { |
| 332 | 260 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 333 | 261 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| @@ -337,10 +265,8 @@ | ||
| 337 | 265 | } |
| 338 | 266 | |
| 339 | 267 | /** |
| 340 | 268 | * @since 3.04.02 |
| 341 | - * | |
| 342 | - * @return void | |
| 343 | 269 | */ |
| 344 | 270 | public static function include_upgrade_overlay() { |
| 345 | 271 | self::enqueue_dialog_assets(); |
| 346 | 272 | add_action( 'admin_footer', 'FrmAppController::upgrade_overlay_html' ); |
| @@ -359,10 +285,8 @@ | ||
| 359 | 285 | } |
| 360 | 286 | |
| 361 | 287 | /** |
| 362 | 288 | * @since 3.06.03 |
| 363 | - * | |
| 364 | - * @return void | |
| 365 | 289 | */ |
| 366 | 290 | public static function upgrade_overlay_html() { |
| 367 | 291 | $is_pro = FrmAppHelper::pro_is_installed(); |
| 368 | 292 | $upgrade_link = array( |
| @@ -380,11 +304,8 @@ | ||
| 380 | 304 | self::new_form_overlay_html(); |
| 381 | 305 | } |
| 382 | 306 | } |
| 383 | 307 | |
| 384 | - /** | |
| 385 | - * @return void | |
| 386 | - */ | |
| 387 | 308 | private static function new_form_overlay_html() { |
| 388 | 309 | FrmFormsController::before_list_templates(); |
| 389 | 310 | |
| 390 | 311 | $plugin_path = FrmAppHelper::plugin_path(); |
| @@ -431,19 +352,13 @@ | ||
| 431 | 352 | |
| 432 | 353 | include $path . 'new-form-overlay.php'; |
| 433 | 354 | } |
| 434 | 355 | |
| 435 | - /** | |
| 436 | - * @return void | |
| 437 | - */ | |
| 438 | 356 | public static function include_info_overlay() { |
| 439 | 357 | self::enqueue_dialog_assets(); |
| 440 | 358 | add_action( 'admin_footer', 'FrmAppController::info_overlay_html' ); |
| 441 | 359 | } |
| 442 | 360 | |
| 443 | - /** | |
| 444 | - * @return void | |
| 445 | - */ | |
| 446 | 361 | public static function info_overlay_html() { |
| 447 | 362 | include FrmAppHelper::plugin_path() . '/classes/views/shared/info-overlay.php'; |
| 448 | 363 | } |
| 449 | 364 | |
| @@ -448,10 +363,8 @@ | ||
| 448 | 363 | } |
| 449 | 364 | |
| 450 | 365 | /** |
| 451 | 366 | * @since 3.04.02 |
| 452 | - * | |
| 453 | - * @return void | |
| 454 | 367 | */ |
| 455 | 368 | public static function remove_upsells() { |
| 456 | 369 | remove_action( 'frm_before_settings', 'FrmSettingsController::license_box' ); |
| 457 | 370 | remove_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' ); |
| @@ -463,17 +376,12 @@ | ||
| 463 | 376 | * If there are CURL problems on this server, wp_remote_post won't work for installing |
| 464 | 377 | * Use a javascript fallback instead. |
| 465 | 378 | * |
| 466 | 379 | * @since 2.0.3 |
| 467 | - * | |
| 468 | - * @return void | |
| 469 | 380 | */ |
| 470 | 381 | public static function install_js_fallback() { |
| 471 | 382 | FrmAppHelper::load_admin_wide_js(); |
| 472 | - ?> | |
| 473 | - <div id="frm_install_message"></div> | |
| 474 | - <script>jQuery(document).ready( frm_install_now );</script> | |
| 475 | - <?php | |
| 383 | + echo '<div id="hidden frm_install_message"></div><script type="text/javascript">jQuery(document).ready(function(){frm_install_now();});</script>'; | |
| 476 | 384 | } |
| 477 | 385 | |
| 478 | 386 | /** |
| 479 | 387 | * Check if the database is outdated |
| @@ -500,11 +408,8 @@ | ||
| 500 | 408 | /** |
| 501 | 409 | * Check both version number and DB number for changes |
| 502 | 410 | * |
| 503 | 411 | * @since 3.0.04 |
| 504 | - * | |
| 505 | - * @param array $atts | |
| 506 | - * @return bool | |
| 507 | 412 | */ |
| 508 | 413 | public static function compare_for_update( $atts ) { |
| 509 | 414 | $db_version = get_option( $atts['option'] ); |
| 510 | 415 | |
| @@ -523,10 +428,8 @@ | ||
| 523 | 428 | /** |
| 524 | 429 | * Check for database update and trigger js loading |
| 525 | 430 | * |
| 526 | 431 | * @since 2.0.1 |
| 527 | - * | |
| 528 | - * @return void | |
| 529 | 432 | */ |
| 530 | 433 | public static function admin_init() { |
| 531 | 434 | if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) { |
| 532 | 435 | FrmFormsController::duplicate(); |
| @@ -531,13 +434,8 @@ | ||
| 531 | 434 | if ( FrmAppHelper::is_admin_page( 'formidable' ) && 'duplicate' === FrmAppHelper::get_param( 'frm_action' ) ) { |
| 532 | 435 | FrmFormsController::duplicate(); |
| 533 | 436 | } |
| 534 | 437 | |
| 535 | - if ( FrmAppHelper::is_style_editor_page() && 'save' === FrmAppHelper::get_param( 'frm_action' ) ) { | |
| 536 | - // Hook in earlier than FrmStylesController::route so we can redirect before the headers have been sent. | |
| 537 | - FrmStylesController::save_style(); | |
| 538 | - } | |
| 539 | - | |
| 540 | 438 | new FrmPersonalData(); // register personal data hooks |
| 541 | 439 | |
| 542 | 440 | if ( ! FrmAppHelper::doing_ajax() && self::needs_update() ) { |
| 543 | 441 | self::network_upgrade_site(); |
| @@ -557,74 +455,13 @@ | ||
| 557 | 455 | } |
| 558 | 456 | |
| 559 | 457 | FrmInbox::maybe_disable_screen_options(); |
| 560 | 458 | } |
| 561 | - | |
| 562 | - self::maybe_add_ip_warning(); | |
| 563 | 459 | } |
| 564 | 460 | |
| 565 | 461 | /** |
| 566 | - * Show a warning for the IP address setting if it hasn't been set. | |
| 567 | - * | |
| 568 | - * @since 6.1 | |
| 569 | - * | |
| 570 | 462 | * @return void |
| 571 | 463 | */ |
| 572 | - private static function maybe_add_ip_warning() { | |
| 573 | - $settings = FrmAppHelper::get_settings(); | |
| 574 | - if ( false !== $settings->custom_header_ip ) { | |
| 575 | - // The setting has been changed from the false default (to either 1 or 0), so stop showing the message. | |
| 576 | - return; | |
| 577 | - } | |
| 578 | - | |
| 579 | - if ( ! self::is_behind_proxy() ) { | |
| 580 | - // This message is only applicable when using a reverse proxy. | |
| 581 | - return; | |
| 582 | - } | |
| 583 | - | |
| 584 | - if ( FrmAppHelper::get_post_param( 'frm_action', '', 'sanitize_text_field' ) ) { | |
| 585 | - // Avoid the message on a POST action. We don't want to show the message if we're saving global settings. | |
| 586 | - return; | |
| 587 | - } | |
| 588 | - | |
| 589 | - $global_settings_link = admin_url( 'admin.php?page=formidable-settings' ) . '#frm_custom_header_ip'; | |
| 590 | - $message = sprintf( | |
| 591 | - // Translators: 1: Global Settings Link | |
| 592 | - __( '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' ), | |
| 593 | - '<a href="' . esc_url( $global_settings_link ) . '">Global Settings</a>' | |
| 594 | - ); | |
| 595 | - $option_name = 'frm_dismiss_ip_address_notice'; | |
| 596 | - FrmAppHelper::add_dismissable_warning_message( $message, $option_name ); | |
| 597 | - } | |
| 598 | - | |
| 599 | - /** | |
| 600 | - * Check if any reverse proxy headers are set. | |
| 601 | - * | |
| 602 | - * @since 6.1 | |
| 603 | - * | |
| 604 | - * @return bool | |
| 605 | - */ | |
| 606 | - private static function is_behind_proxy() { | |
| 607 | - $custom_headers = FrmAppHelper::get_custom_header_keys_for_ip(); | |
| 608 | - foreach ( $custom_headers as $header ) { | |
| 609 | - if ( 'REMOTE_ADDR' === $header ) { | |
| 610 | - // We want to check every key but REMOTE_ADDR. REMOTE_ATTR is not unique to reverse proxy servers. | |
| 611 | - continue; | |
| 612 | - } | |
| 613 | - | |
| 614 | - $ip = trim( FrmAppHelper::get_server_value( $header ) ); | |
| 615 | - // Return true for anything that isn't empty but ignoring values like ::1. | |
| 616 | - if ( $ip && 0 !== strpos( $ip, '::' ) ) { | |
| 617 | - return true; | |
| 618 | - } | |
| 619 | - } | |
| 620 | - | |
| 621 | - return false; | |
| 622 | - } | |
| 623 | - | |
| 624 | - /** | |
| 625 | - * @return void | |
| 626 | - */ | |
| 627 | 464 | public static function admin_js() { |
| 628 | 465 | $plugin_url = FrmAppHelper::plugin_url(); |
| 629 | 466 | $version = FrmAppHelper::plugin_version(); |
| 630 | 467 | |
| @@ -639,23 +476,11 @@ | ||
| 639 | 476 | wp_register_script( 'formidable_dom', $plugin_url . '/js/admin/dom.js', array( 'jquery', 'jquery-ui-dialog', 'wp-i18n' ), $version, true ); |
| 640 | 477 | wp_register_script( 'formidable_embed', $plugin_url . '/js/admin/embed.js', array( 'formidable_dom', 'jquery-ui-autocomplete' ), $version, true ); |
| 641 | 478 | self::register_popper1(); |
| 642 | 479 | wp_register_script( 'bootstrap_tooltip', $plugin_url . '/js/bootstrap.min.js', array( 'jquery', 'popper' ), '4.6.1', true ); |
| 643 | - wp_register_script( 'formidable_settings', $plugin_url . '/js/admin/settings.js', array(), $version, true ); | |
| 644 | 480 | |
| 645 | 481 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
| 646 | 482 | |
| 647 | - // Enqueue Floating Links. | |
| 648 | - $is_valid_page = | |
| 649 | - FrmAppHelper::is_formidable_admin() && | |
| 650 | - ! FrmAppHelper::is_style_editor_page() && | |
| 651 | - ! FrmAppHelper::is_admin_page( 'formidable-views-editor' ) && | |
| 652 | - ! FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); | |
| 653 | - if ( $is_valid_page && FrmAppHelper::is_formidable_branding() ) { | |
| 654 | - self::enqueue_floating_links( $plugin_url, $version ); | |
| 655 | - } | |
| 656 | - unset( $is_valid_page ); | |
| 657 | - | |
| 658 | 483 | if ( 'formidable-applications' === $page ) { |
| 659 | 484 | FrmApplicationsController::load_assets(); |
| 660 | 485 | return; |
| 661 | 486 | } |
| @@ -673,10 +498,9 @@ | ||
| 673 | 498 | 'formidable_dom', |
| 674 | 499 | 'formidable_embed', |
| 675 | 500 | ); |
| 676 | 501 | |
| 677 | - if ( FrmAppHelper::is_style_editor_page( 'edit' ) ) { | |
| 678 | - // We only need to load the color picker when editing styles. | |
| 502 | + if ( FrmAppHelper::is_admin_page( 'formidable-styles' ) || FrmAppHelper::is_admin_page( 'formidable-styles2' ) ) { | |
| 679 | 503 | $dependencies[] = 'wp-color-picker'; |
| 680 | 504 | } |
| 681 | 505 | |
| 682 | 506 | wp_register_script( 'formidable_admin', $plugin_url . '/js/formidable_admin.js', $dependencies, $version, true ); |
| @@ -729,64 +553,22 @@ | ||
| 729 | 553 | return; |
| 730 | 554 | } |
| 731 | 555 | |
| 732 | 556 | if ( $post_type === 'frm_display' ) { |
| 733 | - self::enqueue_legacy_views_assets(); | |
| 557 | + wp_enqueue_style( 'formidable-grids' ); | |
| 558 | + wp_enqueue_script( 'jquery-ui-draggable' ); | |
| 559 | + self::maybe_deregister_popper2(); | |
| 560 | + wp_enqueue_script( 'formidable_admin' ); | |
| 561 | + wp_enqueue_style( 'formidable-admin' ); | |
| 562 | + FrmAppHelper::localize_script( 'admin' ); | |
| 563 | + self::include_info_overlay(); | |
| 734 | 564 | } |
| 735 | 565 | } |
| 736 | 566 | |
| 737 | - } | |
| 738 | - | |
| 739 | - /** | |
| 740 | - * @since 6.3.2 | |
| 741 | - * | |
| 742 | - * @return void | |
| 743 | - */ | |
| 744 | - public static function admin_enqueue_scripts() { | |
| 745 | - self::load_wp_admin_style(); | |
| 746 | 567 | self::maybe_force_formidable_block_on_gutenberg_page(); |
| 747 | 568 | } |
| 748 | 569 | |
| 749 | 570 | /** |
| 750 | - * Enqueue required assets for the Legacy Views editor (Views v4.x). | |
| 751 | - * | |
| 752 | - * @since 6.1.2 | |
| 753 | - * | |
| 754 | - * @return void | |
| 755 | - */ | |
| 756 | - private static function enqueue_legacy_views_assets() { | |
| 757 | - wp_enqueue_style( 'formidable-grids' ); | |
| 758 | - wp_enqueue_script( 'jquery-ui-draggable' ); | |
| 759 | - self::maybe_deregister_popper2(); | |
| 760 | - wp_enqueue_script( 'formidable_admin' ); | |
| 761 | - wp_add_inline_style( | |
| 762 | - 'formidable-admin', | |
| 763 | - ' | |
| 764 | - .frm-white-body.post-type-frm_display .columns-2 { | |
| 765 | - display: block; | |
| 766 | - overflow: visible; | |
| 767 | - } | |
| 768 | - | |
| 769 | - .frm-white-body.post-type-frm_display .columns-2 > div { | |
| 770 | - overflow-y: hidden; | |
| 771 | - } | |
| 772 | - | |
| 773 | - .frm-white-body.post-type-frm_display #titlediv #title-prompt-text { | |
| 774 | - padding: 3px 0 0 10px; | |
| 775 | - } | |
| 776 | - | |
| 777 | - .post-type-frm_display #field-search-input, | |
| 778 | - .post-type-frm_display #advanced-search-input { | |
| 779 | - flex: 1; | |
| 780 | - } | |
| 781 | - ' | |
| 782 | - ); | |
| 783 | - wp_enqueue_style( 'formidable-admin' ); | |
| 784 | - FrmAppHelper::localize_script( 'admin' ); | |
| 785 | - self::include_info_overlay(); | |
| 786 | - } | |
| 787 | - | |
| 788 | - /** | |
| 789 | 571 | * Fix a Duplicator Pro conflict because it uses Popper 2. See issue #3459. |
| 790 | 572 | * |
| 791 | 573 | * @since 5.2.02.01 |
| 792 | 574 | * |
| @@ -840,12 +622,8 @@ | ||
| 840 | 622 | |
| 841 | 623 | /** |
| 842 | 624 | * @since 5.3 |
| 843 | 625 | * |
| 844 | - * @param string $block_name | |
| 845 | - * @param string $object_key | |
| 846 | - * @param array|string $object_id | |
| 847 | - * | |
| 848 | 626 | * @return void |
| 849 | 627 | */ |
| 850 | 628 | public static function add_js_to_inject_gutenberg_block( $block_name, $object_key, $object_id ) { |
| 851 | 629 | require FrmAppHelper::plugin_path() . '/classes/views/shared/edit-page-js.php'; |
| @@ -850,11 +628,8 @@ | ||
| 850 | 628 | public static function add_js_to_inject_gutenberg_block( $block_name, $object_key, $object_id ) { |
| 851 | 629 | require FrmAppHelper::plugin_path() . '/classes/views/shared/edit-page-js.php'; |
| 852 | 630 | } |
| 853 | 631 | |
| 854 | - /** | |
| 855 | - * @return void | |
| 856 | - */ | |
| 857 | 632 | public static function load_lang() { |
| 858 | 633 | load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
| 859 | 634 | } |
| 860 | 635 | |
| @@ -861,10 +636,8 @@ | ||
| 861 | 636 | /** |
| 862 | 637 | * Check if the styles are updated when a form is loaded on the front-end |
| 863 | 638 | * |
| 864 | 639 | * @since 3.0.1 |
| 865 | - * | |
| 866 | - * @return void | |
| 867 | 640 | */ |
| 868 | 641 | public static function maybe_update_styles() { |
| 869 | 642 | if ( self::needs_update() ) { |
| 870 | 643 | self::network_upgrade_site(); |
| @@ -872,10 +645,8 @@ | ||
| 872 | 645 | } |
| 873 | 646 | |
| 874 | 647 | /** |
| 875 | 648 | * @since 3.0 |
| 876 | - * | |
| 877 | - * @return void | |
| 878 | 649 | */ |
| 879 | 650 | public static function create_rest_routes() { |
| 880 | 651 | $args = array( |
| 881 | 652 | 'methods' => 'GET', |
| @@ -910,10 +681,8 @@ | ||
| 910 | 681 | * |
| 911 | 682 | * @since 2.0.1 |
| 912 | 683 | * |
| 913 | 684 | * @param int $blog_id Blog ID. |
| 914 | - * | |
| 915 | - * @return void | |
| 916 | 685 | */ |
| 917 | 686 | public static function network_upgrade_site( $blog_id = 0 ) { |
| 918 | 687 | // Flag to check if install is happening as intended. |
| 919 | 688 | set_transient( 'frm_updating_api', true, MINUTE_IN_SECONDS ); |
| @@ -937,10 +706,8 @@ | ||
| 937 | 706 | |
| 938 | 707 | /** |
| 939 | 708 | * Make sure WP_Site_Health has been included because it is required when calling rest_do_request. |
| 940 | 709 | * Check first that the file exists because WP_Site_Health was only introduced in WordPress 5.2. |
| 941 | - * | |
| 942 | - * @return void | |
| 943 | 710 | */ |
| 944 | 711 | private static function maybe_add_wp_site_health() { |
| 945 | 712 | if ( ! class_exists( 'WP_Site_Health' ) ) { |
| 946 | 713 | $wp_site_health_path = ABSPATH . 'wp-admin/includes/class-wp-site-health.php'; |
| @@ -951,10 +718,8 @@ | ||
| 951 | 718 | } |
| 952 | 719 | |
| 953 | 720 | /** |
| 954 | 721 | * @since 3.0 |
| 955 | - * | |
| 956 | - * @return true | |
| 957 | 722 | */ |
| 958 | 723 | public static function api_install() { |
| 959 | 724 | delete_transient( 'frm_updating_api' ); |
| 960 | 725 | if ( self::needs_update() ) { |
| @@ -973,29 +738,19 @@ | ||
| 973 | 738 | * Silent database upgrade (no redirect). |
| 974 | 739 | * Called via ajax request during network upgrade process. |
| 975 | 740 | * |
| 976 | 741 | * @since 2.0.1 |
| 977 | - * | |
| 978 | - * @return void | |
| 979 | 742 | */ |
| 980 | 743 | public static function ajax_install() { |
| 981 | - FrmAppHelper::permission_check( 'frm_change_settings' ); | |
| 982 | - check_ajax_referer( 'frm_ajax', 'nonce' ); | |
| 983 | 744 | self::api_install(); |
| 984 | 745 | wp_die(); |
| 985 | 746 | } |
| 986 | 747 | |
| 987 | - /** | |
| 988 | - * @return void | |
| 989 | - */ | |
| 990 | 748 | public static function install() { |
| 991 | 749 | $frmdb = new FrmMigrate(); |
| 992 | 750 | $frmdb->upgrade(); |
| 993 | 751 | } |
| 994 | 752 | |
| 995 | - /** | |
| 996 | - * @return void | |
| 997 | - */ | |
| 998 | 753 | public static function uninstall() { |
| 999 | 754 | FrmAppHelper::permission_check( 'administrator' ); |
| 1000 | 755 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 1001 | 756 | |
| @@ -1019,11 +774,8 @@ | ||
| 1019 | 774 | |
| 1020 | 775 | return $tables; |
| 1021 | 776 | } |
| 1022 | 777 | |
| 1023 | - /** | |
| 1024 | - * @return void | |
| 1025 | - */ | |
| 1026 | 778 | public static function deauthorize() { |
| 1027 | 779 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 1028 | 780 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 1029 | 781 | |
| @@ -1033,33 +785,8 @@ | ||
| 1033 | 785 | delete_site_option( 'frmpro-authorized' ); |
| 1034 | 786 | wp_die(); |
| 1035 | 787 | } |
| 1036 | 788 | |
| 1037 | - /** | |
| 1038 | - * This is triggered when Formidable is activated. | |
| 1039 | - * | |
| 1040 | - * @return void | |
| 1041 | - */ | |
| 1042 | - public static function handle_activation() { | |
| 1043 | - self::maybe_activate_payment_cron(); | |
| 1044 | - } | |
| 1045 | - | |
| 1046 | - /** | |
| 1047 | - * The payment cron is unscheduled when Formidable is deactivated. | |
| 1048 | - * We need to add it back again on activation if Stripe is configured. | |
| 1049 | - * | |
| 1050 | - * @since 6.5 | |
| 1051 | - * | |
| 1052 | - * @return void | |
| 1053 | - */ | |
| 1054 | - private static function maybe_activate_payment_cron() { | |
| 1055 | - if ( ! FrmStrpLiteConnectHelper::stripe_connect_is_setup() ) { | |
| 1056 | - return; | |
| 1057 | - } | |
| 1058 | - | |
| 1059 | - FrmTransLiteAppController::maybe_schedule_cron(); | |
| 1060 | - } | |
| 1061 | - | |
| 1062 | 789 | public static function set_footer_text( $text ) { |
| 1063 | 790 | if ( FrmAppHelper::is_formidable_admin() ) { |
| 1064 | 791 | $text = ''; |
| 1065 | 792 | } |
| @@ -1067,36 +794,36 @@ | ||
| 1067 | 794 | return $text; |
| 1068 | 795 | } |
| 1069 | 796 | |
| 1070 | 797 | /** |
| 1071 | - * Add admin footer links. | |
| 1072 | - * | |
| 1073 | - * @since 6.4.1 | |
| 1074 | - * | |
| 1075 | - * @return void | |
| 798 | + * @deprecated 1.07.05 | |
| 799 | + * @codeCoverageIgnore | |
| 1076 | 800 | */ |
| 1077 | - public static function add_admin_footer_links() { | |
| 1078 | - $post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' ); | |
| 801 | + public static function get_form_shortcode( $atts ) { | |
| 802 | + return FrmDeprecated::get_form_shortcode( $atts ); | |
| 803 | + } | |
| 1079 | 804 | |
| 1080 | - // Check admin privileges, screen mode, and branding | |
| 1081 | - $is_not_admin = ! FrmAppHelper::is_formidable_admin() && $post_type !== 'frm_logs'; | |
| 1082 | - $is_full_screen = FrmAppHelper::is_full_screen(); | |
| 1083 | - $is_not_formidable_branding = ! FrmAppHelper::is_formidable_branding(); | |
| 805 | + /** | |
| 806 | + * @deprecated 2.5.4 | |
| 807 | + * @codeCoverageIgnore | |
| 808 | + */ | |
| 809 | + public static function widget_text_filter( $content ) { | |
| 810 | + return FrmDeprecated::widget_text_filter( $content ); | |
| 811 | + } | |
| 1084 | 812 | |
| 1085 | - // Exit if any of the above conditions are met | |
| 1086 | - if ( $is_not_admin || $is_full_screen || $is_not_formidable_branding ) { | |
| 1087 | - return; | |
| 1088 | - } | |
| 1089 | - | |
| 1090 | - include FrmAppHelper::plugin_path() . '/classes/views/shared/admin-footer-links.php'; | |
| 813 | + /** | |
| 814 | + * Deprecated in favor of wpmu_upgrade_site | |
| 815 | + * | |
| 816 | + * @deprecated 2.3 | |
| 817 | + * @codeCoverageIgnore | |
| 818 | + */ | |
| 819 | + public static function front_head() { | |
| 820 | + FrmDeprecated::front_head(); | |
| 1091 | 821 | } |
| 1092 | 822 | |
| 1093 | 823 | /** |
| 1094 | 824 | * @deprecated 3.0.04 |
| 1095 | - * | |
| 1096 | 825 | * @codeCoverageIgnore |
| 1097 | - * | |
| 1098 | - * @return void | |
| 1099 | 826 | */ |
| 1100 | 827 | public static function activation_install() { |
| 1101 | 828 | FrmDeprecated::activation_install(); |
| 1102 | 829 | } |
| @@ -1117,48 +844,6 @@ | ||
| 1117 | 844 | * @return void |
| 1118 | 845 | */ |
| 1119 | 846 | public static function include_embed_form_icons() { |
| 1120 | 847 | _deprecated_function( __METHOD__, '5.3' ); |
| 1121 | - } | |
| 1122 | - | |
| 1123 | - /** | |
| 1124 | - * @deprecated 1.07.05 This is still referenced in the API add on as of v1.13. | |
| 1125 | - * @codeCoverageIgnore | |
| 1126 | - * | |
| 1127 | - * @param array $atts | |
| 1128 | - * @return string | |
| 1129 | - */ | |
| 1130 | - public static function get_form_shortcode( $atts ) { | |
| 1131 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode' ); | |
| 1132 | - return FrmFormsController::get_form_shortcode( $atts ); | |
| 1133 | - } | |
| 1134 | - | |
| 1135 | - /** | |
| 1136 | - * Handles Floating Links' scripts and styles enqueueing. | |
| 1137 | - * | |
| 1138 | - * @since 6.4 | |
| 1139 | - * | |
| 1140 | - * @param string $plugin_url URL of the plugin. | |
| 1141 | - * @param string $version Current version of the plugin. | |
| 1142 | - * @return void | |
| 1143 | - */ | |
| 1144 | - private static function enqueue_floating_links( $plugin_url, $version ) { | |
| 1145 | - if ( ! $plugin_url || ! $version ) { | |
| 1146 | - // If any required parameters are missing, exit early. | |
| 1147 | - return; | |
| 1148 | - } | |
| 1149 | - | |
| 1150 | - // Enqueue the Floating Links styles. | |
| 1151 | - wp_enqueue_style( 's11-floating-links', $plugin_url . '/css/packages/s11-floating-links.css', array(), $version ); | |
| 1152 | - | |
| 1153 | - // Enqueue the Floating Links script. | |
| 1154 | - wp_enqueue_script( 's11-floating-links', $plugin_url . '/js/packages/floating-links/s11-floating-links.js', array(), $version, true ); | |
| 1155 | - | |
| 1156 | - // Enqueue the config script. | |
| 1157 | - wp_enqueue_script( 's11-floating-links-config', $plugin_url . '/js/packages/floating-links/config.js', array( 'wp-i18n' ), $version, true ); | |
| 1158 | - wp_set_script_translations( 's11-floating-links-config', 's11-' ); | |
| 1159 | - $floating_links_data = array( | |
| 1160 | - 'proIsInstalled' => FrmAppHelper::pro_is_installed(), | |
| 1161 | - ); | |
| 1162 | - wp_localize_script( 's11-floating-links-config', 's11FloatingLinksData', $floating_links_data ); | |
| 1163 | 848 | } |
| 1164 | 849 | } |