Completed
Push — master ( fec4f5...5e053d )
by Stephanie
02:54
created
classes/controllers/FrmStylesController.php 1 patch
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmStylesController {
4
-    public static $post_type = 'frm_styles';
5
-    public static $screen = 'formidable_page_formidable-styles';
4
+	public static $post_type = 'frm_styles';
5
+	public static $screen = 'formidable_page_formidable-styles';
6 6
 
7
-    public static function load_pro_hooks() {
8
-        if ( FrmAppHelper::pro_is_installed() ) {
9
-            FrmProStylesController::load_pro_hooks();
10
-        }
11
-    }
7
+	public static function load_pro_hooks() {
8
+		if ( FrmAppHelper::pro_is_installed() ) {
9
+			FrmProStylesController::load_pro_hooks();
10
+		}
11
+	}
12 12
 
13
-    public static function register_post_types() {
13
+	public static function register_post_types() {
14 14
 		register_post_type(
15 15
 			self::$post_type,
16 16
 			array(
@@ -41,18 +41,18 @@  discard block
 block discarded – undo
41 41
 				),
42 42
 			)
43 43
 		);
44
-    }
44
+	}
45 45
 
46
-    public static function menu() {
46
+	public static function menu() {
47 47
 		add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' );
48
-    }
48
+	}
49 49
 
50 50
 	public static function admin_init() {
51 51
 		if ( ! FrmAppHelper::is_admin_page( 'formidable-styles' ) ) {
52 52
 			return;
53 53
 		}
54 54
 
55
-        self::load_pro_hooks();
55
+		self::load_pro_hooks();
56 56
 
57 57
 		$style_tab = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
58 58
 		if ( $style_tab == 'manage' || $style_tab == 'custom_css' ) {
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 		wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ) );
66 66
 
67 67
 		$style = apply_filters( 'frm_style_head', false );
68
-        if ( $style ) {
68
+		if ( $style ) {
69 69
 			wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) );
70
-        }
71
-    }
70
+		}
71
+	}
72 72
 
73 73
 	public static function enqueue_css( $register = 'enqueue' ) {
74 74
 		global $frm_vars;
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
 	public static function load_styler( $style, $message = '' ) {
220
-        global $frm_settings;
220
+		global $frm_settings;
221 221
 
222
-        $frm_style = new FrmStyle();
223
-        $styles = $frm_style->get_all();
222
+		$frm_style = new FrmStyle();
223
+		$styles = $frm_style->get_all();
224 224
 
225 225
 		if ( is_numeric( $style ) ) {
226 226
 			$style = $styles[ $style ];
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 			$style = $frm_style->get_default_style( $styles );
229 229
 		}
230 230
 
231
-        self::add_meta_boxes();
231
+		self::add_meta_boxes();
232 232
 
233 233
 		include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' );
234
-    }
234
+	}
235 235
 
236 236
 	/**
237 237
 	 * @param string $message
@@ -249,31 +249,31 @@  discard block
 block discarded – undo
249 249
 		include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' );
250 250
 	}
251 251
 
252
-    private static function manage_styles() {
252
+	private static function manage_styles() {
253 253
 		$style_nonce = FrmAppHelper::get_post_param( 'frm_manage_style', '', 'sanitize_text_field' );
254 254
 		if ( ! $_POST || ! isset( $_POST['style'] ) || ! wp_verify_nonce( $style_nonce, 'frm_manage_style_nonce' ) ) {
255
-            return self::manage();
256
-        }
255
+			return self::manage();
256
+		}
257 257
 
258
-        global $wpdb;
258
+		global $wpdb;
259 259
 
260 260
 		$forms = FrmForm::get_published_forms();
261
-        foreach ( $forms as $form ) {
262
-            if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
263
-                continue;
264
-            }
261
+		foreach ( $forms as $form ) {
262
+			if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
263
+				continue;
264
+			}
265 265
 
266
-            $form->options['custom_style'] = $_POST['style'][ $form->id ];
266
+			$form->options['custom_style'] = $_POST['style'][ $form->id ];
267 267
 
268 268
 			$wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) );
269 269
 			unset( $form );
270
-        }
270
+		}
271 271
 
272
-        $message = __( 'Your form styles have been saved.', 'formidable' );
272
+		$message = __( 'Your form styles have been saved.', 'formidable' );
273 273
 		return self::manage( $message, $forms );
274
-    }
274
+	}
275 275
 
276
-    public static function custom_css( $message = '', $style = null ) {
276
+	public static function custom_css( $message = '', $style = null ) {
277 277
 		if ( function_exists( 'wp_enqueue_code_editor' ) ) {
278 278
 			$id = 'frm_codemirror_box';
279 279
 			$settings = wp_enqueue_code_editor(
@@ -315,41 +315,41 @@  discard block
 block discarded – undo
315 315
 		return self::custom_css( $message );
316 316
 	}
317 317
 
318
-    public static function route() {
318
+	public static function route() {
319 319
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
320 320
 
321
-        switch ( $action ) {
322
-            case 'edit':
323
-            case 'save':
324
-            case 'manage':
325
-            case 'manage_styles':
326
-            case 'custom_css':
327
-            case 'save_css':
321
+		switch ( $action ) {
322
+			case 'edit':
323
+			case 'save':
324
+			case 'manage':
325
+			case 'manage_styles':
326
+			case 'custom_css':
327
+			case 'save_css':
328 328
 				return self::$action();
329
-            default:
330
-            	do_action( 'frm_style_action_route', $action );
331
-            	if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) {
332
-                	return;
333
-            	}
329
+			default:
330
+				do_action( 'frm_style_action_route', $action );
331
+				if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) {
332
+					return;
333
+				}
334 334
 
335
-                if ( 'new_style' == $action || 'duplicate' == $action ) {
336
-                    return self::$action();
337
-                }
335
+				if ( 'new_style' == $action || 'duplicate' == $action ) {
336
+					return self::$action();
337
+				}
338 338
 
339
-                return self::edit();
340
-        }
341
-    }
339
+				return self::edit();
340
+		}
341
+	}
342 342
 
343
-    public static function reset_styling() {
343
+	public static function reset_styling() {
344 344
 		FrmAppHelper::permission_check( 'frm_change_settings' );
345
-        check_ajax_referer( 'frm_ajax', 'nonce' );
345
+		check_ajax_referer( 'frm_ajax', 'nonce' );
346 346
 
347
-        $frm_style = new FrmStyle();
348
-        $defaults = $frm_style->get_defaults();
347
+		$frm_style = new FrmStyle();
348
+		$defaults = $frm_style->get_defaults();
349 349
 
350
-        echo json_encode( $defaults );
351
-        wp_die();
352
-    }
350
+		echo json_encode( $defaults );
351
+		wp_die();
352
+	}
353 353
 
354 354
 	public static function change_styling() {
355 355
 		check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -364,21 +364,21 @@  discard block
 block discarded – undo
364 364
 		wp_die();
365 365
 	}
366 366
 
367
-    private static function add_meta_boxes() {
368
-
369
-        // setup meta boxes
370
-        $meta_boxes = array(
371
-            'general'           => __( 'General', 'formidable' ),
372
-            'form-title'        => __( 'Form Title', 'formidable' ),
373
-            'form-description'  => __( 'Form Description', 'formidable' ),
374
-            'field-labels'      => __( 'Field Labels', 'formidable' ),
375
-            'field-description' => __( 'Field Description', 'formidable' ),
376
-            'field-colors'      => __( 'Field Colors', 'formidable' ),
377
-            'field-sizes'       => __( 'Field Settings', 'formidable' ),
378
-            'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ),
379
-            'buttons'           => __( 'Buttons', 'formidable' ),
380
-            'form-messages'     => __( 'Form Messages', 'formidable' ),
381
-        );
367
+	private static function add_meta_boxes() {
368
+
369
+		// setup meta boxes
370
+		$meta_boxes = array(
371
+			'general'           => __( 'General', 'formidable' ),
372
+			'form-title'        => __( 'Form Title', 'formidable' ),
373
+			'form-description'  => __( 'Form Description', 'formidable' ),
374
+			'field-labels'      => __( 'Field Labels', 'formidable' ),
375
+			'field-description' => __( 'Field Description', 'formidable' ),
376
+			'field-colors'      => __( 'Field Colors', 'formidable' ),
377
+			'field-sizes'       => __( 'Field Settings', 'formidable' ),
378
+			'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ),
379
+			'buttons'           => __( 'Buttons', 'formidable' ),
380
+			'form-messages'     => __( 'Form Messages', 'formidable' ),
381
+		);
382 382
 
383 383
 		/**
384 384
 		 * Add custom boxes to the styling settings
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 		$file_name = apply_filters( 'frm_style_settings_' . $sec['args'], $file_name );
411 411
 
412 412
 		include( $file_name );
413
-    }
413
+	}
414 414
 
415
-    public static function load_css() {
415
+	public static function load_css() {
416 416
 		header( 'Content-type: text/css' );
417 417
 
418
-        $frm_style = new FrmStyle();
419
-        $defaults = $frm_style->get_defaults();
418
+		$frm_style = new FrmStyle();
419
+		$defaults = $frm_style->get_defaults();
420 420
 		$style = '';
421 421
 
422 422
 		include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
423
-        wp_die();
424
-    }
423
+		wp_die();
424
+	}
425 425
 
426 426
 	public static function load_saved_css() {
427 427
 		$css = get_transient( 'frmpro_css' );
@@ -430,49 +430,49 @@  discard block
 block discarded – undo
430 430
 		wp_die();
431 431
 	}
432 432
 
433
-    /**
434
-     * Check if the Formidable styling should be loaded,
435
-     * then enqueue it for the footer
436
-     * @since 2.0
437
-     */
438
-    public static function enqueue_style() {
439
-        global $frm_vars;
440
-
441
-        if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) {
442
-            // the CSS has already been loaded
443
-            return;
444
-        }
445
-
446
-        $frm_settings = FrmAppHelper::get_settings();
447
-        if ( $frm_settings->load_style != 'none' ) {
448
-            wp_enqueue_style( 'formidable' );
449
-            $frm_vars['css_loaded'] = true;
450
-        }
451
-    }
452
-
453
-    // Get the stylesheets for the form settings page
454
-    public static function get_style_opts() {
455
-        $frm_style = new FrmStyle();
456
-        $styles = $frm_style->get_all();
457
-
458
-        return $styles;
459
-    }
460
-
461
-    public static function get_form_style( $form = 'default' ) {
462
-        $style = FrmFormsHelper::get_form_style( $form );
463
-
464
-        if ( empty( $style ) || 1 == $style ) {
465
-            $style = 'default';
466
-        }
467
-
468
-        $frm_style = new FrmStyle( $style );
469
-        return $frm_style->get_one();
470
-    }
471
-
472
-    /**
473
-     * @param string $class
474
-     * @param string $style
475
-     */
433
+	/**
434
+	 * Check if the Formidable styling should be loaded,
435
+	 * then enqueue it for the footer
436
+	 * @since 2.0
437
+	 */
438
+	public static function enqueue_style() {
439
+		global $frm_vars;
440
+
441
+		if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) {
442
+			// the CSS has already been loaded
443
+			return;
444
+		}
445
+
446
+		$frm_settings = FrmAppHelper::get_settings();
447
+		if ( $frm_settings->load_style != 'none' ) {
448
+			wp_enqueue_style( 'formidable' );
449
+			$frm_vars['css_loaded'] = true;
450
+		}
451
+	}
452
+
453
+	// Get the stylesheets for the form settings page
454
+	public static function get_style_opts() {
455
+		$frm_style = new FrmStyle();
456
+		$styles = $frm_style->get_all();
457
+
458
+		return $styles;
459
+	}
460
+
461
+	public static function get_form_style( $form = 'default' ) {
462
+		$style = FrmFormsHelper::get_form_style( $form );
463
+
464
+		if ( empty( $style ) || 1 == $style ) {
465
+			$style = 'default';
466
+		}
467
+
468
+		$frm_style = new FrmStyle( $style );
469
+		return $frm_style->get_one();
470
+	}
471
+
472
+	/**
473
+	 * @param string $class
474
+	 * @param string $style
475
+	 */
476 476
 	public static function get_form_style_class( $class, $style ) {
477 477
 		if ( 1 == $style ) {
478 478
 			$style = 'default';
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 		}
503 503
 	}
504 504
 
505
-    /**
506
-     * @param string $val
507
-     */
505
+	/**
506
+	 * @param string $val
507
+	 */
508 508
 	public static function get_style_val( $val, $form = 'default' ) {
509 509
 		$style = self::get_form_style( $form );
510 510
 		if ( $style && isset( $style->post_content[ $val ] ) ) {
@@ -514,72 +514,72 @@  discard block
 block discarded – undo
514 514
 
515 515
 	public static function show_entry_styles( $default_styles ) {
516 516
 		$frm_style = new FrmStyle( 'default' );
517
-        $style = $frm_style->get_one();
518
-
519
-        if ( ! $style ) {
520
-            return $default_styles;
521
-        }
522
-
523
-        foreach ( $default_styles as $name => $val ) {
524
-            $setting = $name;
525
-            if ( 'border_width' == $name ) {
526
-                $setting = 'field_border_width';
527
-            } else if ( 'alt_bg_color' == $name ) {
528
-                $setting = 'bg_color_active';
529
-            }
530
-            $default_styles[ $name ] = $style->post_content[ $setting ];
517
+		$style = $frm_style->get_one();
518
+
519
+		if ( ! $style ) {
520
+			return $default_styles;
521
+		}
522
+
523
+		foreach ( $default_styles as $name => $val ) {
524
+			$setting = $name;
525
+			if ( 'border_width' == $name ) {
526
+				$setting = 'field_border_width';
527
+			} else if ( 'alt_bg_color' == $name ) {
528
+				$setting = 'bg_color_active';
529
+			}
530
+			$default_styles[ $name ] = $style->post_content[ $setting ];
531 531
 			unset( $name, $val );
532
-        }
532
+		}
533 533
 
534
-        return $default_styles;
535
-    }
534
+		return $default_styles;
535
+	}
536 536
 
537 537
 	public static function &important_style( $important, $field ) {
538 538
 		$important = self::get_style_val( 'important_style', $field['form_id'] );
539
-        return $important;
540
-    }
539
+		return $important;
540
+	}
541 541
 
542
-    /**
543
-     * Fallback for WP < 3.6
544
-     */
545
-    public static function do_accordion_sections( $screen, $context, $object ) {
546
-        if ( function_exists( 'do_accordion_sections' ) ) {
547
-            return do_accordion_sections( $screen, $context, $object );
548
-        }
542
+	/**
543
+	 * Fallback for WP < 3.6
544
+	 */
545
+	public static function do_accordion_sections( $screen, $context, $object ) {
546
+		if ( function_exists( 'do_accordion_sections' ) ) {
547
+			return do_accordion_sections( $screen, $context, $object );
548
+		}
549 549
 
550
-    	global $wp_meta_boxes;
550
+		global $wp_meta_boxes;
551 551
 
552
-        $screen = 'formidable_page_formidable-styles';
553
-        $screen = convert_to_screen( $screen );
552
+		$screen = 'formidable_page_formidable-styles';
553
+		$screen = convert_to_screen( $screen );
554 554
 
555
-    	$page = $screen->id;
555
+		$page = $screen->id;
556 556
 
557
-    	$hidden = get_hidden_meta_boxes( $screen );
558
-    	?>
557
+		$hidden = get_hidden_meta_boxes( $screen );
558
+		?>
559 559
     	<div id="side-sortables" class="accordion-container">
560 560
     	<?php
561
-    	$i = 0;
562
-    	$first_open = false;
563
-    	do {
561
+		$i = 0;
562
+		$first_open = false;
563
+		do {
564 564
 			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
565 565
 				break;
566 566
 			}
567 567
 
568
-    		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
569
-    			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
570
-    				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
571
-    					if ( false == $box || ! $box['title'] ) {
572
-    						continue;
568
+			foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
569
+				if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
570
+					foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
571
+						if ( false == $box || ! $box['title'] ) {
572
+							continue;
573 573
 						}
574 574
 
575
-    					$i++;
576
-    					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
575
+						$i++;
576
+						$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
577 577
 
578
-    					if ( ! $first_open && empty( $hidden_class ) ) {
579
-    						$first_open = true;
580
-    					}
578
+						if ( ! $first_open && empty( $hidden_class ) ) {
579
+							$first_open = true;
580
+						}
581 581
 
582
-    					?>
582
+						?>
583 583
 						<div class="postbox <?php echo esc_attr( $box['id'] ); ?>">
584 584
 						<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'formidable' ); ?>"><br/></div>
585 585
                         <h3 class='hndle'><span><?php echo esc_html( $box['title'] ); ?></span></h3>
@@ -590,13 +590,13 @@  discard block
 block discarded – undo
590 590
     						</div><!-- .accordion-section-content -->
591 591
     					</div><!-- .postbox -->
592 592
     					<?php
593
-    				}
594
-    			}
595
-    		}
596
-    	} while ( 0 );
597
-    	?>
593
+					}
594
+				}
595
+			}
596
+		} while ( 0 );
597
+		?>
598 598
     	</div><!-- .accordion-container -->
599 599
     	<?php
600
-    	return $i;
601
-    }
600
+		return $i;
601
+	}
602 602
 }
Please login to merge, or discard this patch.
classes/controllers/FrmAppController.php 1 patch
Indentation   +87 added lines, -87 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
 		$query = array(
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
 		return $is_white_page;
48 48
 	}
49 49
 
50
-    public static function load_wp_admin_style() {
51
-        FrmAppHelper::load_font_style();
52
-    }
50
+	public static function load_wp_admin_style() {
51
+		FrmAppHelper::load_font_style();
52
+	}
53 53
 
54 54
 	public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
55 55
 		$show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
56
-        if ( empty( $show_nav ) || ! $form ) {
57
-            return;
58
-        }
56
+		if ( empty( $show_nav ) || ! $form ) {
57
+			return;
58
+		}
59 59
 
60 60
 		FrmForm::maybe_get_form( $form );
61 61
 		if ( ! is_object( $form ) ) {
@@ -116,21 +116,21 @@  discard block
 block discarded – undo
116 116
 		return apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
117 117
 	}
118 118
 
119
-    // Adds a settings link to the plugins page
120
-    public static function settings_link( $links ) {
119
+	// Adds a settings link to the plugins page
120
+	public static function settings_link( $links ) {
121 121
 		$settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>';
122
-        array_unshift( $links, $settings );
122
+		array_unshift( $links, $settings );
123 123
 
124
-        return $links;
125
-    }
124
+		return $links;
125
+	}
126 126
 
127
-    public static function pro_get_started_headline() {
127
+	public static function pro_get_started_headline() {
128 128
 		self::maybe_show_upgrade_bar();
129 129
 
130
-        // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
131
-        if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
132
-            return;
133
-        }
130
+		// Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
131
+		if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
132
+			return;
133
+		}
134 134
 
135 135
 		$pro_installed = is_dir( WP_PLUGIN_DIR . '/formidable-pro' );
136 136
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			} else {
146 146
 				$inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/';
147 147
 			}
148
-        ?>
148
+		?>
149 149
 <div class="error" class="frm_previous_install">
150 150
 		<?php
151 151
 		echo apply_filters( // WPCS: XSS ok.
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 		?>
163 163
 </div>
164 164
 <?php
165
-        }
166
-    }
165
+		}
166
+	}
167 167
 
168 168
 	private static function maybe_show_upgrade_bar() {
169 169
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		}
260 260
 	}
261 261
 
262
-    public static function admin_js() {
262
+	public static function admin_js() {
263 263
 		$version = FrmAppHelper::plugin_version();
264 264
 		FrmAppHelper::load_admin_wide_js( false );
265 265
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 
281 281
 		wp_register_script( 'formidable_admin', FrmAppHelper::plugin_url() . '/js/formidable_admin.js', $dependecies, $version, true );
282 282
 		wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
283
-        wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
283
+		wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
284 284
 		wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version );
285 285
 
286 286
 		// load multselect js
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 		global $pagenow;
293 293
 		if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) {
294 294
 
295
-            wp_enqueue_script( 'admin-widgets' );
296
-            wp_enqueue_style( 'widgets' );
297
-            wp_enqueue_script( 'formidable' );
298
-            wp_enqueue_script( 'formidable_admin' );
295
+			wp_enqueue_script( 'admin-widgets' );
296
+			wp_enqueue_style( 'widgets' );
297
+			wp_enqueue_script( 'formidable' );
298
+			wp_enqueue_script( 'formidable_admin' );
299 299
 			FrmAppHelper::localize_script( 'admin' );
300 300
 
301 301
 			wp_enqueue_style( 'formidable-admin' );
@@ -310,36 +310,36 @@  discard block
 block discarded – undo
310 310
 				}
311 311
 			}
312 312
 
313
-            wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
313
+			wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
314 314
 
315 315
 			do_action( 'frm_enqueue_builder_scripts' );
316
-        } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
317
-            if ( isset( $_REQUEST['post_type'] ) ) {
318
-                $post_type = sanitize_title( $_REQUEST['post_type'] );
316
+		} else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
317
+			if ( isset( $_REQUEST['post_type'] ) ) {
318
+				$post_type = sanitize_title( $_REQUEST['post_type'] );
319 319
 			} else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) {
320 320
 				$post = get_post( absint( $_REQUEST['post'] ) );
321
-                if ( ! $post ) {
322
-                    return;
323
-                }
324
-                $post_type = $post->post_type;
325
-            } else {
326
-                return;
327
-            }
328
-
329
-            if ( $post_type == 'frm_display' ) {
330
-                wp_enqueue_script( 'jquery-ui-draggable' );
331
-                wp_enqueue_script( 'formidable_admin' );
332
-                wp_enqueue_style( 'formidable-admin' );
321
+				if ( ! $post ) {
322
+					return;
323
+				}
324
+				$post_type = $post->post_type;
325
+			} else {
326
+				return;
327
+			}
328
+
329
+			if ( $post_type == 'frm_display' ) {
330
+				wp_enqueue_script( 'jquery-ui-draggable' );
331
+				wp_enqueue_script( 'formidable_admin' );
332
+				wp_enqueue_style( 'formidable-admin' );
333 333
 				FrmAppHelper::localize_script( 'admin' );
334
-            }
335
-        } else if ( $pagenow == 'widgets.php' ) {
336
-            FrmAppHelper::load_admin_wide_js();
337
-        }
338
-    }
334
+			}
335
+		} else if ( $pagenow == 'widgets.php' ) {
336
+			FrmAppHelper::load_admin_wide_js();
337
+		}
338
+	}
339 339
 
340
-    public static function load_lang() {
341
-        load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
342
-    }
340
+	public static function load_lang() {
341
+		load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
342
+	}
343 343
 
344 344
 	/**
345 345
 	 * Filter shortcodes in text widgets
@@ -444,21 +444,21 @@  discard block
 block discarded – undo
444 444
 	 * @deprecated 3.0.04
445 445
 	 * @codeCoverageIgnore
446 446
 	 */
447
-    public static function activation_install() {
447
+	public static function activation_install() {
448 448
 		_deprecated_function( __METHOD__, '3.0.04', 'FrmAppController::install' );
449
-        FrmDb::delete_cache_and_transient( 'frm_plugin_version' );
450
-        FrmFormActionsController::actions_init();
451
-        self::install();
452
-    }
449
+		FrmDb::delete_cache_and_transient( 'frm_plugin_version' );
450
+		FrmFormActionsController::actions_init();
451
+		self::install();
452
+	}
453 453
 
454
-    public static function install() {
455
-        $frmdb = new FrmMigrate();
456
-        $frmdb->upgrade();
457
-    }
454
+	public static function install() {
455
+		$frmdb = new FrmMigrate();
456
+		$frmdb->upgrade();
457
+	}
458 458
 
459
-    public static function uninstall() {
459
+	public static function uninstall() {
460 460
 		FrmAppHelper::permission_check( 'administrator' );
461
-        check_ajax_referer( 'frm_ajax', 'nonce' );
461
+		check_ajax_referer( 'frm_ajax', 'nonce' );
462 462
 
463 463
 		$frmdb = new FrmMigrate();
464 464
 		$frmdb->uninstall();
@@ -467,17 +467,17 @@  discard block
 block discarded – undo
467 467
 		deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false );
468 468
 		echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
469 469
 
470
-        wp_die();
471
-    }
470
+		wp_die();
471
+	}
472 472
 
473
-    public static function drop_tables( $tables ) {
474
-        global $wpdb;
475
-        $tables[] = $wpdb->prefix . 'frm_fields';
476
-        $tables[] = $wpdb->prefix . 'frm_forms';
477
-        $tables[] = $wpdb->prefix . 'frm_items';
478
-        $tables[] = $wpdb->prefix . 'frm_item_metas';
479
-        return $tables;
480
-    }
473
+	public static function drop_tables( $tables ) {
474
+		global $wpdb;
475
+		$tables[] = $wpdb->prefix . 'frm_fields';
476
+		$tables[] = $wpdb->prefix . 'frm_forms';
477
+		$tables[] = $wpdb->prefix . 'frm_items';
478
+		$tables[] = $wpdb->prefix . 'frm_item_metas';
479
+		return $tables;
480
+	}
481 481
 
482 482
 	/**
483 483
 	 * Routes for wordpress pages -- we're just replacing content
@@ -496,16 +496,16 @@  discard block
 block discarded – undo
496 496
 		return $content;
497 497
 	}
498 498
 
499
-    public static function deauthorize() {
499
+	public static function deauthorize() {
500 500
 		FrmAppHelper::permission_check( 'frm_change_settings' );
501
-        check_ajax_referer( 'frm_ajax', 'nonce' );
501
+		check_ajax_referer( 'frm_ajax', 'nonce' );
502 502
 
503
-        delete_option( 'frmpro-credentials' );
504
-        delete_option( 'frmpro-authorized' );
505
-        delete_site_option( 'frmpro-credentials' );
506
-        delete_site_option( 'frmpro-authorized' );
507
-        wp_die();
508
-    }
503
+		delete_option( 'frmpro-credentials' );
504
+		delete_option( 'frmpro-authorized' );
505
+		delete_site_option( 'frmpro-credentials' );
506
+		delete_site_option( 'frmpro-authorized' );
507
+		wp_die();
508
+	}
509 509
 
510 510
 	public static function set_footer_text( $text ) {
511 511
 		if ( FrmAppHelper::is_formidable_admin() ) {
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 	 * @deprecated 1.07.05
527 527
 	 * @codeCoverageIgnore
528 528
 	 */
529
-    public static function get_form_shortcode( $atts ) {
530
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
531
-        return FrmFormsController::get_form_shortcode( $atts );
532
-    }
529
+	public static function get_form_shortcode( $atts ) {
530
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
531
+		return FrmFormsController::get_form_shortcode( $atts );
532
+	}
533 533
 }
Please login to merge, or discard this patch.
classes/controllers/FrmFormActionsController.php 1 patch
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmFormActionsController {
4
-    public static $action_post_type = 'frm_form_actions';
5
-    public static $registered_actions;
4
+	public static $action_post_type = 'frm_form_actions';
5
+	public static $registered_actions;
6 6
 
7
-    public static function register_post_types() {
7
+	public static function register_post_types() {
8 8
 		register_post_type(
9 9
 			self::$action_post_type,
10 10
 			array(
@@ -21,90 +21,90 @@  discard block
 block discarded – undo
21 21
 			)
22 22
 		);
23 23
 
24
-        /**
25
-         * post_content: json settings
26
-         * menu_order: form id
27
-         * post_excerpt: action type
28
-         */
24
+		/**
25
+		 * post_content: json settings
26
+		 * menu_order: form id
27
+		 * post_excerpt: action type
28
+		 */
29 29
 
30
-        self::actions_init();
31
-    }
30
+		self::actions_init();
31
+	}
32 32
 
33
-    public static function actions_init() {
34
-        self::$registered_actions = new Frm_Form_Action_Factory();
35
-        self::register_actions();
36
-        do_action( 'frm_form_actions_init' );
37
-    }
33
+	public static function actions_init() {
34
+		self::$registered_actions = new Frm_Form_Action_Factory();
35
+		self::register_actions();
36
+		do_action( 'frm_form_actions_init' );
37
+	}
38 38
 
39
-    public static function register_actions() {
39
+	public static function register_actions() {
40 40
 		$action_classes = array(
41
-            'email'     => 'FrmEmailAction',
42
-            'wppost'    => 'FrmDefPostAction',
43
-            'register'  => 'FrmDefRegAction',
44
-            'paypal'    => 'FrmDefPayPalAction',
45
-            //'aweber'    => 'FrmDefAweberAction',
46
-            'mailchimp' => 'FrmDefMlcmpAction',
47
-            'twilio'    => 'FrmDefTwilioAction',
48
-            'highrise'  => 'FrmDefHrsAction',
49
-        );
41
+			'email'     => 'FrmEmailAction',
42
+			'wppost'    => 'FrmDefPostAction',
43
+			'register'  => 'FrmDefRegAction',
44
+			'paypal'    => 'FrmDefPayPalAction',
45
+			//'aweber'    => 'FrmDefAweberAction',
46
+			'mailchimp' => 'FrmDefMlcmpAction',
47
+			'twilio'    => 'FrmDefTwilioAction',
48
+			'highrise'  => 'FrmDefHrsAction',
49
+		);
50 50
 		$action_classes = apply_filters( 'frm_registered_form_actions', $action_classes );
51 51
 
52 52
 		include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php' );
53 53
 		include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php' );
54 54
 
55
-        foreach ( $action_classes as $action_class ) {
55
+		foreach ( $action_classes as $action_class ) {
56 56
 			self::$registered_actions->register( $action_class );
57
-        }
58
-    }
57
+		}
58
+	}
59 59
 
60 60
 	public static function get_form_actions( $action = 'all' ) {
61
-        $temp_actions = self::$registered_actions;
61
+		$temp_actions = self::$registered_actions;
62 62
 		if ( empty( $temp_actions ) ) {
63
-            self::actions_init();
64
-            $temp_actions = self::$registered_actions->actions;
65
-        } else {
66
-            $temp_actions = $temp_actions->actions;
67
-        }
63
+			self::actions_init();
64
+			$temp_actions = self::$registered_actions->actions;
65
+		} else {
66
+			$temp_actions = $temp_actions->actions;
67
+		}
68 68
 
69
-        $actions = array();
69
+		$actions = array();
70 70
 
71
-        foreach ( $temp_actions as $a ) {
72
-            if ( 'all' != $action && $a->id_base == $action ) {
73
-                return $a;
74
-            }
71
+		foreach ( $temp_actions as $a ) {
72
+			if ( 'all' != $action && $a->id_base == $action ) {
73
+				return $a;
74
+			}
75 75
 
76 76
 			$actions[ $a->id_base ] = $a;
77
-        }
78
-        unset( $temp_actions, $a );
79
-
80
-        $action_limit = 10;
81
-        if ( count( $actions ) <= $action_limit ) {
82
-            return $actions;
83
-        }
84
-
85
-        // remove the last few inactive icons if there are too many
86
-        $temp_actions = $actions;
87
-        arsort( $temp_actions );
88
-        foreach ( $temp_actions as $type => $a ) {
89
-            if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
77
+		}
78
+		unset( $temp_actions, $a );
79
+
80
+		$action_limit = 10;
81
+		if ( count( $actions ) <= $action_limit ) {
82
+			return $actions;
83
+		}
84
+
85
+		// remove the last few inactive icons if there are too many
86
+		$temp_actions = $actions;
87
+		arsort( $temp_actions );
88
+		foreach ( $temp_actions as $type => $a ) {
89
+			if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
90 90
 				unset( $actions[ $type ] );
91
-                if ( count( $actions ) <= $action_limit ) {
92
-                    break;
93
-                }
94
-            }
95
-            unset( $type, $a );
96
-        }
91
+				if ( count( $actions ) <= $action_limit ) {
92
+					break;
93
+				}
94
+			}
95
+			unset( $type, $a );
96
+		}
97 97
 
98
-        return $actions;
99
-    }
98
+		return $actions;
99
+	}
100 100
 
101 101
 	/**
102 102
 	 * @since 2.0
103 103
 	 */
104
-    public static function list_actions( $form, $values ) {
105
-        if ( empty( $form ) ) {
106
-            return;
107
-        }
104
+	public static function list_actions( $form, $values ) {
105
+		if ( empty( $form ) ) {
106
+			return;
107
+		}
108 108
 
109 109
 		/**
110 110
 		 * use this hook to migrate old settings into a new action
@@ -114,72 +114,72 @@  discard block
 block discarded – undo
114 114
 
115 115
 		$form_actions = FrmFormAction::get_action_for_form( $form->id );
116 116
 
117
-        $action_controls = self::get_form_actions();
117
+		$action_controls = self::get_form_actions();
118 118
 
119
-        $action_map = array();
119
+		$action_map = array();
120 120
 
121 121
 		foreach ( $action_controls as $key => $control ) {
122
-            $action_map[ $control->id_base ] = $key;
123
-        }
122
+			$action_map[ $control->id_base ] = $key;
123
+		}
124 124
 
125
-    	foreach ( $form_actions as $action ) {
126
-    	    if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
127
-    	        // don't try and show settings if action no longer exists
128
-    	        continue;
129
-    	    }
125
+		foreach ( $form_actions as $action ) {
126
+			if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
127
+				// don't try and show settings if action no longer exists
128
+				continue;
129
+			}
130 130
 
131
-    		self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
132
-    	}
133
-    }
131
+			self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
132
+		}
133
+	}
134 134
 
135 135
 	public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
136 136
 		$action_control->_set( $action_key );
137 137
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
138
-    }
138
+	}
139 139
 
140
-    public static function add_form_action() {
140
+	public static function add_form_action() {
141 141
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
142
-        check_ajax_referer( 'frm_ajax', 'nonce' );
142
+		check_ajax_referer( 'frm_ajax', 'nonce' );
143 143
 
144
-        global $frm_vars;
144
+		global $frm_vars;
145 145
 
146 146
 		$action_key = absint( $_POST['list_id'] );
147
-        $action_type = sanitize_text_field( $_POST['type'] );
147
+		$action_type = sanitize_text_field( $_POST['type'] );
148 148
 
149
-        $action_control = self::get_form_actions( $action_type );
149
+		$action_control = self::get_form_actions( $action_type );
150 150
 		$action_control->_set( $action_key );
151 151
 
152
-        $form_id = absint( $_POST['form_id'] );
152
+		$form_id = absint( $_POST['form_id'] );
153 153
 
154 154
 		$form_action = $action_control->prepare_new( $form_id );
155 155
 
156
-        $values = array();
156
+		$values = array();
157 157
 		$form = self::fields_to_values( $form_id, $values );
158 158
 
159 159
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
160
-        wp_die();
161
-    }
160
+		wp_die();
161
+	}
162 162
 
163
-    public static function fill_action() {
163
+	public static function fill_action() {
164 164
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
165
-        check_ajax_referer( 'frm_ajax', 'nonce' );
165
+		check_ajax_referer( 'frm_ajax', 'nonce' );
166 166
 
167
-        $action_key = absint( $_POST['action_id'] );
168
-        $action_type = sanitize_text_field( $_POST['action_type'] );
167
+		$action_key = absint( $_POST['action_id'] );
168
+		$action_type = sanitize_text_field( $_POST['action_type'] );
169 169
 
170
-        $action_control = self::get_form_actions( $action_type );
170
+		$action_control = self::get_form_actions( $action_type );
171 171
 		if ( empty( $action_control ) ) {
172
-            wp_die();
173
-        }
172
+			wp_die();
173
+		}
174 174
 
175
-        $form_action = $action_control->get_single_action( $action_key );
175
+		$form_action = $action_control->get_single_action( $action_key );
176 176
 
177
-        $values = array();
177
+		$values = array();
178 178
 		$form = self::fields_to_values( $form_action->menu_order, $values );
179 179
 
180 180
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' );
181
-        wp_die();
182
-    }
181
+		wp_die();
182
+	}
183 183
 
184 184
 	private static function fields_to_values( $form_id, array &$values ) {
185 185
 		$form = FrmForm::getOne( $form_id );
@@ -190,19 +190,19 @@  discard block
 block discarded – undo
190 190
 		);
191 191
 
192 192
 		$fields = FrmField::get_all_for_form( $form->id );
193
-        foreach ( $fields as $k => $f ) {
194
-            $f = (array) $f;
195
-            $opts = (array) $f['field_options'];
193
+		foreach ( $fields as $k => $f ) {
194
+			$f = (array) $f;
195
+			$opts = (array) $f['field_options'];
196 196
 			$f = array_merge( $opts, $f );
197
-            if ( ! isset( $f['post_field'] ) ) {
198
-                $f['post_field'] = '';
199
-            }
200
-            $values['fields'][] = $f;
197
+			if ( ! isset( $f['post_field'] ) ) {
198
+				$f['post_field'] = '';
199
+			}
200
+			$values['fields'][] = $f;
201 201
 			unset( $k, $f );
202
-        }
202
+		}
203 203
 
204
-        return $form;
205
-    }
204
+		return $form;
205
+	}
206 206
 
207 207
 	public static function update_settings( $form_id ) {
208 208
 		$process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 			wp_die( esc_html__( 'You do not have permission to do that', 'formidable' ) );
211 211
 		}
212 212
 
213
-        global $wpdb;
213
+		global $wpdb;
214 214
 
215
-        $registered_actions = self::$registered_actions->actions;
215
+		$registered_actions = self::$registered_actions->actions;
216 216
 
217 217
 		$old_actions = FrmDb::get_col(
218 218
 			$wpdb->posts,
@@ -222,23 +222,23 @@  discard block
 block discarded – undo
222 222
 			),
223 223
 			'ID'
224 224
 		);
225
-        $new_actions = array();
225
+		$new_actions = array();
226 226
 
227
-        foreach ( $registered_actions as $registered_action ) {
227
+		foreach ( $registered_actions as $registered_action ) {
228 228
 			$action_ids = $registered_action->update_callback( $form_id );
229
-            if ( ! empty( $action_ids ) ) {
230
-                $new_actions[] = $action_ids;
231
-            }
232
-        }
229
+			if ( ! empty( $action_ids ) ) {
230
+				$new_actions[] = $action_ids;
231
+			}
232
+		}
233 233
 
234
-        //Only use array_merge if there are new actions
235
-        if ( ! empty( $new_actions ) ) {
236
-            $new_actions = call_user_func_array( 'array_merge', $new_actions );
237
-        }
238
-        $old_actions = array_diff( $old_actions, $new_actions );
234
+		//Only use array_merge if there are new actions
235
+		if ( ! empty( $new_actions ) ) {
236
+			$new_actions = call_user_func_array( 'array_merge', $new_actions );
237
+		}
238
+		$old_actions = array_diff( $old_actions, $new_actions );
239 239
 
240 240
 		self::delete_missing_actions( $old_actions );
241
-    }
241
+	}
242 242
 
243 243
 	public static function delete_missing_actions( $old_actions ) {
244 244
 		if ( ! empty( $old_actions ) ) {
@@ -258,22 +258,22 @@  discard block
 block discarded – undo
258 258
 		self::trigger_actions( $event, $form_id, $entry_id, 'all', $args );
259 259
 	}
260 260
 
261
-    /**
262
-     * @param string $event
263
-     */
261
+	/**
262
+	 * @param string $event
263
+	 */
264 264
 	public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
265 265
 		$form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type );
266 266
 
267 267
 		if ( empty( $form_actions ) ) {
268
-            return;
269
-        }
268
+			return;
269
+		}
270 270
 
271 271
 		FrmForm::maybe_get_form( $form );
272 272
 
273
-        $link_settings = self::get_form_actions( $type );
274
-        if ( 'all' != $type ) {
275
-            $link_settings = array( $type => $link_settings );
276
-        }
273
+		$link_settings = self::get_form_actions( $type );
274
+		if ( 'all' != $type ) {
275
+			$link_settings = array( $type => $link_settings );
276
+		}
277 277
 
278 278
 		$stored_actions = array();
279 279
 		$action_priority = array();
@@ -284,17 +284,17 @@  discard block
 block discarded – undo
284 284
 			$this_event = $event;
285 285
 		}
286 286
 
287
-        foreach ( $form_actions as $action ) {
287
+		foreach ( $form_actions as $action ) {
288 288
 
289 289
 			$skip_this_action = ( ! in_array( $this_event, $action->post_content['event'] ) );
290 290
 			$skip_this_action = apply_filters( 'frm_skip_form_action', $skip_this_action, compact( 'action', 'entry', 'form', 'event' ) );
291 291
 			if ( $skip_this_action ) {
292
-                continue;
293
-            }
292
+				continue;
293
+			}
294 294
 
295
-            if ( ! is_object( $entry ) ) {
296
-                $entry = FrmEntry::getOne( $entry, true );
297
-            }
295
+			if ( ! is_object( $entry ) ) {
296
+				$entry = FrmEntry::getOne( $entry, true );
297
+			}
298 298
 
299 299
 			if ( empty( $entry ) || ( $entry->is_draft && $event != 'draft' ) ) {
300 300
 				continue;
@@ -308,64 +308,64 @@  discard block
 block discarded – undo
308 308
 				if ( ! $trigger_children ) {
309 309
 					continue;
310 310
 				}
311
-            }
311
+			}
312 312
 
313
-            // check conditional logic
313
+			// check conditional logic
314 314
 			$stop = FrmFormAction::action_conditions_met( $action, $entry );
315
-            if ( $stop ) {
316
-                continue;
317
-            }
315
+			if ( $stop ) {
316
+				continue;
317
+			}
318 318
 
319
-            // store actions so they can be triggered with the correct priority
320
-            $stored_actions[ $action->ID ] = $action;
321
-            $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
319
+			// store actions so they can be triggered with the correct priority
320
+			$stored_actions[ $action->ID ] = $action;
321
+			$action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
322 322
 
323 323
 			unset( $action );
324
-        }
324
+		}
325 325
 
326
-        if ( ! empty( $stored_actions ) ) {
326
+		if ( ! empty( $stored_actions ) ) {
327 327
 			asort( $action_priority );
328 328
 
329
-            // make sure hooks are loaded
330
-            new FrmNotification();
329
+			// make sure hooks are loaded
330
+			new FrmNotification();
331 331
 
332
-            foreach ( $action_priority as $action_id => $priority ) {
333
-                $action = $stored_actions[ $action_id ];
332
+			foreach ( $action_priority as $action_id => $priority ) {
333
+				$action = $stored_actions[ $action_id ];
334 334
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
335 335
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
336 336
 
337
-                // If post is created, get updated $entry object
338
-                if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
337
+				// If post is created, get updated $entry object
338
+				if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
339 339
 					$entry = FrmEntry::getOne( $entry->id, true );
340
-                }
341
-            }
342
-        }
343
-    }
340
+				}
341
+			}
342
+		}
343
+	}
344 344
 
345 345
 	public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
346 346
 		if ( ! isset( $args['old_id'] ) || empty( $args['old_id'] ) ) {
347
-            // continue if we know which actions to copy
348
-            return;
349
-        }
347
+			// continue if we know which actions to copy
348
+			return;
349
+		}
350 350
 
351 351
 		$action_controls = self::get_form_actions();
352 352
 
353
-        foreach ( $action_controls as $action_control ) {
354
-            $action_control->duplicate_form_actions( $form_id, $args['old_id'] );
355
-            unset( $action_control );
356
-        }
357
-    }
353
+		foreach ( $action_controls as $action_control ) {
354
+			$action_control->duplicate_form_actions( $form_id, $args['old_id'] );
355
+			unset( $action_control );
356
+		}
357
+	}
358 358
 
359
-    public static function limit_by_type( $where ) {
360
-        global $frm_vars, $wpdb;
359
+	public static function limit_by_type( $where ) {
360
+		global $frm_vars, $wpdb;
361 361
 
362
-        if ( ! isset( $frm_vars['action_type'] ) ) {
363
-            return $where;
364
-        }
362
+		if ( ! isset( $frm_vars['action_type'] ) ) {
363
+			return $where;
364
+		}
365 365
 
366
-        $where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
367
-        return $where;
368
-    }
366
+		$where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
367
+		return $where;
368
+	}
369 369
 }
370 370
 
371 371
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 		foreach ( $keys as $key ) {
393 393
 			// don't register new action if old action with the same id is already registered
394 394
 			if ( ! isset( $this->actions[ $key ] ) ) {
395
-			    $this->actions[ $key ]->_register();
395
+				$this->actions[ $key ]->_register();
396 396
 			}
397 397
 		}
398 398
 	}
Please login to merge, or discard this patch.