@@ -3,14 +3,14 @@ discard block |
||
| 3 | 3 | class FrmAppController { |
| 4 | 4 | |
| 5 | 5 | public static function menu() { |
| 6 | - FrmAppHelper::maybe_add_permissions(); |
|
| 7 | - if ( ! current_user_can( 'frm_view_forms' ) ) { |
|
| 8 | - return; |
|
| 9 | - } |
|
| 6 | + FrmAppHelper::maybe_add_permissions(); |
|
| 7 | + if ( ! current_user_can( 'frm_view_forms' ) ) { |
|
| 8 | + return; |
|
| 9 | + } |
|
| 10 | 10 | |
| 11 | 11 | $menu_name = FrmAppHelper::get_menu_name(); |
| 12 | 12 | add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', '', self::get_menu_position() ); |
| 13 | - } |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | 15 | private static function get_menu_position() { |
| 16 | 16 | return apply_filters( 'frm_menu_position', '29.3' ); |
@@ -39,15 +39,15 @@ discard block |
||
| 39 | 39 | return $is_white_page; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public static function load_wp_admin_style() { |
|
| 43 | - FrmAppHelper::load_font_style(); |
|
| 44 | - } |
|
| 42 | + public static function load_wp_admin_style() { |
|
| 43 | + FrmAppHelper::load_font_style(); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) { |
| 47 | 47 | $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' ); |
| 48 | - if ( empty( $show_nav ) || ! $form ) { |
|
| 49 | - return; |
|
| 50 | - } |
|
| 48 | + if ( empty( $show_nav ) || ! $form ) { |
|
| 49 | + return; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | 52 | FrmForm::maybe_get_form( $form ); |
| 53 | 53 | if ( ! is_object( $form ) ) { |
@@ -108,22 +108,22 @@ discard block |
||
| 108 | 108 | return apply_filters( 'frm_form_nav_list', $nav_items, $nav_args ); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - // Adds a settings link to the plugins page |
|
| 112 | - public static function settings_link( $links ) { |
|
| 111 | + // Adds a settings link to the plugins page |
|
| 112 | + public static function settings_link( $links ) { |
|
| 113 | 113 | $settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>'; |
| 114 | - array_unshift( $links, $settings ); |
|
| 114 | + array_unshift( $links, $settings ); |
|
| 115 | 115 | |
| 116 | - return $links; |
|
| 117 | - } |
|
| 116 | + return $links; |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - public static function pro_get_started_headline() { |
|
| 119 | + public static function pro_get_started_headline() { |
|
| 120 | 120 | self::maybe_show_upgrade_bar(); |
| 121 | 121 | self::review_request(); |
| 122 | 122 | |
| 123 | - // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
| 124 | - if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
| 125 | - return; |
|
| 126 | - } |
|
| 123 | + // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
| 124 | + if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
| 125 | + return; |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | 128 | $pro_installed = is_dir( WP_PLUGIN_DIR . '/formidable-pro' ); |
| 129 | 129 | $authorized = get_site_option( 'frmpro-authorized' ) && ! is_callable( 'load_formidable_pro' ); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/?utm_source=WordPress&utm_medium=get-started&utm_campaign=liteplugin'; |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | - ?> |
|
| 149 | + ?> |
|
| 150 | 150 | <div class="error frm_previous_install"> |
| 151 | 151 | <?php |
| 152 | 152 | echo apply_filters( // WPCS: XSS ok. |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | <div id="frm_install_message" class="hidden frm_hidden"></div> |
| 165 | 165 | </div> |
| 166 | 166 | <?php |
| 167 | - } |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | 169 | private static function maybe_show_upgrade_bar() { |
| 170 | 170 | if ( ! FrmAppHelper::is_formidable_admin() || FrmAppHelper::pro_is_installed() ) { |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - public static function admin_js() { |
|
| 300 | + public static function admin_js() { |
|
| 301 | 301 | $version = FrmAppHelper::plugin_version(); |
| 302 | 302 | FrmAppHelper::load_admin_wide_js( false ); |
| 303 | 303 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | wp_register_script( 'formidable_admin', FrmAppHelper::plugin_url() . '/js/formidable_admin.js', $dependecies, $version, true ); |
| 320 | 320 | wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version ); |
| 321 | - wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 321 | + wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 322 | 322 | wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version ); |
| 323 | 323 | |
| 324 | 324 | // load multselect js |
@@ -330,10 +330,10 @@ discard block |
||
| 330 | 330 | global $pagenow; |
| 331 | 331 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) { |
| 332 | 332 | |
| 333 | - wp_enqueue_script( 'admin-widgets' ); |
|
| 334 | - wp_enqueue_style( 'widgets' ); |
|
| 335 | - wp_enqueue_script( 'formidable' ); |
|
| 336 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 333 | + wp_enqueue_script( 'admin-widgets' ); |
|
| 334 | + wp_enqueue_style( 'widgets' ); |
|
| 335 | + wp_enqueue_script( 'formidable' ); |
|
| 336 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 337 | 337 | FrmAppHelper::localize_script( 'admin' ); |
| 338 | 338 | |
| 339 | 339 | wp_enqueue_style( 'formidable-admin' ); |
@@ -348,36 +348,36 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 351 | + wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 352 | 352 | |
| 353 | 353 | do_action( 'frm_enqueue_builder_scripts' ); |
| 354 | - } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 355 | - if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 356 | - $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 354 | + } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 355 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 356 | + $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 357 | 357 | } else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) { |
| 358 | 358 | $post = get_post( absint( $_REQUEST['post'] ) ); |
| 359 | - if ( ! $post ) { |
|
| 360 | - return; |
|
| 361 | - } |
|
| 362 | - $post_type = $post->post_type; |
|
| 363 | - } else { |
|
| 364 | - return; |
|
| 365 | - } |
|
| 366 | - |
|
| 367 | - if ( $post_type == 'frm_display' ) { |
|
| 368 | - wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 369 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 370 | - wp_enqueue_style( 'formidable-admin' ); |
|
| 359 | + if ( ! $post ) { |
|
| 360 | + return; |
|
| 361 | + } |
|
| 362 | + $post_type = $post->post_type; |
|
| 363 | + } else { |
|
| 364 | + return; |
|
| 365 | + } |
|
| 366 | + |
|
| 367 | + if ( $post_type == 'frm_display' ) { |
|
| 368 | + wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 369 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 370 | + wp_enqueue_style( 'formidable-admin' ); |
|
| 371 | 371 | FrmAppHelper::localize_script( 'admin' ); |
| 372 | - } |
|
| 373 | - } else if ( $pagenow == 'widgets.php' ) { |
|
| 374 | - FrmAppHelper::load_admin_wide_js(); |
|
| 375 | - } |
|
| 376 | - } |
|
| 372 | + } |
|
| 373 | + } else if ( $pagenow == 'widgets.php' ) { |
|
| 374 | + FrmAppHelper::load_admin_wide_js(); |
|
| 375 | + } |
|
| 376 | + } |
|
| 377 | 377 | |
| 378 | - public static function load_lang() { |
|
| 379 | - load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 380 | - } |
|
| 378 | + public static function load_lang() { |
|
| 379 | + load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 380 | + } |
|
| 381 | 381 | |
| 382 | 382 | /** |
| 383 | 383 | * Check if the styles are updated when a form is loaded on the front-end |
@@ -453,14 +453,14 @@ discard block |
||
| 453 | 453 | wp_die(); |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - public static function install() { |
|
| 457 | - $frmdb = new FrmMigrate(); |
|
| 458 | - $frmdb->upgrade(); |
|
| 459 | - } |
|
| 456 | + public static function install() { |
|
| 457 | + $frmdb = new FrmMigrate(); |
|
| 458 | + $frmdb->upgrade(); |
|
| 459 | + } |
|
| 460 | 460 | |
| 461 | - public static function uninstall() { |
|
| 461 | + public static function uninstall() { |
|
| 462 | 462 | FrmAppHelper::permission_check( 'administrator' ); |
| 463 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 463 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 464 | 464 | |
| 465 | 465 | $frmdb = new FrmMigrate(); |
| 466 | 466 | $frmdb->uninstall(); |
@@ -469,28 +469,28 @@ discard block |
||
| 469 | 469 | deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false ); |
| 470 | 470 | echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) ); |
| 471 | 471 | |
| 472 | - wp_die(); |
|
| 473 | - } |
|
| 472 | + wp_die(); |
|
| 473 | + } |
|
| 474 | 474 | |
| 475 | - public static function drop_tables( $tables ) { |
|
| 476 | - global $wpdb; |
|
| 477 | - $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 478 | - $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 479 | - $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 480 | - $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 481 | - return $tables; |
|
| 482 | - } |
|
| 475 | + public static function drop_tables( $tables ) { |
|
| 476 | + global $wpdb; |
|
| 477 | + $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 478 | + $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 479 | + $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 480 | + $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 481 | + return $tables; |
|
| 482 | + } |
|
| 483 | 483 | |
| 484 | - public static function deauthorize() { |
|
| 484 | + public static function deauthorize() { |
|
| 485 | 485 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 486 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 486 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 487 | 487 | |
| 488 | - delete_option( 'frmpro-credentials' ); |
|
| 489 | - delete_option( 'frmpro-authorized' ); |
|
| 490 | - delete_site_option( 'frmpro-credentials' ); |
|
| 491 | - delete_site_option( 'frmpro-authorized' ); |
|
| 492 | - wp_die(); |
|
| 493 | - } |
|
| 488 | + delete_option( 'frmpro-credentials' ); |
|
| 489 | + delete_option( 'frmpro-authorized' ); |
|
| 490 | + delete_site_option( 'frmpro-credentials' ); |
|
| 491 | + delete_site_option( 'frmpro-authorized' ); |
|
| 492 | + wp_die(); |
|
| 493 | + } |
|
| 494 | 494 | |
| 495 | 495 | public static function set_footer_text( $text ) { |
| 496 | 496 | if ( FrmAppHelper::is_formidable_admin() ) { |
@@ -512,9 +512,9 @@ discard block |
||
| 512 | 512 | * @deprecated 1.07.05 |
| 513 | 513 | * @codeCoverageIgnore |
| 514 | 514 | */ |
| 515 | - public static function get_form_shortcode( $atts ) { |
|
| 516 | - return FrmDeprecated::get_form_shortcode( $atts ); |
|
| 517 | - } |
|
| 515 | + public static function get_form_shortcode( $atts ) { |
|
| 516 | + return FrmDeprecated::get_form_shortcode( $atts ); |
|
| 517 | + } |
|
| 518 | 518 | |
| 519 | 519 | /** |
| 520 | 520 | * @deprecated 2.5.4 |
@@ -153,7 +153,7 @@ |
||
| 153 | 153 | 'frm_pro_update_msg', |
| 154 | 154 | sprintf( |
| 155 | 155 | esc_html__( 'This site has been previously authorized to run Formidable Forms. %1$sInstall Formidable Pro%2$s or %3$sdeauthorize%4$s this site to continue running the free version and remove this message.', 'formidable' ), |
| 156 | - '<br/><a href="' . esc_url( $inst_install_url ) . '" id="frm_install_link" target="_blank" data-prourl="'. esc_url( $download_url ) .'">', |
|
| 156 | + '<br/><a href="' . esc_url( $inst_install_url ) . '" id="frm_install_link" target="_blank" data-prourl="' . esc_url( $download_url ) . '">', |
|
| 157 | 157 | '</a>', |
| 158 | 158 | '<a href="#" class="frm_deauthorize_link">', |
| 159 | 159 | '</a>' |