@@ -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 | $count = count( get_post_types( array( |
@@ -46,15 +46,15 @@ discard block |
||
| 46 | 46 | return $is_white_page; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public static function load_wp_admin_style() { |
|
| 50 | - FrmAppHelper::load_font_style(); |
|
| 51 | - } |
|
| 49 | + public static function load_wp_admin_style() { |
|
| 50 | + FrmAppHelper::load_font_style(); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) { |
| 54 | 54 | $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' ); |
| 55 | - if ( empty( $show_nav ) || ! $form ) { |
|
| 56 | - return; |
|
| 57 | - } |
|
| 55 | + if ( empty( $show_nav ) || ! $form ) { |
|
| 56 | + return; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | FrmForm::maybe_get_form( $form ); |
| 60 | 60 | if ( ! is_object( $form ) ) { |
@@ -115,21 +115,21 @@ discard block |
||
| 115 | 115 | return $nav_items; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - // Adds a settings link to the plugins page |
|
| 119 | - public static function settings_link( $links ) { |
|
| 118 | + // Adds a settings link to the plugins page |
|
| 119 | + public static function settings_link( $links ) { |
|
| 120 | 120 | $settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>'; |
| 121 | - array_unshift( $links, $settings ); |
|
| 121 | + array_unshift( $links, $settings ); |
|
| 122 | 122 | |
| 123 | - return $links; |
|
| 124 | - } |
|
| 123 | + return $links; |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - public static function pro_get_started_headline() { |
|
| 126 | + public static function pro_get_started_headline() { |
|
| 127 | 127 | self::maybe_show_upgrade_bar(); |
| 128 | 128 | |
| 129 | - // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
| 130 | - if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
| 131 | - return; |
|
| 132 | - } |
|
| 129 | + // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
| 130 | + if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
| 131 | + return; |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | 134 | $pro_installed = is_dir( WP_PLUGIN_DIR . '/formidable-pro' ); |
| 135 | 135 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } else { |
| 145 | 145 | $inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/'; |
| 146 | 146 | } |
| 147 | - ?> |
|
| 147 | + ?> |
|
| 148 | 148 | <div class="error" class="frm_previous_install"> |
| 149 | 149 | <?php |
| 150 | 150 | echo apply_filters( 'frm_pro_update_msg', |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | ?> |
| 158 | 158 | </div> |
| 159 | 159 | <?php |
| 160 | - } |
|
| 161 | - } |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | 163 | private static function maybe_show_upgrade_bar() { |
| 164 | 164 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - public static function admin_js() { |
|
| 290 | + public static function admin_js() { |
|
| 291 | 291 | $version = FrmAppHelper::plugin_version(); |
| 292 | 292 | FrmAppHelper::load_admin_wide_js( false ); |
| 293 | 293 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | 'bootstrap-multiselect', |
| 303 | 303 | ), $version, true ); |
| 304 | 304 | wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version ); |
| 305 | - wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 305 | + wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 306 | 306 | wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version ); |
| 307 | 307 | |
| 308 | 308 | // load multselect js |
@@ -314,53 +314,53 @@ discard block |
||
| 314 | 314 | global $pagenow; |
| 315 | 315 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) { |
| 316 | 316 | |
| 317 | - wp_enqueue_script( 'admin-widgets' ); |
|
| 318 | - wp_enqueue_style( 'widgets' ); |
|
| 319 | - wp_enqueue_script( 'formidable' ); |
|
| 320 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 317 | + wp_enqueue_script( 'admin-widgets' ); |
|
| 318 | + wp_enqueue_style( 'widgets' ); |
|
| 319 | + wp_enqueue_script( 'formidable' ); |
|
| 320 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 321 | 321 | FrmAppHelper::localize_script( 'admin' ); |
| 322 | 322 | |
| 323 | - wp_enqueue_style( 'formidable-admin' ); |
|
| 323 | + wp_enqueue_style( 'formidable-admin' ); |
|
| 324 | 324 | if ( 'formidable-styles' !== $page ) { |
| 325 | 325 | wp_enqueue_style( 'formidable-grids' ); |
| 326 | 326 | wp_enqueue_style( 'formidable-dropzone' ); |
| 327 | 327 | add_thickbox(); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 330 | + wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 331 | 331 | |
| 332 | 332 | do_action( 'frm_enqueue_builder_scripts' ); |
| 333 | - } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 334 | - if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 335 | - $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 333 | + } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 334 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 335 | + $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 336 | 336 | } else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) { |
| 337 | 337 | $post = get_post( absint( $_REQUEST['post'] ) ); |
| 338 | - if ( ! $post ) { |
|
| 339 | - return; |
|
| 340 | - } |
|
| 341 | - $post_type = $post->post_type; |
|
| 342 | - } else { |
|
| 343 | - return; |
|
| 344 | - } |
|
| 345 | - |
|
| 346 | - if ( $post_type == 'frm_display' ) { |
|
| 347 | - wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 348 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 349 | - wp_enqueue_style( 'formidable-admin' ); |
|
| 338 | + if ( ! $post ) { |
|
| 339 | + return; |
|
| 340 | + } |
|
| 341 | + $post_type = $post->post_type; |
|
| 342 | + } else { |
|
| 343 | + return; |
|
| 344 | + } |
|
| 345 | + |
|
| 346 | + if ( $post_type == 'frm_display' ) { |
|
| 347 | + wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 348 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 349 | + wp_enqueue_style( 'formidable-admin' ); |
|
| 350 | 350 | FrmAppHelper::localize_script( 'admin' ); |
| 351 | - } |
|
| 352 | - } else if ( $pagenow == 'widgets.php' ) { |
|
| 353 | - FrmAppHelper::load_admin_wide_js(); |
|
| 354 | - } |
|
| 355 | - } |
|
| 356 | - |
|
| 357 | - public static function load_lang() { |
|
| 358 | - load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 359 | - } |
|
| 360 | - |
|
| 361 | - /** |
|
| 362 | - * Filter shortcodes in text widgets |
|
| 363 | - */ |
|
| 351 | + } |
|
| 352 | + } else if ( $pagenow == 'widgets.php' ) { |
|
| 353 | + FrmAppHelper::load_admin_wide_js(); |
|
| 354 | + } |
|
| 355 | + } |
|
| 356 | + |
|
| 357 | + public static function load_lang() { |
|
| 358 | + load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 359 | + } |
|
| 360 | + |
|
| 361 | + /** |
|
| 362 | + * Filter shortcodes in text widgets |
|
| 363 | + */ |
|
| 364 | 364 | public static function widget_text_filter( $content ) { |
| 365 | 365 | _deprecated_function( __METHOD__, '2.5.4' ); |
| 366 | 366 | $regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/'; |
@@ -450,21 +450,21 @@ discard block |
||
| 450 | 450 | wp_die(); |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - public static function activation_install() { |
|
| 453 | + public static function activation_install() { |
|
| 454 | 454 | _deprecated_function( __METHOD__, '3.0.04', 'FrmAppController::install' ); |
| 455 | - FrmDb::delete_cache_and_transient( 'frm_plugin_version' ); |
|
| 456 | - FrmFormActionsController::actions_init(); |
|
| 457 | - self::install(); |
|
| 458 | - } |
|
| 455 | + FrmDb::delete_cache_and_transient( 'frm_plugin_version' ); |
|
| 456 | + FrmFormActionsController::actions_init(); |
|
| 457 | + self::install(); |
|
| 458 | + } |
|
| 459 | 459 | |
| 460 | - public static function install( $old_db_version = false ) { |
|
| 461 | - $frmdb = new FrmMigrate(); |
|
| 462 | - $frmdb->upgrade( $old_db_version ); |
|
| 463 | - } |
|
| 460 | + public static function install( $old_db_version = false ) { |
|
| 461 | + $frmdb = new FrmMigrate(); |
|
| 462 | + $frmdb->upgrade( $old_db_version ); |
|
| 463 | + } |
|
| 464 | 464 | |
| 465 | - public static function uninstall() { |
|
| 465 | + public static function uninstall() { |
|
| 466 | 466 | FrmAppHelper::permission_check('administrator'); |
| 467 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 467 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 468 | 468 | |
| 469 | 469 | $frmdb = new FrmMigrate(); |
| 470 | 470 | $frmdb->uninstall(); |
@@ -473,19 +473,19 @@ discard block |
||
| 473 | 473 | deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false ); |
| 474 | 474 | echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) ); |
| 475 | 475 | |
| 476 | - wp_die(); |
|
| 477 | - } |
|
| 476 | + wp_die(); |
|
| 477 | + } |
|
| 478 | 478 | |
| 479 | - public static function drop_tables( $tables ) { |
|
| 480 | - global $wpdb; |
|
| 481 | - $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 482 | - $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 483 | - $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 484 | - $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 485 | - return $tables; |
|
| 486 | - } |
|
| 479 | + public static function drop_tables( $tables ) { |
|
| 480 | + global $wpdb; |
|
| 481 | + $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 482 | + $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 483 | + $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 484 | + $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 485 | + return $tables; |
|
| 486 | + } |
|
| 487 | 487 | |
| 488 | - // Routes for wordpress pages -- we're just replacing content here folks. |
|
| 488 | + // Routes for wordpress pages -- we're just replacing content here folks. |
|
| 489 | 489 | public static function page_route( $content ) { |
| 490 | 490 | _deprecated_function( __METHOD__, '3.0' ); |
| 491 | 491 | global $post; |
@@ -497,16 +497,16 @@ discard block |
||
| 497 | 497 | return $content; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - public static function deauthorize() { |
|
| 500 | + public static function deauthorize() { |
|
| 501 | 501 | FrmAppHelper::permission_check('frm_change_settings'); |
| 502 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 502 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 503 | 503 | |
| 504 | - delete_option( 'frmpro-credentials' ); |
|
| 505 | - delete_option( 'frmpro-authorized' ); |
|
| 506 | - delete_site_option( 'frmpro-credentials' ); |
|
| 507 | - delete_site_option( 'frmpro-authorized' ); |
|
| 508 | - wp_die(); |
|
| 509 | - } |
|
| 504 | + delete_option( 'frmpro-credentials' ); |
|
| 505 | + delete_option( 'frmpro-authorized' ); |
|
| 506 | + delete_site_option( 'frmpro-credentials' ); |
|
| 507 | + delete_site_option( 'frmpro-authorized' ); |
|
| 508 | + wp_die(); |
|
| 509 | + } |
|
| 510 | 510 | |
| 511 | 511 | public static function set_footer_text( $text ) { |
| 512 | 512 | if ( FrmAppHelper::is_formidable_admin() ) { |
@@ -523,8 +523,8 @@ discard block |
||
| 523 | 523 | return $text; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - public static function get_form_shortcode( $atts ) { |
|
| 527 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
| 528 | - return FrmFormsController::get_form_shortcode( $atts ); |
|
| 529 | - } |
|
| 526 | + public static function get_form_shortcode( $atts ) { |
|
| 527 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
| 528 | + return FrmFormsController::get_form_shortcode( $atts ); |
|
| 529 | + } |
|
| 530 | 530 | } |