Completed
Push — master ( fd7552...ca3d95 )
by Stephanie
02:56
created
classes/models/fields/FrmFieldType.php 3 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -270,6 +270,9 @@  discard block
 block discarded – undo
270 270
 		return $this->alter_builder_classes( $classes );
271 271
 	}
272 272
 
273
+	/**
274
+	 * @param string $classes
275
+	 */
273 276
 	protected function alter_builder_classes( $classes ) {
274 277
 		return $classes;
275 278
 	}
@@ -443,6 +446,11 @@  discard block
 block discarded – undo
443 446
 		return $html;
444 447
 	}
445 448
 
449
+	/**
450
+	 * @param string $html
451
+	 *
452
+	 * @return string
453
+	 */
446 454
 	protected function after_replace_html_shortcodes( $args, $html ) {
447 455
 		return $html;
448 456
 	}
@@ -667,6 +675,7 @@  discard block
 block discarded – undo
667 675
 	/**
668 676
 	 * Link input to field description for screen readers
669 677
 	 * @since 3.0
678
+	 * @param string $input_html
670 679
 	 */
671 680
 	protected function add_aria_description( $args, &$input_html ) {
672 681
 		if ( $this->get_field_column( 'description' ) != '' ) {
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
 	protected function html_id( $plus = '' ) {
219 219
 		return apply_filters( 'frm_field_get_html_id', 'field_' . $this->get_field_column( 'field_key' ) . $plus, $this->field );
220
-    }
220
+	}
221 221
 
222 222
 	public function display_field_settings() {
223 223
 		$default_settings = $this->default_field_settings();
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 
592 592
 		$input = $this->select_tag( $values );
593 593
 
594
-	    foreach ( $options as $option ) {
594
+		foreach ( $options as $option ) {
595 595
 			$input .= '<option value="' . esc_attr( $option ) . '" ' . selected( $selected, $option, false ) . '>';
596 596
 			$input .= esc_html( $option );
597 597
 			$input .= '</option>';
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 		$field_val = '';
99 99
 		if ( is_object( $this->field ) ) {
100 100
 			$field_val = $this->field->{$column};
101
-		} elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) {
102
-			$field_val = $this->field[ $column ];
101
+		} elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) {
102
+			$field_val = $this->field[$column];
103 103
 		}
104 104
 		return $field_val;
105 105
 	}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		if ( is_object( $this->field ) ) {
113 113
 			$this->field->{$column} = $value;
114 114
 		} elseif ( is_array( $this->field ) ) {
115
-			$this->field[ $column ] = $value;
115
+			$this->field[$column] = $value;
116 116
 		}
117 117
 	}
118 118
 
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
 		$fields = FrmField::field_selection();
324 324
 		$fields = array_merge( $fields, FrmField::pro_field_selection() );
325 325
 
326
-		if ( isset( $fields[ $this->type ] ) ) {
327
-			$name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ];
326
+		if ( isset( $fields[$this->type] ) ) {
327
+			$name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type];
328 328
 		}
329 329
 
330 330
 		return $name;
@@ -585,8 +585,8 @@  discard block
 block discarded – undo
585 585
 		$selected = $values['field_value'];
586 586
 
587 587
 		if ( isset( $values['combo_name'] ) ) {
588
-			$options = $options[ $values['combo_name'] ];
589
-			$selected = ( is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ) ? $selected[ $values['combo_name'] ] : '';
588
+			$options = $options[$values['combo_name']];
589
+			$selected = ( is_array( $selected ) && isset( $selected[$values['combo_name']] ) ) ? $selected[$values['combo_name']] : '';
590 590
 		}
591 591
 
592 592
 		$input = $this->select_tag( $values );
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
 		$value = $this->prepare_display_value( $value, $atts );
721 721
 
722 722
 		if ( is_array( $value ) ) {
723
-			if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) {
724
-				$value = $value[ $atts['show'] ];
723
+			if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) {
724
+				$value = $value[$atts['show']];
725 725
 			} elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) {
726 726
 				$sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
727 727
 				$value = implode( $sep, $value );
@@ -788,8 +788,8 @@  discard block
 block discarded – undo
788 788
 		$saved_entries = $atts['ids'];
789 789
 		$new_value = array();
790 790
 		foreach ( (array) $value as $old_child_id ) {
791
-			if ( isset( $saved_entries[ $old_child_id ] ) ) {
792
-				$new_value[] = $saved_entries[ $old_child_id ];
791
+			if ( isset( $saved_entries[$old_child_id] ) ) {
792
+				$new_value[] = $saved_entries[$old_child_id];
793 793
 			}
794 794
 		}
795 795
 
Please login to merge, or discard this patch.
classes/helpers/FrmShortcodeHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 		}
57 57
 
58 58
 		$with_tags = $args['conditional_check'] ? 3 : 2;
59
-		if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
60
-			$tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
59
+		if ( ! empty( $shortcodes[$with_tags][$short_key] ) ) {
60
+			$tag = str_replace( '[' . $prefix, '', $shortcodes[0][$short_key] );
61 61
 			$tag = str_replace( ']', '', $tag );
62 62
 			$tag = str_replace( chr( 194 ) . chr( 160 ), ' ', $tag );
63 63
 			$tags = preg_split( '/\s+/', $tag, 2 );
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 				$tag = $tags[0];
66 66
 			}
67 67
 		} else {
68
-			$tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
68
+			$tag = $shortcodes[$with_tags - 1][$short_key];
69 69
 		}
70 70
 
71 71
 		return $tag;
Please login to merge, or discard this patch.
classes/views/frm-form-actions/email_action.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -4,12 +4,12 @@  discard block
 block discarded – undo
4 4
 
5 5
 	public function __construct() {
6 6
 		$action_ops = array(
7
-		    'classes'   => 'frm_email_icon frm_icon_font',
8
-            'active'    => true,
7
+			'classes'   => 'frm_email_icon frm_icon_font',
8
+			'active'    => true,
9 9
 			'event'     => array( 'create' ),
10
-            'limit'     => 99,
11
-            'priority'  => 10,
12
-            'ajax_load' => false,
10
+			'limit'     => 99,
11
+			'priority'  => 10,
12
+			'ajax_load' => false,
13 13
 		);
14 14
 		$action_ops = apply_filters( 'frm_email_control_settings', $action_ops );
15 15
 
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
 	}
24 24
 
25 25
 	public function get_defaults() {
26
-	    return array(
27
-            'email_to'      => '[admin_email]',
28
-            'cc'            => '',
29
-            'bcc'           => '',
30
-            'from'          => '[sitename] <[admin_email]>',
31
-            'reply_to'      => '',
32
-            'email_subject' => '',
33
-            'email_message' => '[default-message]',
34
-            'inc_user_info' => 0,
35
-            'plain_text'    => 0,
26
+		return array(
27
+			'email_to'      => '[admin_email]',
28
+			'cc'            => '',
29
+			'bcc'           => '',
30
+			'from'          => '[sitename] <[admin_email]>',
31
+			'reply_to'      => '',
32
+			'email_subject' => '',
33
+			'email_message' => '[default-message]',
34
+			'inc_user_info' => 0,
35
+			'plain_text'    => 0,
36 36
 			'event'         => array( 'create' ),
37
-	    );
37
+		);
38 38
 	}
39 39
 }
Please login to merge, or discard this patch.
classes/views/frm-form-actions/form_action.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@
 block discarded – undo
24 24
     <div class="widget-inside frm_hidden">
25 25
         <?php
26 26
 		if ( defined( 'DOING_AJAX' ) || ! $action_control->action_options['ajax_load'] ) {
27
-            // only load settings if they are just added or are open
27
+			// only load settings if they are just added or are open
28 28
 			include( dirname( __FILE__ ) . '/_action_inside.php' );
29
-        } else {
29
+		} else {
30 30
 			// include hidden settings so action won't get lost on update
31 31
 			?>
32 32
 		<input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'post_excerpt', '' ) ); ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" />
Please login to merge, or discard this patch.
classes/views/frm-entries/form.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     </div>
6 6
 </div>
7 7
 <?php
8
-    return;
8
+	return;
9 9
 }
10 10
 
11 11
 global $frm_vars;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 // close open collapsible toggle div
61 61
 if ( isset( $frm_vars['collapse_div'] ) && $frm_vars['collapse_div'] ) {
62
-    echo "</div>\n";
62
+	echo "</div>\n";
63 63
 	unset( $frm_vars['collapse_div'] );
64 64
 }
65 65
 
Please login to merge, or discard this patch.
classes/views/frm-forms/form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 if ( isset( $values['fields'] ) && ! empty( $values['fields'] ) ) {
47 47
 	$values['count'] = 0;
48 48
 	foreach ( $values['fields'] as $field ) {
49
-		$values['count']++;
49
+		$values['count'] ++;
50 50
 		FrmFieldsController::load_single_field( $field, $values );
51 51
 		unset( $field );
52 52
 	}
Please login to merge, or discard this patch.
classes/controllers/FrmFormActionsController.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                 return $a;
70 70
             }
71 71
 
72
-			$actions[ $a->id_base ] = $a;
72
+			$actions[$a->id_base] = $a;
73 73
         }
74 74
         unset( $temp_actions, $a );
75 75
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         arsort( $temp_actions );
84 84
         foreach ( $temp_actions as $type => $a ) {
85 85
             if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
86
-				unset( $actions[ $type ] );
86
+				unset( $actions[$type] );
87 87
                 if ( count( $actions ) <= $action_limit ) {
88 88
                     break;
89 89
                 }
@@ -115,16 +115,16 @@  discard block
 block discarded – undo
115 115
         $action_map = array();
116 116
 
117 117
 		foreach ( $action_controls as $key => $control ) {
118
-            $action_map[ $control->id_base ] = $key;
118
+            $action_map[$control->id_base] = $key;
119 119
         }
120 120
 
121 121
     	foreach ( $form_actions as $action ) {
122
-    	    if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
122
+    	    if ( ! isset( $action_map[$action->post_excerpt] ) ) {
123 123
     	        // don't try and show settings if action no longer exists
124 124
     	        continue;
125 125
     	    }
126 126
 
127
-    		self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
127
+    		self::action_control( $action, $form, $action->ID, $action_controls[$action_map[$action->post_excerpt]], $values );
128 128
     	}
129 129
     }
130 130
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
             }
305 305
 
306 306
             // store actions so they can be triggered with the correct priority
307
-            $stored_actions[ $action->ID ] = $action;
308
-            $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
307
+            $stored_actions[$action->ID] = $action;
308
+            $action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority'];
309 309
 
310 310
 			unset( $action );
311 311
         }
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
             new FrmNotification();
318 318
 
319 319
             foreach ( $action_priority as $action_id => $priority ) {
320
-                $action = $stored_actions[ $action_id ];
320
+                $action = $stored_actions[$action_id];
321 321
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
322 322
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
323 323
 
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
 	}
365 365
 
366 366
 	public function register( $action_class ) {
367
-		$this->actions[ $action_class ] = new $action_class();
367
+		$this->actions[$action_class] = new $action_class();
368 368
 	}
369 369
 
370 370
 	public function unregister( $action_class ) {
371
-		if ( isset( $this->actions[ $action_class ] ) ) {
372
-			unset( $this->actions[ $action_class ] );
371
+		if ( isset( $this->actions[$action_class] ) ) {
372
+			unset( $this->actions[$action_class] );
373 373
 		}
374 374
 	}
375 375
 
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
 
379 379
 		foreach ( $keys as $key ) {
380 380
 			// don't register new action if old action with the same id is already registered
381
-			if ( ! isset( $this->actions[ $key ] ) ) {
382
-			    $this->actions[ $key ]->_register();
381
+			if ( ! isset( $this->actions[$key] ) ) {
382
+			    $this->actions[$key]->_register();
383 383
 			}
384 384
 		}
385 385
 	}
Please login to merge, or discard this 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
-            'payment'   => 'FrmDefHrsAction',
49
-        );
41
+			'email'     => 'FrmEmailAction',
42
+			'wppost'    => 'FrmDefPostAction',
43
+			'register'  => 'FrmDefRegAction',
44
+			'paypal'    => 'FrmDefPayPalAction',
45
+			//'aweber'    => 'FrmDefAweberAction',
46
+			'mailchimp' => 'FrmDefMlcmpAction',
47
+			'twilio'    => 'FrmDefTwilioAction',
48
+			'payment'   => '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
@@ -117,72 +117,72 @@  discard block
 block discarded – undo
117 117
 		);
118 118
 		$form_actions = FrmFormAction::get_action_for_form( $form->id, 'all', $filters );
119 119
 
120
-        $action_controls = self::get_form_actions();
120
+		$action_controls = self::get_form_actions();
121 121
 
122
-        $action_map = array();
122
+		$action_map = array();
123 123
 
124 124
 		foreach ( $action_controls as $key => $control ) {
125
-            $action_map[ $control->id_base ] = $key;
126
-        }
125
+			$action_map[ $control->id_base ] = $key;
126
+		}
127 127
 
128
-    	foreach ( $form_actions as $action ) {
129
-    	    if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
130
-    	        // don't try and show settings if action no longer exists
131
-    	        continue;
132
-    	    }
128
+		foreach ( $form_actions as $action ) {
129
+			if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
130
+				// don't try and show settings if action no longer exists
131
+				continue;
132
+			}
133 133
 
134
-    		self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
135
-    	}
136
-    }
134
+			self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
135
+		}
136
+	}
137 137
 
138 138
 	public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
139 139
 		$action_control->_set( $action_key );
140 140
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
141
-    }
141
+	}
142 142
 
143
-    public static function add_form_action() {
143
+	public static function add_form_action() {
144 144
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
145
-        check_ajax_referer( 'frm_ajax', 'nonce' );
145
+		check_ajax_referer( 'frm_ajax', 'nonce' );
146 146
 
147
-        global $frm_vars;
147
+		global $frm_vars;
148 148
 
149 149
 		$action_key = absint( $_POST['list_id'] );
150
-        $action_type = sanitize_text_field( $_POST['type'] );
150
+		$action_type = sanitize_text_field( $_POST['type'] );
151 151
 
152
-        $action_control = self::get_form_actions( $action_type );
152
+		$action_control = self::get_form_actions( $action_type );
153 153
 		$action_control->_set( $action_key );
154 154
 
155
-        $form_id = absint( $_POST['form_id'] );
155
+		$form_id = absint( $_POST['form_id'] );
156 156
 
157 157
 		$form_action = $action_control->prepare_new( $form_id );
158 158
 
159
-        $values = array();
159
+		$values = array();
160 160
 		$form = self::fields_to_values( $form_id, $values );
161 161
 
162 162
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
163
-        wp_die();
164
-    }
163
+		wp_die();
164
+	}
165 165
 
166
-    public static function fill_action() {
166
+	public static function fill_action() {
167 167
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
168
-        check_ajax_referer( 'frm_ajax', 'nonce' );
168
+		check_ajax_referer( 'frm_ajax', 'nonce' );
169 169
 
170
-        $action_key = absint( $_POST['action_id'] );
171
-        $action_type = sanitize_text_field( $_POST['action_type'] );
170
+		$action_key = absint( $_POST['action_id'] );
171
+		$action_type = sanitize_text_field( $_POST['action_type'] );
172 172
 
173
-        $action_control = self::get_form_actions( $action_type );
173
+		$action_control = self::get_form_actions( $action_type );
174 174
 		if ( empty( $action_control ) ) {
175
-            wp_die();
176
-        }
175
+			wp_die();
176
+		}
177 177
 
178
-        $form_action = $action_control->get_single_action( $action_key );
178
+		$form_action = $action_control->get_single_action( $action_key );
179 179
 
180
-        $values = array();
180
+		$values = array();
181 181
 		$form = self::fields_to_values( $form_action->menu_order, $values );
182 182
 
183 183
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' );
184
-        wp_die();
185
-    }
184
+		wp_die();
185
+	}
186 186
 
187 187
 	private static function fields_to_values( $form_id, array &$values ) {
188 188
 		$form = FrmForm::getOne( $form_id );
@@ -193,19 +193,19 @@  discard block
 block discarded – undo
193 193
 		);
194 194
 
195 195
 		$fields = FrmField::get_all_for_form( $form->id );
196
-        foreach ( $fields as $k => $f ) {
197
-            $f = (array) $f;
198
-            $opts = (array) $f['field_options'];
196
+		foreach ( $fields as $k => $f ) {
197
+			$f = (array) $f;
198
+			$opts = (array) $f['field_options'];
199 199
 			$f = array_merge( $opts, $f );
200
-            if ( ! isset( $f['post_field'] ) ) {
201
-                $f['post_field'] = '';
202
-            }
203
-            $values['fields'][] = $f;
200
+			if ( ! isset( $f['post_field'] ) ) {
201
+				$f['post_field'] = '';
202
+			}
203
+			$values['fields'][] = $f;
204 204
 			unset( $k, $f );
205
-        }
205
+		}
206 206
 
207
-        return $form;
208
-    }
207
+		return $form;
208
+	}
209 209
 
210 210
 	public static function update_settings( $form_id ) {
211 211
 		$process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
 			wp_die( esc_html__( 'You do not have permission to do that', 'formidable' ) );
214 214
 		}
215 215
 
216
-        global $wpdb;
216
+		global $wpdb;
217 217
 
218
-        $registered_actions = self::$registered_actions->actions;
218
+		$registered_actions = self::$registered_actions->actions;
219 219
 
220 220
 		$old_actions = FrmDb::get_col(
221 221
 			$wpdb->posts,
@@ -225,23 +225,23 @@  discard block
 block discarded – undo
225 225
 			),
226 226
 			'ID'
227 227
 		);
228
-        $new_actions = array();
228
+		$new_actions = array();
229 229
 
230
-        foreach ( $registered_actions as $registered_action ) {
230
+		foreach ( $registered_actions as $registered_action ) {
231 231
 			$action_ids = $registered_action->update_callback( $form_id );
232
-            if ( ! empty( $action_ids ) ) {
233
-                $new_actions[] = $action_ids;
234
-            }
235
-        }
232
+			if ( ! empty( $action_ids ) ) {
233
+				$new_actions[] = $action_ids;
234
+			}
235
+		}
236 236
 
237
-        //Only use array_merge if there are new actions
238
-        if ( ! empty( $new_actions ) ) {
239
-            $new_actions = call_user_func_array( 'array_merge', $new_actions );
240
-        }
241
-        $old_actions = array_diff( $old_actions, $new_actions );
237
+		//Only use array_merge if there are new actions
238
+		if ( ! empty( $new_actions ) ) {
239
+			$new_actions = call_user_func_array( 'array_merge', $new_actions );
240
+		}
241
+		$old_actions = array_diff( $old_actions, $new_actions );
242 242
 
243 243
 		self::delete_missing_actions( $old_actions );
244
-    }
244
+	}
245 245
 
246 246
 	public static function delete_missing_actions( $old_actions ) {
247 247
 		if ( ! empty( $old_actions ) ) {
@@ -261,22 +261,22 @@  discard block
 block discarded – undo
261 261
 		self::trigger_actions( $event, $form_id, $entry_id, 'all', $args );
262 262
 	}
263 263
 
264
-    /**
265
-     * @param string $event
266
-     */
264
+	/**
265
+	 * @param string $event
266
+	 */
267 267
 	public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
268 268
 		$form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type );
269 269
 
270 270
 		if ( empty( $form_actions ) ) {
271
-            return;
272
-        }
271
+			return;
272
+		}
273 273
 
274 274
 		FrmForm::maybe_get_form( $form );
275 275
 
276
-        $link_settings = self::get_form_actions( $type );
277
-        if ( 'all' != $type ) {
278
-            $link_settings = array( $type => $link_settings );
279
-        }
276
+		$link_settings = self::get_form_actions( $type );
277
+		if ( 'all' != $type ) {
278
+			$link_settings = array( $type => $link_settings );
279
+		}
280 280
 
281 281
 		$stored_actions = array();
282 282
 		$action_priority = array();
@@ -287,17 +287,17 @@  discard block
 block discarded – undo
287 287
 			$this_event = $event;
288 288
 		}
289 289
 
290
-        foreach ( $form_actions as $action ) {
290
+		foreach ( $form_actions as $action ) {
291 291
 
292 292
 			$skip_this_action = ( ! in_array( $this_event, $action->post_content['event'] ) );
293 293
 			$skip_this_action = apply_filters( 'frm_skip_form_action', $skip_this_action, compact( 'action', 'entry', 'form', 'event' ) );
294 294
 			if ( $skip_this_action ) {
295
-                continue;
296
-            }
295
+				continue;
296
+			}
297 297
 
298
-            if ( ! is_object( $entry ) ) {
299
-                $entry = FrmEntry::getOne( $entry, true );
300
-            }
298
+			if ( ! is_object( $entry ) ) {
299
+				$entry = FrmEntry::getOne( $entry, true );
300
+			}
301 301
 
302 302
 			if ( empty( $entry ) || ( $entry->is_draft && $event != 'draft' ) ) {
303 303
 				continue;
@@ -311,64 +311,64 @@  discard block
 block discarded – undo
311 311
 				if ( ! $trigger_children ) {
312 312
 					continue;
313 313
 				}
314
-            }
314
+			}
315 315
 
316
-            // check conditional logic
316
+			// check conditional logic
317 317
 			$stop = FrmFormAction::action_conditions_met( $action, $entry );
318
-            if ( $stop ) {
319
-                continue;
320
-            }
318
+			if ( $stop ) {
319
+				continue;
320
+			}
321 321
 
322
-            // store actions so they can be triggered with the correct priority
323
-            $stored_actions[ $action->ID ] = $action;
324
-            $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
322
+			// store actions so they can be triggered with the correct priority
323
+			$stored_actions[ $action->ID ] = $action;
324
+			$action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
325 325
 
326 326
 			unset( $action );
327
-        }
327
+		}
328 328
 
329
-        if ( ! empty( $stored_actions ) ) {
329
+		if ( ! empty( $stored_actions ) ) {
330 330
 			asort( $action_priority );
331 331
 
332
-            // make sure hooks are loaded
333
-            new FrmNotification();
332
+			// make sure hooks are loaded
333
+			new FrmNotification();
334 334
 
335
-            foreach ( $action_priority as $action_id => $priority ) {
336
-                $action = $stored_actions[ $action_id ];
335
+			foreach ( $action_priority as $action_id => $priority ) {
336
+				$action = $stored_actions[ $action_id ];
337 337
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
338 338
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
339 339
 
340
-                // If post is created, get updated $entry object
341
-                if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
340
+				// If post is created, get updated $entry object
341
+				if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
342 342
 					$entry = FrmEntry::getOne( $entry->id, true );
343
-                }
344
-            }
345
-        }
346
-    }
343
+				}
344
+			}
345
+		}
346
+	}
347 347
 
348 348
 	public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
349 349
 		if ( ! isset( $args['old_id'] ) || empty( $args['old_id'] ) ) {
350
-            // continue if we know which actions to copy
351
-            return;
352
-        }
350
+			// continue if we know which actions to copy
351
+			return;
352
+		}
353 353
 
354 354
 		$action_controls = self::get_form_actions();
355 355
 
356
-        foreach ( $action_controls as $action_control ) {
357
-            $action_control->duplicate_form_actions( $form_id, $args['old_id'] );
358
-            unset( $action_control );
359
-        }
360
-    }
356
+		foreach ( $action_controls as $action_control ) {
357
+			$action_control->duplicate_form_actions( $form_id, $args['old_id'] );
358
+			unset( $action_control );
359
+		}
360
+	}
361 361
 
362
-    public static function limit_by_type( $where ) {
363
-        global $frm_vars, $wpdb;
362
+	public static function limit_by_type( $where ) {
363
+		global $frm_vars, $wpdb;
364 364
 
365
-        if ( ! isset( $frm_vars['action_type'] ) ) {
366
-            return $where;
367
-        }
365
+		if ( ! isset( $frm_vars['action_type'] ) ) {
366
+			return $where;
367
+		}
368 368
 
369
-        $where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
370
-        return $where;
371
-    }
369
+		$where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
370
+		return $where;
371
+	}
372 372
 }
373 373
 
374 374
 
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 		foreach ( $keys as $key ) {
396 396
 			// don't register new action if old action with the same id is already registered
397 397
 			if ( ! isset( $this->actions[ $key ] ) ) {
398
-			    $this->actions[ $key ]->_register();
398
+				$this->actions[ $key ]->_register();
399 399
 			}
400 400
 		}
401 401
 	}
Please login to merge, or discard this patch.
classes/controllers/FrmSettingsController.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@
 block discarded – undo
51 51
 
52 52
 		$section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' );
53 53
 		$sections = self::get_settings_tabs();
54
-		if ( ! isset( $sections[ $section ] ) ) {
54
+		if ( ! isset( $sections[$section] ) ) {
55 55
 			wp_die();
56 56
 		}
57 57
 
58
-		$section = $sections[ $section ];
58
+		$section = $sections[$section];
59 59
 
60 60
 		if ( isset( $section['class'] ) ) {
61 61
 			call_user_func( array( $section['class'], $section['function'] ) );
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -2,26 +2,26 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmSettingsController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		// Make sure admins can see the menu items
7 7
 		FrmAppHelper::force_capability( 'frm_change_settings' );
8 8
 
9
-        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
10
-    }
9
+		add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
10
+	}
11 11
 
12
-    public static function license_box() {
12
+	public static function license_box() {
13 13
 		$a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
14
-        include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
15
-    }
14
+		include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
15
+	}
16 16
 
17
-    public static function display_form( $errors = array(), $message = '' ) {
18
-        global $frm_vars;
17
+	public static function display_form( $errors = array(), $message = '' ) {
18
+		global $frm_vars;
19 19
 
20
-        $frm_settings = FrmAppHelper::get_settings();
21
-        $frm_roles = FrmAppHelper::frm_capabilities();
20
+		$frm_settings = FrmAppHelper::get_settings();
21
+		$frm_roles = FrmAppHelper::frm_capabilities();
22 22
 
23
-        $uploads = wp_upload_dir();
24
-        $target_path = $uploads['basedir'] . '/formidable/css';
23
+		$uploads = wp_upload_dir();
24
+		$target_path = $uploads['basedir'] . '/formidable/css';
25 25
 
26 26
 		$sections = self::get_settings_tabs();
27 27
 
@@ -65,49 +65,49 @@  discard block
 block discarded – undo
65 65
 		wp_die();
66 66
 	}
67 67
 
68
-    public static function process_form( $stop_load = false ) {
69
-        global $frm_vars;
68
+	public static function process_form( $stop_load = false ) {
69
+		global $frm_vars;
70 70
 
71
-        $frm_settings = FrmAppHelper::get_settings();
71
+		$frm_settings = FrmAppHelper::get_settings();
72 72
 
73 73
 		$process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
74 74
 		if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
75 75
 			wp_die( esc_html( $frm_settings->admin_permission ) );
76
-        }
76
+		}
77 77
 
78
-        $errors = array();
79
-        $message = '';
78
+		$errors = array();
79
+		$message = '';
80 80
 
81
-        if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) {
82
-            $errors = $frm_settings->validate( $_POST, array() );
81
+		if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) {
82
+			$errors = $frm_settings->validate( $_POST, array() );
83 83
 
84
-            $frm_settings->update( stripslashes_deep( $_POST ) );
84
+			$frm_settings->update( stripslashes_deep( $_POST ) );
85 85
 
86
-            if ( empty( $errors ) ) {
87
-                $frm_settings->store();
88
-                $message = __( 'Settings Saved', 'formidable' );
89
-            }
90
-        } else {
91
-            $message = __( 'Settings Saved', 'formidable' );
92
-        }
86
+			if ( empty( $errors ) ) {
87
+				$frm_settings->store();
88
+				$message = __( 'Settings Saved', 'formidable' );
89
+			}
90
+		} else {
91
+			$message = __( 'Settings Saved', 'formidable' );
92
+		}
93 93
 
94 94
 		if ( $stop_load == 'stop_load' ) {
95
-            $frm_vars['settings_routed'] = true;
96
-            return;
97
-        }
95
+			$frm_vars['settings_routed'] = true;
96
+			return;
97
+		}
98 98
 
99
-        self::display_form( $errors, $message );
100
-    }
99
+		self::display_form( $errors, $message );
100
+	}
101 101
 
102
-    public static function route( $stop_load = false ) {
103
-        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
102
+	public static function route( $stop_load = false ) {
103
+		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
104 104
 		$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
105
-        if ( $action == 'process-form' ) {
105
+		if ( $action == 'process-form' ) {
106 106
 			self::process_form( $stop_load );
107
-        } else if ( $stop_load != 'stop_load' ) {
107
+		} else if ( $stop_load != 'stop_load' ) {
108 108
 			self::display_form();
109
-        }
110
-    }
109
+		}
110
+	}
111 111
 
112 112
 	/**
113 113
 	 * Add CTA to the bottom on the plugin settings pages.
Please login to merge, or discard this patch.
classes/views/styles/custom_css.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@
 block discarded – undo
27 27
 			);
28 28
 		}
29 29
 
30
-        foreach ( $style->post_content as $k => $v ) {
31
-            if ( $k == 'custom_css' ) {
32
-                continue;
33
-            }
34
-        ?>
30
+		foreach ( $style->post_content as $k => $v ) {
31
+			if ( $k == 'custom_css' ) {
32
+				continue;
33
+			}
34
+		?>
35 35
 		<input type="hidden" value="<?php echo esc_attr( $v ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $k ) ); ?>" />    
36 36
 		<?php
37 37
 		}
Please login to merge, or discard this patch.