@@ -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,21 +108,21 @@ 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 | |
| 122 | - // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
| 123 | - if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
| 124 | - return; |
|
| 125 | - } |
|
| 122 | + // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
| 123 | + if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
| 124 | + return; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | 127 | $pro_installed = is_dir( WP_PLUGIN_DIR . '/formidable-pro' ); |
| 128 | 128 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } else { |
| 138 | 138 | $inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/'; |
| 139 | 139 | } |
| 140 | - ?> |
|
| 140 | + ?> |
|
| 141 | 141 | <div class="error" class="frm_previous_install"> |
| 142 | 142 | <?php |
| 143 | 143 | echo apply_filters( // WPCS: XSS ok. |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | ?> |
| 155 | 155 | </div> |
| 156 | 156 | <?php |
| 157 | - } |
|
| 158 | - } |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | 160 | private static function maybe_show_upgrade_bar() { |
| 161 | 161 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - public static function admin_js() { |
|
| 254 | + public static function admin_js() { |
|
| 255 | 255 | $version = FrmAppHelper::plugin_version(); |
| 256 | 256 | FrmAppHelper::load_admin_wide_js( false ); |
| 257 | 257 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | wp_register_script( 'formidable_admin', FrmAppHelper::plugin_url() . '/js/formidable_admin.js', $dependecies, $version, true ); |
| 274 | 274 | wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version ); |
| 275 | - wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 275 | + wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 276 | 276 | wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version ); |
| 277 | 277 | |
| 278 | 278 | // load multselect js |
@@ -284,10 +284,10 @@ discard block |
||
| 284 | 284 | global $pagenow; |
| 285 | 285 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) { |
| 286 | 286 | |
| 287 | - wp_enqueue_script( 'admin-widgets' ); |
|
| 288 | - wp_enqueue_style( 'widgets' ); |
|
| 289 | - wp_enqueue_script( 'formidable' ); |
|
| 290 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 287 | + wp_enqueue_script( 'admin-widgets' ); |
|
| 288 | + wp_enqueue_style( 'widgets' ); |
|
| 289 | + wp_enqueue_script( 'formidable' ); |
|
| 290 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 291 | 291 | FrmAppHelper::localize_script( 'admin' ); |
| 292 | 292 | |
| 293 | 293 | wp_enqueue_style( 'formidable-admin' ); |
@@ -302,36 +302,36 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 305 | + wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 306 | 306 | |
| 307 | 307 | do_action( 'frm_enqueue_builder_scripts' ); |
| 308 | - } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 309 | - if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 310 | - $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 308 | + } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 309 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 310 | + $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 311 | 311 | } else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) { |
| 312 | 312 | $post = get_post( absint( $_REQUEST['post'] ) ); |
| 313 | - if ( ! $post ) { |
|
| 314 | - return; |
|
| 315 | - } |
|
| 316 | - $post_type = $post->post_type; |
|
| 317 | - } else { |
|
| 318 | - return; |
|
| 319 | - } |
|
| 320 | - |
|
| 321 | - if ( $post_type == 'frm_display' ) { |
|
| 322 | - wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 323 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 324 | - wp_enqueue_style( 'formidable-admin' ); |
|
| 313 | + if ( ! $post ) { |
|
| 314 | + return; |
|
| 315 | + } |
|
| 316 | + $post_type = $post->post_type; |
|
| 317 | + } else { |
|
| 318 | + return; |
|
| 319 | + } |
|
| 320 | + |
|
| 321 | + if ( $post_type == 'frm_display' ) { |
|
| 322 | + wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 323 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 324 | + wp_enqueue_style( 'formidable-admin' ); |
|
| 325 | 325 | FrmAppHelper::localize_script( 'admin' ); |
| 326 | - } |
|
| 327 | - } else if ( $pagenow == 'widgets.php' ) { |
|
| 328 | - FrmAppHelper::load_admin_wide_js(); |
|
| 329 | - } |
|
| 330 | - } |
|
| 326 | + } |
|
| 327 | + } else if ( $pagenow == 'widgets.php' ) { |
|
| 328 | + FrmAppHelper::load_admin_wide_js(); |
|
| 329 | + } |
|
| 330 | + } |
|
| 331 | 331 | |
| 332 | - public static function load_lang() { |
|
| 333 | - load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 334 | - } |
|
| 332 | + public static function load_lang() { |
|
| 333 | + load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 334 | + } |
|
| 335 | 335 | |
| 336 | 336 | /** |
| 337 | 337 | * Filter shortcodes in text widgets |
@@ -436,21 +436,21 @@ discard block |
||
| 436 | 436 | * @deprecated 3.0.04 |
| 437 | 437 | * @codeCoverageIgnore |
| 438 | 438 | */ |
| 439 | - public static function activation_install() { |
|
| 439 | + public static function activation_install() { |
|
| 440 | 440 | _deprecated_function( __METHOD__, '3.0.04', 'FrmAppController::install' ); |
| 441 | - FrmDb::delete_cache_and_transient( 'frm_plugin_version' ); |
|
| 442 | - FrmFormActionsController::actions_init(); |
|
| 443 | - self::install(); |
|
| 444 | - } |
|
| 441 | + FrmDb::delete_cache_and_transient( 'frm_plugin_version' ); |
|
| 442 | + FrmFormActionsController::actions_init(); |
|
| 443 | + self::install(); |
|
| 444 | + } |
|
| 445 | 445 | |
| 446 | - public static function install() { |
|
| 447 | - $frmdb = new FrmMigrate(); |
|
| 448 | - $frmdb->upgrade(); |
|
| 449 | - } |
|
| 446 | + public static function install() { |
|
| 447 | + $frmdb = new FrmMigrate(); |
|
| 448 | + $frmdb->upgrade(); |
|
| 449 | + } |
|
| 450 | 450 | |
| 451 | - public static function uninstall() { |
|
| 451 | + public static function uninstall() { |
|
| 452 | 452 | FrmAppHelper::permission_check( 'administrator' ); |
| 453 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 453 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 454 | 454 | |
| 455 | 455 | $frmdb = new FrmMigrate(); |
| 456 | 456 | $frmdb->uninstall(); |
@@ -459,17 +459,17 @@ discard block |
||
| 459 | 459 | deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false ); |
| 460 | 460 | echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) ); |
| 461 | 461 | |
| 462 | - wp_die(); |
|
| 463 | - } |
|
| 462 | + wp_die(); |
|
| 463 | + } |
|
| 464 | 464 | |
| 465 | - public static function drop_tables( $tables ) { |
|
| 466 | - global $wpdb; |
|
| 467 | - $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 468 | - $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 469 | - $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 470 | - $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 471 | - return $tables; |
|
| 472 | - } |
|
| 465 | + public static function drop_tables( $tables ) { |
|
| 466 | + global $wpdb; |
|
| 467 | + $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 468 | + $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 469 | + $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 470 | + $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 471 | + return $tables; |
|
| 472 | + } |
|
| 473 | 473 | |
| 474 | 474 | /** |
| 475 | 475 | * Routes for wordpress pages -- we're just replacing content |
@@ -488,16 +488,16 @@ discard block |
||
| 488 | 488 | return $content; |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | - public static function deauthorize() { |
|
| 491 | + public static function deauthorize() { |
|
| 492 | 492 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 493 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 493 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 494 | 494 | |
| 495 | - delete_option( 'frmpro-credentials' ); |
|
| 496 | - delete_option( 'frmpro-authorized' ); |
|
| 497 | - delete_site_option( 'frmpro-credentials' ); |
|
| 498 | - delete_site_option( 'frmpro-authorized' ); |
|
| 499 | - wp_die(); |
|
| 500 | - } |
|
| 495 | + delete_option( 'frmpro-credentials' ); |
|
| 496 | + delete_option( 'frmpro-authorized' ); |
|
| 497 | + delete_site_option( 'frmpro-credentials' ); |
|
| 498 | + delete_site_option( 'frmpro-authorized' ); |
|
| 499 | + wp_die(); |
|
| 500 | + } |
|
| 501 | 501 | |
| 502 | 502 | public static function set_footer_text( $text ) { |
| 503 | 503 | if ( FrmAppHelper::is_formidable_admin() ) { |
@@ -518,8 +518,8 @@ discard block |
||
| 518 | 518 | * @deprecated 1.07.05 |
| 519 | 519 | * @codeCoverageIgnore |
| 520 | 520 | */ |
| 521 | - public static function get_form_shortcode( $atts ) { |
|
| 522 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
| 523 | - return FrmFormsController::get_form_shortcode( $atts ); |
|
| 524 | - } |
|
| 521 | + public static function get_form_shortcode( $atts ) { |
|
| 522 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
| 523 | + return FrmFormsController::get_form_shortcode( $atts ); |
|
| 524 | + } |
|
| 525 | 525 | } |