@@ -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::menu_icon(), 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' ); |
@@ -48,15 +48,15 @@ discard block |
||
| 48 | 48 | return $is_white_page; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public static function load_wp_admin_style() { |
|
| 52 | - FrmAppHelper::load_font_style(); |
|
| 53 | - } |
|
| 51 | + public static function load_wp_admin_style() { |
|
| 52 | + FrmAppHelper::load_font_style(); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) { |
| 56 | 56 | $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' ); |
| 57 | - if ( empty( $show_nav ) || ! $form ) { |
|
| 58 | - return; |
|
| 59 | - } |
|
| 57 | + if ( empty( $show_nav ) || ! $form ) { |
|
| 58 | + return; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | FrmForm::maybe_get_form( $form ); |
| 62 | 62 | if ( ! is_object( $form ) ) { |
@@ -117,22 +117,22 @@ discard block |
||
| 117 | 117 | return apply_filters( 'frm_form_nav_list', $nav_items, $nav_args ); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - // Adds a settings link to the plugins page |
|
| 121 | - public static function settings_link( $links ) { |
|
| 120 | + // Adds a settings link to the plugins page |
|
| 121 | + public static function settings_link( $links ) { |
|
| 122 | 122 | $settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>'; |
| 123 | - array_unshift( $links, $settings ); |
|
| 123 | + array_unshift( $links, $settings ); |
|
| 124 | 124 | |
| 125 | - return $links; |
|
| 126 | - } |
|
| 125 | + return $links; |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - public static function pro_get_started_headline() { |
|
| 128 | + public static function pro_get_started_headline() { |
|
| 129 | 129 | self::maybe_show_upgrade_bar(); |
| 130 | 130 | self::review_request(); |
| 131 | 131 | |
| 132 | - // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
| 133 | - if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
| 134 | - return; |
|
| 135 | - } |
|
| 132 | + // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
| 133 | + if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
| 134 | + return; |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | 137 | $pro_installed = is_dir( WP_PLUGIN_DIR . '/formidable-pro' ); |
| 138 | 138 | $authorized = get_site_option( 'frmpro-authorized' ) && ! is_callable( 'load_formidable_pro' ); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/?utm_source=WordPress&utm_medium=get-started&utm_campaign=liteplugin'; |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | - ?> |
|
| 158 | + ?> |
|
| 159 | 159 | <div class="error frm_previous_install"> |
| 160 | 160 | <?php |
| 161 | 161 | echo apply_filters( // WPCS: XSS ok. |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | <div id="frm_install_message" class="hidden frm_hidden"></div> |
| 174 | 174 | </div> |
| 175 | 175 | <?php |
| 176 | - } |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | 178 | private static function maybe_show_upgrade_bar() { |
| 179 | 179 | if ( ! FrmAppHelper::is_formidable_admin() || FrmAppHelper::pro_is_installed() ) { |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - public static function admin_js() { |
|
| 325 | + public static function admin_js() { |
|
| 326 | 326 | $version = FrmAppHelper::plugin_version(); |
| 327 | 327 | FrmAppHelper::load_admin_wide_js( false ); |
| 328 | 328 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | wp_register_script( 'formidable_admin', FrmAppHelper::plugin_url() . '/js/formidable_admin.js', $dependecies, $version, true ); |
| 345 | 345 | wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version ); |
| 346 | - wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 346 | + wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 347 | 347 | wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version ); |
| 348 | 348 | |
| 349 | 349 | // load multselect js |
@@ -355,10 +355,10 @@ discard block |
||
| 355 | 355 | global $pagenow; |
| 356 | 356 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) { |
| 357 | 357 | |
| 358 | - wp_enqueue_script( 'admin-widgets' ); |
|
| 359 | - wp_enqueue_style( 'widgets' ); |
|
| 360 | - wp_enqueue_script( 'formidable' ); |
|
| 361 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 358 | + wp_enqueue_script( 'admin-widgets' ); |
|
| 359 | + wp_enqueue_style( 'widgets' ); |
|
| 360 | + wp_enqueue_script( 'formidable' ); |
|
| 361 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 362 | 362 | FrmAppHelper::localize_script( 'admin' ); |
| 363 | 363 | |
| 364 | 364 | wp_enqueue_style( 'formidable-admin' ); |
@@ -373,36 +373,36 @@ discard block |
||
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 376 | + wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 377 | 377 | |
| 378 | 378 | do_action( 'frm_enqueue_builder_scripts' ); |
| 379 | - } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 380 | - if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 381 | - $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 379 | + } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 380 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 381 | + $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 382 | 382 | } else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) { |
| 383 | 383 | $post = get_post( absint( $_REQUEST['post'] ) ); |
| 384 | - if ( ! $post ) { |
|
| 385 | - return; |
|
| 386 | - } |
|
| 387 | - $post_type = $post->post_type; |
|
| 388 | - } else { |
|
| 389 | - return; |
|
| 390 | - } |
|
| 391 | - |
|
| 392 | - if ( $post_type == 'frm_display' ) { |
|
| 393 | - wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 394 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 395 | - wp_enqueue_style( 'formidable-admin' ); |
|
| 384 | + if ( ! $post ) { |
|
| 385 | + return; |
|
| 386 | + } |
|
| 387 | + $post_type = $post->post_type; |
|
| 388 | + } else { |
|
| 389 | + return; |
|
| 390 | + } |
|
| 391 | + |
|
| 392 | + if ( $post_type == 'frm_display' ) { |
|
| 393 | + wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 394 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 395 | + wp_enqueue_style( 'formidable-admin' ); |
|
| 396 | 396 | FrmAppHelper::localize_script( 'admin' ); |
| 397 | - } |
|
| 398 | - } else if ( $pagenow == 'widgets.php' ) { |
|
| 399 | - FrmAppHelper::load_admin_wide_js(); |
|
| 400 | - } |
|
| 401 | - } |
|
| 397 | + } |
|
| 398 | + } else if ( $pagenow == 'widgets.php' ) { |
|
| 399 | + FrmAppHelper::load_admin_wide_js(); |
|
| 400 | + } |
|
| 401 | + } |
|
| 402 | 402 | |
| 403 | - public static function load_lang() { |
|
| 404 | - load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 405 | - } |
|
| 403 | + public static function load_lang() { |
|
| 404 | + load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 405 | + } |
|
| 406 | 406 | |
| 407 | 407 | /** |
| 408 | 408 | * Check if the styles are updated when a form is loaded on the front-end |
@@ -478,14 +478,14 @@ discard block |
||
| 478 | 478 | wp_die(); |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - public static function install() { |
|
| 482 | - $frmdb = new FrmMigrate(); |
|
| 483 | - $frmdb->upgrade(); |
|
| 484 | - } |
|
| 481 | + public static function install() { |
|
| 482 | + $frmdb = new FrmMigrate(); |
|
| 483 | + $frmdb->upgrade(); |
|
| 484 | + } |
|
| 485 | 485 | |
| 486 | - public static function uninstall() { |
|
| 486 | + public static function uninstall() { |
|
| 487 | 487 | FrmAppHelper::permission_check( 'administrator' ); |
| 488 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 488 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 489 | 489 | |
| 490 | 490 | $frmdb = new FrmMigrate(); |
| 491 | 491 | $frmdb->uninstall(); |
@@ -494,28 +494,28 @@ discard block |
||
| 494 | 494 | deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false ); |
| 495 | 495 | echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) ); |
| 496 | 496 | |
| 497 | - wp_die(); |
|
| 498 | - } |
|
| 497 | + wp_die(); |
|
| 498 | + } |
|
| 499 | 499 | |
| 500 | - public static function drop_tables( $tables ) { |
|
| 501 | - global $wpdb; |
|
| 502 | - $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 503 | - $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 504 | - $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 505 | - $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 506 | - return $tables; |
|
| 507 | - } |
|
| 500 | + public static function drop_tables( $tables ) { |
|
| 501 | + global $wpdb; |
|
| 502 | + $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 503 | + $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 504 | + $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 505 | + $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 506 | + return $tables; |
|
| 507 | + } |
|
| 508 | 508 | |
| 509 | - public static function deauthorize() { |
|
| 509 | + public static function deauthorize() { |
|
| 510 | 510 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 511 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 511 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 512 | 512 | |
| 513 | - delete_option( 'frmpro-credentials' ); |
|
| 514 | - delete_option( 'frmpro-authorized' ); |
|
| 515 | - delete_site_option( 'frmpro-credentials' ); |
|
| 516 | - delete_site_option( 'frmpro-authorized' ); |
|
| 517 | - wp_die(); |
|
| 518 | - } |
|
| 513 | + delete_option( 'frmpro-credentials' ); |
|
| 514 | + delete_option( 'frmpro-authorized' ); |
|
| 515 | + delete_site_option( 'frmpro-credentials' ); |
|
| 516 | + delete_site_option( 'frmpro-authorized' ); |
|
| 517 | + wp_die(); |
|
| 518 | + } |
|
| 519 | 519 | |
| 520 | 520 | public static function set_footer_text( $text ) { |
| 521 | 521 | if ( FrmAppHelper::is_formidable_admin() ) { |
@@ -537,9 +537,9 @@ discard block |
||
| 537 | 537 | * @deprecated 1.07.05 |
| 538 | 538 | * @codeCoverageIgnore |
| 539 | 539 | */ |
| 540 | - public static function get_form_shortcode( $atts ) { |
|
| 541 | - return FrmDeprecated::get_form_shortcode( $atts ); |
|
| 542 | - } |
|
| 540 | + public static function get_form_shortcode( $atts ) { |
|
| 541 | + return FrmDeprecated::get_form_shortcode( $atts ); |
|
| 542 | + } |
|
| 543 | 543 | |
| 544 | 544 | /** |
| 545 | 545 | * @deprecated 2.5.4 |