Completed
Push — master ( d506ae...99ea5f )
by Stephanie
03:20
created
classes/controllers/FrmAppController.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,49 +314,49 @@  discard block
 block discarded – undo
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
-    }
351
+			}
352
+		} else if ( $pagenow == 'widgets.php' ) {
353
+			FrmAppHelper::load_admin_wide_js();
354
+		}
355
+	}
356 356
 
357
-    public static function load_lang() {
358
-        load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
359
-    }
357
+	public static function load_lang() {
358
+		load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
359
+	}
360 360
 
361 361
 	/**
362 362
 	 * Filter shortcodes in text widgets
@@ -460,21 +460,21 @@  discard block
 block discarded – undo
460 460
 	 * @deprecated 3.0.04
461 461
 	 * @codeCoverageIgnore
462 462
 	 */
463
-    public static function activation_install() {
463
+	public static function activation_install() {
464 464
 		_deprecated_function( __METHOD__, '3.0.04', 'FrmAppController::install' );
465
-        FrmDb::delete_cache_and_transient( 'frm_plugin_version' );
466
-        FrmFormActionsController::actions_init();
467
-        self::install();
468
-    }
465
+		FrmDb::delete_cache_and_transient( 'frm_plugin_version' );
466
+		FrmFormActionsController::actions_init();
467
+		self::install();
468
+	}
469 469
 
470
-    public static function install() {
471
-        $frmdb = new FrmMigrate();
472
-        $frmdb->upgrade();
473
-    }
470
+	public static function install() {
471
+		$frmdb = new FrmMigrate();
472
+		$frmdb->upgrade();
473
+	}
474 474
 
475
-    public static function uninstall() {
475
+	public static function uninstall() {
476 476
 		FrmAppHelper::permission_check('administrator');
477
-        check_ajax_referer( 'frm_ajax', 'nonce' );
477
+		check_ajax_referer( 'frm_ajax', 'nonce' );
478 478
 
479 479
 		$frmdb = new FrmMigrate();
480 480
 		$frmdb->uninstall();
@@ -483,17 +483,17 @@  discard block
 block discarded – undo
483 483
 		deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false );
484 484
 		echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
485 485
 
486
-        wp_die();
487
-    }
486
+		wp_die();
487
+	}
488 488
 
489
-    public static function drop_tables( $tables ) {
490
-        global $wpdb;
491
-        $tables[] = $wpdb->prefix . 'frm_fields';
492
-        $tables[] = $wpdb->prefix . 'frm_forms';
493
-        $tables[] = $wpdb->prefix . 'frm_items';
494
-        $tables[] = $wpdb->prefix . 'frm_item_metas';
495
-        return $tables;
496
-    }
489
+	public static function drop_tables( $tables ) {
490
+		global $wpdb;
491
+		$tables[] = $wpdb->prefix . 'frm_fields';
492
+		$tables[] = $wpdb->prefix . 'frm_forms';
493
+		$tables[] = $wpdb->prefix . 'frm_items';
494
+		$tables[] = $wpdb->prefix . 'frm_item_metas';
495
+		return $tables;
496
+	}
497 497
 
498 498
 	/**
499 499
 	 * Routes for wordpress pages -- we're just replacing content
@@ -512,16 +512,16 @@  discard block
 block discarded – undo
512 512
 		return $content;
513 513
 	}
514 514
 
515
-    public static function deauthorize() {
515
+	public static function deauthorize() {
516 516
 		FrmAppHelper::permission_check('frm_change_settings');
517
-        check_ajax_referer( 'frm_ajax', 'nonce' );
517
+		check_ajax_referer( 'frm_ajax', 'nonce' );
518 518
 
519
-        delete_option( 'frmpro-credentials' );
520
-        delete_option( 'frmpro-authorized' );
521
-        delete_site_option( 'frmpro-credentials' );
522
-        delete_site_option( 'frmpro-authorized' );
523
-        wp_die();
524
-    }
519
+		delete_option( 'frmpro-credentials' );
520
+		delete_option( 'frmpro-authorized' );
521
+		delete_site_option( 'frmpro-credentials' );
522
+		delete_site_option( 'frmpro-authorized' );
523
+		wp_die();
524
+	}
525 525
 
526 526
 	public static function set_footer_text( $text ) {
527 527
 		if ( FrmAppHelper::is_formidable_admin() ) {
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
 	 * @deprecated 1.07.05
543 543
 	 * @codeCoverageIgnore
544 544
 	 */
545
-    public static function get_form_shortcode( $atts ) {
546
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
547
-        return FrmFormsController::get_form_shortcode( $atts );
548
-    }
545
+	public static function get_form_shortcode( $atts ) {
546
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
547
+		return FrmFormsController::get_form_shortcode( $atts );
548
+	}
549 549
 }
Please login to merge, or discard this patch.