Completed
Push — master ( 25135a...e46f5a )
by Stephanie
05:32
created
classes/controllers/FrmAppController.php 1 patch
Indentation   +95 added lines, -95 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' );
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		}
264 264
 	}
265 265
 
266
-    public static function admin_js() {
266
+	public static function admin_js() {
267 267
 		$version = FrmAppHelper::plugin_version();
268 268
 		FrmAppHelper::load_admin_wide_js( false );
269 269
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			'bootstrap-multiselect',
279 279
 		), $version, true );
280 280
 		wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
281
-        wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
281
+		wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
282 282
 		wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version );
283 283
 
284 284
 		// load multselect js
@@ -290,51 +290,51 @@  discard block
 block discarded – undo
290 290
 		global $pagenow;
291 291
 		if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) {
292 292
 
293
-            wp_enqueue_script( 'admin-widgets' );
294
-            wp_enqueue_style( 'widgets' );
295
-            wp_enqueue_script( 'formidable' );
296
-            wp_enqueue_script( 'formidable_admin' );
293
+			wp_enqueue_script( 'admin-widgets' );
294
+			wp_enqueue_style( 'widgets' );
295
+			wp_enqueue_script( 'formidable' );
296
+			wp_enqueue_script( 'formidable_admin' );
297 297
 			FrmAppHelper::localize_script( 'admin' );
298 298
 
299
-            wp_enqueue_style( 'formidable-admin' );
299
+			wp_enqueue_style( 'formidable-admin' );
300 300
 			wp_enqueue_style( 'formidable-grids' );
301 301
 			wp_enqueue_style( 'formidable-dropzone' );
302
-            add_thickbox();
302
+			add_thickbox();
303 303
 
304
-            wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
304
+			wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
305 305
 
306 306
 			do_action( 'frm_enqueue_builder_scripts' );
307
-        } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
308
-            if ( isset( $_REQUEST['post_type'] ) ) {
309
-                $post_type = sanitize_title( $_REQUEST['post_type'] );
307
+		} else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
308
+			if ( isset( $_REQUEST['post_type'] ) ) {
309
+				$post_type = sanitize_title( $_REQUEST['post_type'] );
310 310
 			} else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) {
311 311
 				$post = get_post( absint( $_REQUEST['post'] ) );
312
-                if ( ! $post ) {
313
-                    return;
314
-                }
315
-                $post_type = $post->post_type;
316
-            } else {
317
-                return;
318
-            }
319
-
320
-            if ( $post_type == 'frm_display' ) {
321
-                wp_enqueue_script( 'jquery-ui-draggable' );
322
-                wp_enqueue_script( 'formidable_admin' );
323
-                wp_enqueue_style( 'formidable-admin' );
312
+				if ( ! $post ) {
313
+					return;
314
+				}
315
+				$post_type = $post->post_type;
316
+			} else {
317
+				return;
318
+			}
319
+
320
+			if ( $post_type == 'frm_display' ) {
321
+				wp_enqueue_script( 'jquery-ui-draggable' );
322
+				wp_enqueue_script( 'formidable_admin' );
323
+				wp_enqueue_style( 'formidable-admin' );
324 324
 				FrmAppHelper::localize_script( 'admin' );
325
-            }
326
-        } else if ( $pagenow == 'widgets.php' ) {
327
-            FrmAppHelper::load_admin_wide_js();
328
-        }
329
-    }
330
-
331
-    public static function load_lang() {
332
-        load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
333
-    }
334
-
335
-    /**
336
-     * Filter shortcodes in text widgets
337
-     */
325
+			}
326
+		} else if ( $pagenow == 'widgets.php' ) {
327
+			FrmAppHelper::load_admin_wide_js();
328
+		}
329
+	}
330
+
331
+	public static function load_lang() {
332
+		load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
333
+	}
334
+
335
+	/**
336
+	 * Filter shortcodes in text widgets
337
+	 */
338 338
 	public static function widget_text_filter( $content ) {
339 339
 		_deprecated_function( __METHOD__, '2.5.4' );
340 340
 		$regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/';
@@ -424,21 +424,21 @@  discard block
 block discarded – undo
424 424
 		wp_die();
425 425
 	}
426 426
 
427
-    public static function activation_install() {
427
+	public static function activation_install() {
428 428
 		_deprecated_function( __METHOD__, '3.0.04', 'FrmAppController::install' );
429
-        FrmDb::delete_cache_and_transient( 'frm_plugin_version' );
430
-        FrmFormActionsController::actions_init();
431
-        self::install();
432
-    }
429
+		FrmDb::delete_cache_and_transient( 'frm_plugin_version' );
430
+		FrmFormActionsController::actions_init();
431
+		self::install();
432
+	}
433 433
 
434
-    public static function install( $old_db_version = false ) {
435
-        $frmdb = new FrmMigrate();
436
-        $frmdb->upgrade( $old_db_version );
437
-    }
434
+	public static function install( $old_db_version = false ) {
435
+		$frmdb = new FrmMigrate();
436
+		$frmdb->upgrade( $old_db_version );
437
+	}
438 438
 
439
-    public static function uninstall() {
439
+	public static function uninstall() {
440 440
 		FrmAppHelper::permission_check('administrator');
441
-        check_ajax_referer( 'frm_ajax', 'nonce' );
441
+		check_ajax_referer( 'frm_ajax', 'nonce' );
442 442
 
443 443
 		$frmdb = new FrmMigrate();
444 444
 		$frmdb->uninstall();
@@ -447,19 +447,19 @@  discard block
 block discarded – undo
447 447
 		deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false );
448 448
 		echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
449 449
 
450
-        wp_die();
451
-    }
450
+		wp_die();
451
+	}
452 452
 
453
-    public static function drop_tables( $tables ) {
454
-        global $wpdb;
455
-        $tables[] = $wpdb->prefix . 'frm_fields';
456
-        $tables[] = $wpdb->prefix . 'frm_forms';
457
-        $tables[] = $wpdb->prefix . 'frm_items';
458
-        $tables[] = $wpdb->prefix . 'frm_item_metas';
459
-        return $tables;
460
-    }
453
+	public static function drop_tables( $tables ) {
454
+		global $wpdb;
455
+		$tables[] = $wpdb->prefix . 'frm_fields';
456
+		$tables[] = $wpdb->prefix . 'frm_forms';
457
+		$tables[] = $wpdb->prefix . 'frm_items';
458
+		$tables[] = $wpdb->prefix . 'frm_item_metas';
459
+		return $tables;
460
+	}
461 461
 
462
-    // Routes for wordpress pages -- we're just replacing content here folks.
462
+	// Routes for wordpress pages -- we're just replacing content here folks.
463 463
 	public static function page_route( $content ) {
464 464
 		_deprecated_function( __METHOD__, '3.0' );
465 465
 		global $post;
@@ -471,16 +471,16 @@  discard block
 block discarded – undo
471 471
 		return $content;
472 472
 	}
473 473
 
474
-    public static function deauthorize() {
474
+	public static function deauthorize() {
475 475
 		FrmAppHelper::permission_check('frm_change_settings');
476
-        check_ajax_referer( 'frm_ajax', 'nonce' );
476
+		check_ajax_referer( 'frm_ajax', 'nonce' );
477 477
 
478
-        delete_option( 'frmpro-credentials' );
479
-        delete_option( 'frmpro-authorized' );
480
-        delete_site_option( 'frmpro-credentials' );
481
-        delete_site_option( 'frmpro-authorized' );
482
-        wp_die();
483
-    }
478
+		delete_option( 'frmpro-credentials' );
479
+		delete_option( 'frmpro-authorized' );
480
+		delete_site_option( 'frmpro-credentials' );
481
+		delete_site_option( 'frmpro-authorized' );
482
+		wp_die();
483
+	}
484 484
 
485 485
 	public static function set_footer_text( $text ) {
486 486
 		if ( FrmAppHelper::is_formidable_admin() ) {
@@ -497,8 +497,8 @@  discard block
 block discarded – undo
497 497
 		return $text;
498 498
 	}
499 499
 
500
-    public static function get_form_shortcode( $atts ) {
501
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
502
-        return FrmFormsController::get_form_shortcode( $atts );
503
-    }
500
+	public static function get_form_shortcode( $atts ) {
501
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
502
+		return FrmFormsController::get_form_shortcode( $atts );
503
+	}
504 504
 }
Please login to merge, or discard this patch.