Completed
Push — master ( abd49c...f34f00 )
by Stephanie
03:37
created
classes/views/frm-forms/settings.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                 <ul class="frm_actions_list">
264 264
                 <?php
265 265
 
266
-                //For each add-on, add an li, class, and javascript function. If active, add an additional class.
266
+				//For each add-on, add an li, class, and javascript function. If active, add an additional class.
267 267
 				$included    = false;
268 268
 				foreach ( $action_controls as $action_control ) {
269 269
 					$classes = ( isset( $action_control->action_options['active'] ) && $action_control->action_options['active'] ) ? 'frm_active_action ' : 'frm_inactive_action ';
@@ -282,14 +282,14 @@  discard block
 block discarded – undo
282 282
 							$install_data = json_encode( $upgrading );
283 283
 						}
284 284
 					}
285
-                    ?>
285
+					?>
286 286
 					<li>
287 287
 						<a href="javascript:void(0)" class="frm_<?php echo esc_attr( $action_control->id_base ) ?>_action frm_bstooltip <?php echo esc_attr( $classes ); ?>" title="<?php echo esc_attr( $action_control->action_options['tooltip'] ) ?>" data-limit="<?php echo esc_attr( isset( $action_control->action_options['limit'] ) ? $action_control->action_options['limit'] : '99' ); ?>" data-actiontype="<?php echo esc_attr( $action_control->id_base ) ?>" data-upgrade="<?php echo esc_attr( $upgrade_label ); ?>" data-oneclick="<?php echo esc_attr( $install_data ); ?>" data-medium="settings-<?php echo esc_attr( $action_control->id_base ); ?>"></a>
288 288
 					</li>
289 289
 <?php
290 290
 					unset( $actions_icon, $classes );
291
-                }
292
-                ?>
291
+				}
292
+				?>
293 293
                 </ul>
294 294
             </div>
295 295
             <div class="frm_no_actions">
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
 									<textarea name="field_options[custom_html_<?php echo esc_attr( $field['id'] ); ?>]" rows="7" id="custom_html_<?php echo esc_attr( $field['id'] ); ?>" class="field_custom_html frm_long_input"><?php echo FrmAppHelper::esc_textarea( $field['custom_html'] ); // WPCS: XSS ok. ?></textarea>
329 329
 								</p>
330 330
                             <?php
331
-                            }
331
+							}
332 332
 							unset( $field );
333
-                        }
334
-                    }
333
+						}
334
+					}
335 335
 					?>
336 336
                 </div>
337 337
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -264,7 +264,7 @@
 block discarded – undo
264 264
                 <?php
265 265
 
266 266
                 //For each add-on, add an li, class, and javascript function. If active, add an additional class.
267
-				$included    = false;
267
+				$included = false;
268 268
 				foreach ( $action_controls as $action_control ) {
269 269
 					$classes = ( isset( $action_control->action_options['active'] ) && $action_control->action_options['active'] ) ? 'frm_active_action ' : 'frm_inactive_action ';
270 270
 					$classes .= $action_control->action_options['classes'];
Please login to merge, or discard this patch.
classes/controllers/FrmFormsController.php 1 patch
Indentation   +335 added lines, -335 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmFormsController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		$menu_label = __( 'Forms', 'formidable' );
7 7
 		if ( ! FrmAppHelper::pro_is_installed() ) {
8 8
 			$menu_label .= ' (Lite)';
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 		add_submenu_page( 'formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11 11
 
12 12
 		self::maybe_load_listing_hooks();
13
-    }
13
+	}
14 14
 
15 15
 	public static function maybe_load_listing_hooks() {
16 16
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 		add_filter( 'manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
25 25
 	}
26 26
 
27
-    public static function head() {
27
+	public static function head() {
28 28
 		wp_enqueue_script( 'formidable-editinplace' );
29 29
 
30
-        if ( wp_is_mobile() ) {
31
-    		wp_enqueue_script( 'jquery-touch-punch' );
32
-    	}
33
-    }
30
+		if ( wp_is_mobile() ) {
31
+			wp_enqueue_script( 'jquery-touch-punch' );
32
+		}
33
+	}
34 34
 
35 35
 	public static function register_widgets() {
36 36
 		require_once( FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php' );
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	public static function new_form( $values = array() ) {
76 76
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
77 77
 
78
-        global $frm_vars;
78
+		global $frm_vars;
79 79
 
80 80
 		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
81 81
 		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
 		} else if ( $action == 'new' ) {
87 87
 			$frm_field_selection = FrmField::field_selection();
88 88
 			$values = FrmFormsHelper::setup_new_vars( $values );
89
-            $id = FrmForm::create( $values );
89
+			$id = FrmForm::create( $values );
90 90
 			$form = FrmForm::getOne( $id );
91 91
 
92 92
 			self::create_default_email_action( $form );
93 93
 
94 94
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
95 95
 
96
-            $values['id'] = $id;
96
+			$values['id'] = $id;
97 97
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
98
-        }
99
-    }
98
+		}
99
+	}
100 100
 
101 101
 	/**
102 102
 	 * Create the default email action
@@ -105,41 +105,41 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @param object $form
107 107
 	 */
108
-    private static function create_default_email_action( $form ) {
109
-    	$create_email = apply_filters( 'frm_create_default_email_action', true, $form );
108
+	private static function create_default_email_action( $form ) {
109
+		$create_email = apply_filters( 'frm_create_default_email_action', true, $form );
110 110
 
111
-	    if ( $create_email ) {
112
-		    $action_control = FrmFormActionsController::get_form_actions( 'email' );
113
-		    $action_control->create( $form->id );
114
-	    }
115
-    }
111
+		if ( $create_email ) {
112
+			$action_control = FrmFormActionsController::get_form_actions( 'email' );
113
+			$action_control->create( $form->id );
114
+		}
115
+	}
116 116
 
117 117
 	public static function create( $values = array() ) {
118 118
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
119 119
 
120
-        global $frm_vars;
121
-        if ( empty( $values ) ) {
122
-            $values = $_POST;
123
-        }
120
+		global $frm_vars;
121
+		if ( empty( $values ) ) {
122
+			$values = $_POST;
123
+		}
124 124
 
125
-        //Set radio button and checkbox meta equal to "other" value
126
-        if ( FrmAppHelper::pro_is_installed() ) {
127
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
128
-        }
125
+		//Set radio button and checkbox meta equal to "other" value
126
+		if ( FrmAppHelper::pro_is_installed() ) {
127
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
128
+		}
129 129
 
130 130
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
131 131
 
132
-        if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
133
-            $frm_settings = FrmAppHelper::get_settings();
134
-            $errors = array( 'form' => $frm_settings->admin_permission );
135
-        } else {
132
+		if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
133
+			$frm_settings = FrmAppHelper::get_settings();
134
+			$errors = array( 'form' => $frm_settings->admin_permission );
135
+		} else {
136 136
 			$errors = FrmForm::validate( $values );
137
-        }
137
+		}
138 138
 
139 139
 		if ( count( $errors ) > 0 ) {
140
-            $hide_preview = true;
140
+			$hide_preview = true;
141 141
 			$frm_field_selection = FrmField::field_selection();
142
-            $form = FrmForm::getOne( $id );
142
+			$form = FrmForm::getOne( $id );
143 143
 			$fields = FrmField::get_all_for_form( $id );
144 144
 
145 145
 			$values = FrmAppHelper::setup_edit_vars( $form, 'forms', '', true );
@@ -147,30 +147,30 @@  discard block
 block discarded – undo
147 147
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
148 148
 
149 149
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
150
-        } else {
151
-            FrmForm::update( $id, $values, true );
150
+		} else {
151
+			FrmForm::update( $id, $values, true );
152 152
 			$url = admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . $id );
153 153
 			die( FrmAppHelper::js_redirect( $url ) ); // WPCS: XSS ok.
154
-        }
155
-    }
154
+		}
155
+	}
156 156
 
157
-    public static function edit( $values = false ) {
157
+	public static function edit( $values = false ) {
158 158
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
159 159
 
160 160
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
161 161
 		return self::get_edit_vars( $id );
162
-    }
162
+	}
163 163
 
164
-    public static function settings( $id = false, $message = '' ) {
164
+	public static function settings( $id = false, $message = '' ) {
165 165
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
166 166
 
167 167
 		if ( ! $id || ! is_numeric( $id ) ) {
168 168
 			$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
169
-        }
169
+		}
170 170
 		return self::get_settings_vars( $id, array(), $message );
171
-    }
171
+	}
172 172
 
173
-    public static function update_settings() {
173
+	public static function update_settings() {
174 174
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
175 175
 
176 176
 		$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
@@ -184,33 +184,33 @@  discard block
 block discarded – undo
184 184
 
185 185
 		FrmForm::update( $id, $_POST );
186 186
 
187
-        $message = __( 'Settings Successfully Updated', 'formidable' );
187
+		$message = __( 'Settings Successfully Updated', 'formidable' );
188 188
 		return self::get_settings_vars( $id, array(), $message );
189
-    }
189
+	}
190 190
 
191 191
 	public static function update( $values = array() ) {
192 192
 		if ( empty( $values ) ) {
193
-            $values = $_POST;
194
-        }
193
+			$values = $_POST;
194
+		}
195 195
 
196
-        //Set radio button and checkbox meta equal to "other" value
197
-        if ( FrmAppHelper::pro_is_installed() ) {
198
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
199
-        }
196
+		//Set radio button and checkbox meta equal to "other" value
197
+		if ( FrmAppHelper::pro_is_installed() ) {
198
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
199
+		}
200 200
 
201
-        $errors = FrmForm::validate( $values );
202
-        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
203
-        if ( $permission_error !== false ) {
204
-            $errors['form'] = $permission_error;
205
-        }
201
+		$errors = FrmForm::validate( $values );
202
+		$permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
203
+		if ( $permission_error !== false ) {
204
+			$errors['form'] = $permission_error;
205
+		}
206 206
 
207 207
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
208 208
 
209 209
 		if ( count( $errors ) > 0 ) {
210
-            return self::get_edit_vars( $id, $errors );
210
+			return self::get_edit_vars( $id, $errors );
211 211
 		} else {
212
-            FrmForm::update( $id, $values );
213
-            $message = __( 'Form was Successfully Updated', 'formidable' );
212
+			FrmForm::update( $id, $values );
213
+			$message = __( 'Form was Successfully Updated', 'formidable' );
214 214
 
215 215
 			if ( self::is_too_long( $values ) ) {
216 216
 				$message .= '<br/> ' . sprintf(
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
 				);
222 222
 			}
223 223
 
224
-            if ( defined( 'DOING_AJAX' ) ) {
224
+			if ( defined( 'DOING_AJAX' ) ) {
225 225
 				wp_die( esc_html( $message ) );
226
-            }
226
+			}
227 227
 			return self::get_edit_vars( $id, array(), $message );
228
-        }
229
-    }
228
+		}
229
+	}
230 230
 
231 231
 	/**
232 232
 	 * Check if the value at the end of the form was included.
@@ -263,30 +263,30 @@  discard block
 block discarded – undo
263 263
 		wp_die();
264 264
 	}
265 265
 
266
-    public static function duplicate() {
266
+	public static function duplicate() {
267 267
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
268 268
 
269 269
 		$params = FrmForm::list_page_params();
270
-        $form = FrmForm::duplicate( $params['id'], $params['template'], true );
271
-        $message = $params['template'] ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
272
-        if ( $form ) {
270
+		$form = FrmForm::duplicate( $params['id'], $params['template'], true );
271
+		$message = $params['template'] ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
272
+		if ( $form ) {
273 273
 			return self::get_edit_vars( $form, array(), $message, true );
274
-        } else {
274
+		} else {
275 275
 			return self::display_forms_list( $params, __( 'There was a problem creating the new template.', 'formidable' ) );
276
-        }
277
-    }
276
+		}
277
+	}
278 278
 
279
-    public static function page_preview() {
279
+	public static function page_preview() {
280 280
 		$params = FrmForm::list_page_params();
281
-        if ( ! $params['form'] ) {
282
-            return;
283
-        }
281
+		if ( ! $params['form'] ) {
282
+			return;
283
+		}
284 284
 
285
-        $form = FrmForm::getOne( $params['form'] );
285
+		$form = FrmForm::getOne( $params['form'] );
286 286
 		if ( $form ) {
287 287
 			return self::show_form( $form->id, '', true, true );
288 288
 		}
289
-    }
289
+	}
290 290
 
291 291
 	/**
292 292
 	 * @since 3.0
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 		echo self::page_preview(); // WPCS: XSS ok.
296 296
 	}
297 297
 
298
-    public static function preview() {
299
-        do_action( 'frm_wp' );
298
+	public static function preview() {
299
+		do_action( 'frm_wp' );
300 300
 
301
-        global $frm_vars;
302
-        $frm_vars['preview'] = true;
301
+		global $frm_vars;
302
+		$frm_vars['preview'] = true;
303 303
 
304 304
 		self::load_wp();
305 305
 
@@ -413,18 +413,18 @@  discard block
 block discarded – undo
413 413
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' );
414 414
 	}
415 415
 
416
-    public static function untrash() {
416
+	public static function untrash() {
417 417
 		self::change_form_status( 'untrash' );
418
-    }
418
+	}
419 419
 
420 420
 	public static function bulk_untrash( $ids ) {
421 421
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
422 422
 
423
-        $count = FrmForm::set_status( $ids, 'published' );
423
+		$count = FrmForm::set_status( $ids, 'published' );
424 424
 
425 425
 		$message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
426
-        return $message;
427
-    }
426
+		return $message;
427
+	}
428 428
 
429 429
 	/**
430 430
 	 * @since 3.06
@@ -437,9 +437,9 @@  discard block
 block discarded – undo
437 437
 		wp_die();
438 438
 	}
439 439
 
440
-    public static function trash() {
440
+	public static function trash() {
441 441
 		self::change_form_status( 'trash' );
442
-    }
442
+	}
443 443
 
444 444
 	/**
445 445
 	 * @param string $status
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 	public static function bulk_trash( $ids ) {
493 493
 		FrmAppHelper::permission_check( 'frm_delete_forms' );
494 494
 
495
-        $count = 0;
496
-        foreach ( $ids as $id ) {
497
-            if ( FrmForm::trash( $id ) ) {
498
-                $count++;
499
-            }
500
-        }
495
+		$count = 0;
496
+		foreach ( $ids as $id ) {
497
+			if ( FrmForm::trash( $id ) ) {
498
+				$count++;
499
+			}
500
+		}
501 501
 
502 502
 		$current_page = FrmAppHelper::get_simple_request(
503 503
 			array(
@@ -512,56 +512,56 @@  discard block
 block discarded – undo
512 512
 			'</a>'
513 513
 		);
514 514
 
515
-        return $message;
516
-    }
515
+		return $message;
516
+	}
517 517
 
518
-    public static function destroy() {
518
+	public static function destroy() {
519 519
 		FrmAppHelper::permission_check( 'frm_delete_forms' );
520 520
 
521 521
 		$params = FrmForm::list_page_params();
522 522
 
523
-        //check nonce url
523
+		//check nonce url
524 524
 		check_admin_referer( 'destroy_form_' . $params['id'] );
525 525
 
526
-        $count = 0;
527
-        if ( FrmForm::destroy( $params['id'] ) ) {
528
-            $count++;
529
-        }
526
+		$count = 0;
527
+		if ( FrmForm::destroy( $params['id'] ) ) {
528
+			$count++;
529
+		}
530 530
 
531 531
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
532 532
 
533 533
 		self::display_forms_list( $params, $message );
534
-    }
534
+	}
535 535
 
536 536
 	public static function bulk_destroy( $ids ) {
537 537
 		FrmAppHelper::permission_check( 'frm_delete_forms' );
538 538
 
539
-        $count = 0;
540
-        foreach ( $ids as $id ) {
541
-            $d = FrmForm::destroy( $id );
542
-            if ( $d ) {
543
-                $count++;
544
-            }
545
-        }
539
+		$count = 0;
540
+		foreach ( $ids as $id ) {
541
+			$d = FrmForm::destroy( $id );
542
+			if ( $d ) {
543
+				$count++;
544
+			}
545
+		}
546 546
 
547 547
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
548 548
 
549
-        return $message;
550
-    }
549
+		return $message;
550
+	}
551 551
 
552
-    private static function delete_all() {
553
-        //check nonce url
552
+	private static function delete_all() {
553
+		//check nonce url
554 554
 		$permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
555
-        if ( $permission_error !== false ) {
555
+		if ( $permission_error !== false ) {
556 556
 			self::display_forms_list( array(), '', array( $permission_error ) );
557
-            return;
558
-        }
557
+			return;
558
+		}
559 559
 
560 560
 		$count = FrmForm::scheduled_delete( time() );
561 561
 		$message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
562 562
 
563 563
 		self::display_forms_list( array(), $message );
564
-    }
564
+	}
565 565
 
566 566
 	/**
567 567
 	 * Create a custom template from a form
@@ -604,11 +604,11 @@  discard block
 block discarded – undo
604 604
 	}
605 605
 
606 606
 	/**
607
-	* Inserts Formidable button
608
-	* Hook exists since 2.5.0
609
-	*
610
-	* @since 2.0.15
611
-	*/
607
+	 * Inserts Formidable button
608
+	 * Hook exists since 2.5.0
609
+	 *
610
+	 * @since 2.0.15
611
+	 */
612 612
 	public static function insert_form_button() {
613 613
 		if ( current_user_can( 'frm_view_forms' ) ) {
614 614
 			$menu_name = FrmAppHelper::get_menu_name();
@@ -619,45 +619,45 @@  discard block
 block discarded – undo
619 619
 		}
620 620
 	}
621 621
 
622
-    public static function insert_form_popup() {
622
+	public static function insert_form_popup() {
623 623
 		$page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) );
624 624
 		if ( ! in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) {
625
-            return;
626
-        }
625
+			return;
626
+		}
627 627
 
628
-        FrmAppHelper::load_admin_wide_js();
628
+		FrmAppHelper::load_admin_wide_js();
629 629
 
630
-        $shortcodes = array(
630
+		$shortcodes = array(
631 631
 			'formidable' => array(
632 632
 				'name'  => __( 'Form', 'formidable' ),
633 633
 				'label' => __( 'Insert a Form', 'formidable' ),
634 634
 			),
635
-        );
635
+		);
636 636
 
637 637
 		$shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes );
638 638
 
639 639
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' );
640
-    }
640
+	}
641 641
 
642
-    public static function get_shortcode_opts() {
642
+	public static function get_shortcode_opts() {
643 643
 		FrmAppHelper::permission_check( 'frm_view_forms' );
644
-        check_ajax_referer( 'frm_ajax', 'nonce' );
644
+		check_ajax_referer( 'frm_ajax', 'nonce' );
645 645
 
646 646
 		$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
647 647
 		if ( empty( $shortcode ) ) {
648
-            wp_die();
649
-        }
648
+			wp_die();
649
+		}
650 650
 
651 651
 		echo '<div id="sc-opts-' . esc_attr( $shortcode ) . '" class="frm_shortcode_option">';
652 652
 		echo '<input type="radio" name="frmsc" value="' . esc_attr( $shortcode ) . '" id="sc-' . esc_attr( $shortcode ) . '" class="frm_hidden" />';
653 653
 
654
-        $form_id = '';
655
-        $opts = array();
654
+		$form_id = '';
655
+		$opts = array();
656 656
 		switch ( $shortcode ) {
657
-            case 'formidable':
658
-                $opts = array(
657
+			case 'formidable':
658
+				$opts = array(
659 659
 					'form_id'       => 'id',
660
-                    //'key' => ',
660
+					//'key' => ',
661 661
 					'title'         => array(
662 662
 						'val'   => 1,
663 663
 						'label' => __( 'Display form title', 'formidable' ),
@@ -670,8 +670,8 @@  discard block
 block discarded – undo
670 670
 						'val'   => 1,
671 671
 						'label' => __( 'Minimize form HTML', 'formidable' ),
672 672
 					),
673
-                );
674
-        }
673
+				);
674
+		}
675 675
 		$opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode );
676 676
 
677 677
 		if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
@@ -682,38 +682,38 @@  discard block
 block discarded – undo
682 682
 
683 683
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' );
684 684
 
685
-        echo '</div>';
685
+		echo '</div>';
686 686
 
687
-        wp_die();
688
-    }
687
+		wp_die();
688
+	}
689 689
 
690 690
 	public static function display_forms_list( $params = array(), $message = '', $errors = array() ) {
691
-        FrmAppHelper::permission_check( 'frm_view_forms' );
691
+		FrmAppHelper::permission_check( 'frm_view_forms' );
692 692
 
693
-        global $wpdb, $frm_vars;
693
+		global $wpdb, $frm_vars;
694 694
 
695 695
 		if ( empty( $params ) ) {
696 696
 			$params = FrmForm::list_page_params();
697
-        }
697
+		}
698 698
 
699
-        $wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
699
+		$wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
700 700
 
701
-        $pagenum = $wp_list_table->get_pagenum();
701
+		$pagenum = $wp_list_table->get_pagenum();
702 702
 
703
-        $wp_list_table->prepare_items();
703
+		$wp_list_table->prepare_items();
704 704
 
705
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
706
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
705
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
706
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
707 707
 			wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) );
708
-            die();
709
-        }
708
+			die();
709
+		}
710 710
 
711 711
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php' );
712
-    }
712
+	}
713 713
 
714 714
 	public static function get_columns( $columns ) {
715
-	    $columns['cb'] = '<input type="checkbox" />';
716
-	    $columns['id'] = 'ID';
715
+		$columns['cb'] = '<input type="checkbox" />';
716
+		$columns['id'] = 'ID';
717 717
 
718 718
 		$type = FrmAppHelper::get_simple_request(
719 719
 			array(
@@ -723,18 +723,18 @@  discard block
 block discarded – undo
723 723
 			)
724 724
 		);
725 725
 
726
-        if ( 'template' == $type ) {
727
-            $columns['name']        = __( 'Template Name', 'formidable' );
728
-            $columns['type']        = __( 'Type', 'formidable' );
729
-            $columns['form_key']    = __( 'Key', 'formidable' );
730
-        } else {
731
-            $columns['name']        = __( 'Form Title', 'formidable' );
732
-            $columns['entries']     = __( 'Entries', 'formidable' );
733
-            $columns['form_key']    = __( 'Key', 'formidable' );
734
-            $columns['shortcode']   = __( 'Shortcodes', 'formidable' );
735
-        }
726
+		if ( 'template' == $type ) {
727
+			$columns['name']        = __( 'Template Name', 'formidable' );
728
+			$columns['type']        = __( 'Type', 'formidable' );
729
+			$columns['form_key']    = __( 'Key', 'formidable' );
730
+		} else {
731
+			$columns['name']        = __( 'Form Title', 'formidable' );
732
+			$columns['entries']     = __( 'Entries', 'formidable' );
733
+			$columns['form_key']    = __( 'Key', 'formidable' );
734
+			$columns['shortcode']   = __( 'Shortcodes', 'formidable' );
735
+		}
736 736
 
737
-        $columns['created_at'] = __( 'Date', 'formidable' );
737
+		$columns['created_at'] = __( 'Date', 'formidable' );
738 738
 
739 739
 		add_screen_option(
740 740
 			'per_page',
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 			)
746 746
 		);
747 747
 
748
-        return $columns;
748
+		return $columns;
749 749
 	}
750 750
 
751 751
 	public static function get_sortable_columns() {
@@ -775,11 +775,11 @@  discard block
 block discarded – undo
775 775
 	}
776 776
 
777 777
 	public static function save_per_page( $save, $option, $value ) {
778
-        if ( $option == 'formidable_page_formidable_per_page' ) {
779
-            $save = (int) $value;
780
-        }
781
-        return $save;
782
-    }
778
+		if ( $option == 'formidable_page_formidable_per_page' ) {
779
+			$save = (int) $value;
780
+		}
781
+		return $save;
782
+	}
783 783
 
784 784
 	/**
785 785
 	 * Show the template listing page
@@ -834,27 +834,27 @@  discard block
 block discarded – undo
834 834
 	}
835 835
 
836 836
 	private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
837
-        global $frm_vars;
837
+		global $frm_vars;
838 838
 
839
-        $form = FrmForm::getOne( $id );
840
-        if ( ! $form ) {
841
-            wp_die( esc_html__( 'You are trying to edit a form that does not exist.', 'formidable' ) );
842
-        }
839
+		$form = FrmForm::getOne( $id );
840
+		if ( ! $form ) {
841
+			wp_die( esc_html__( 'You are trying to edit a form that does not exist.', 'formidable' ) );
842
+		}
843 843
 
844
-        if ( $form->parent_form_id ) {
844
+		if ( $form->parent_form_id ) {
845 845
 			wp_die( sprintf( esc_html__( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form->parent_form_id ) ) . '">', '</a>' ) );
846
-        }
846
+		}
847 847
 
848 848
 		$frm_field_selection = FrmField::field_selection();
849 849
 		$fields = FrmField::get_all_for_form( $form->id );
850 850
 
851
-        // Automatically add end section fields if they don't exist (2.0 migration)
852
-        $reset_fields = false;
853
-        FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
851
+		// Automatically add end section fields if they don't exist (2.0 migration)
852
+		$reset_fields = false;
853
+		FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
854 854
 
855
-        if ( $reset_fields ) {
856
-            $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
857
-        }
855
+		if ( $reset_fields ) {
856
+			$fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
857
+		}
858 858
 
859 859
 		unset( $end_section_values, $last_order, $open, $reset_fields );
860 860
 
@@ -862,38 +862,38 @@  discard block
 block discarded – undo
862 862
 		$values = FrmAppHelper::setup_edit_vars( $form, 'forms', '', true, array(), $args );
863 863
 		$values['fields'] = $fields;
864 864
 
865
-        $edit_message = __( 'Form was Successfully Updated', 'formidable' );
866
-        if ( $form->is_template && $message == $edit_message ) {
867
-            $message = __( 'Template was Successfully Updated', 'formidable' );
868
-        }
865
+		$edit_message = __( 'Form was Successfully Updated', 'formidable' );
866
+		if ( $form->is_template && $message == $edit_message ) {
867
+			$message = __( 'Template was Successfully Updated', 'formidable' );
868
+		}
869 869
 
870 870
 		$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
871 871
 
872 872
 		if ( defined( 'DOING_AJAX' ) ) {
873
-            wp_die();
874
-        } else if ( $create_link ) {
873
+			wp_die();
874
+		} else if ( $create_link ) {
875 875
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
876
-        } else {
876
+		} else {
877 877
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' );
878
-        }
879
-    }
878
+		}
879
+	}
880 880
 
881 881
 	public static function get_settings_vars( $id, $errors = array(), $message = '' ) {
882 882
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
883 883
 
884
-        global $frm_vars;
884
+		global $frm_vars;
885 885
 
886
-        $form = FrmForm::getOne( $id );
886
+		$form = FrmForm::getOne( $id );
887 887
 
888 888
 		$fields = FrmField::get_all_for_form( $id );
889 889
 		$values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
890 890
 
891 891
 		self::clean_submit_html( $values );
892 892
 
893
-        $action_controls = FrmFormActionsController::get_form_actions();
893
+		$action_controls = FrmFormActionsController::get_form_actions();
894 894
 
895 895
 		$sections = apply_filters( 'frm_add_form_settings_section', array(), $values );
896
-        $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
896
+		$pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
897 897
 
898 898
 		$styles = apply_filters( 'frm_get_style_opts', array() );
899 899
 
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 		FrmAppController::include_upgrade_overlay();
903 903
 
904 904
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' );
905
-    }
905
+	}
906 906
 
907 907
 	/**
908 908
 	 * Replace old Submit Button href with new href to avoid errors in Chrome
@@ -917,10 +917,10 @@  discard block
 block discarded – undo
917 917
 		}
918 918
 	}
919 919
 
920
-    public static function mb_tags_box( $form_id, $class = '' ) {
920
+	public static function mb_tags_box( $form_id, $class = '' ) {
921 921
 		$fields = FrmField::get_all_for_form( $form_id, '', 'include' );
922
-        $linked_forms = array();
923
-        $col = 'one';
922
+		$linked_forms = array();
923
+		$col = 'one';
924 924
 		$settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false;
925 925
 
926 926
 		$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 		$advanced_helpers = self::advanced_helpers( compact( 'fields', 'form_id' ) );
930 930
 
931 931
 		include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' );
932
-    }
932
+	}
933 933
 
934 934
 	/**
935 935
 	 * @since 3.04.01
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 			''          => '',
1024 1024
 			'siteurl'   => __( 'Site URL', 'formidable' ),
1025 1025
 			'sitename'  => __( 'Site Name', 'formidable' ),
1026
-        );
1026
+		);
1027 1027
 
1028 1028
 		if ( ! FrmAppHelper::pro_is_installed() ) {
1029 1029
 			unset( $entry_shortcodes['post_id'] );
@@ -1073,21 +1073,21 @@  discard block
 block discarded – undo
1073 1073
 		wp_die();
1074 1074
 	}
1075 1075
 
1076
-    public static function filter_content( $content, $form, $entry = false ) {
1076
+	public static function filter_content( $content, $form, $entry = false ) {
1077 1077
 		self::get_entry_by_param( $entry );
1078
-        if ( ! $entry ) {
1079
-            return $content;
1080
-        }
1078
+		if ( ! $entry ) {
1079
+			return $content;
1080
+		}
1081 1081
 
1082
-        if ( is_object( $form ) ) {
1083
-            $form = $form->id;
1084
-        }
1082
+		if ( is_object( $form ) ) {
1083
+			$form = $form->id;
1084
+		}
1085 1085
 
1086
-        $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
1087
-        $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
1086
+		$shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
1087
+		$content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
1088 1088
 
1089
-        return $content;
1090
-    }
1089
+		return $content;
1090
+	}
1091 1091
 
1092 1092
 	private static function get_entry_by_param( &$entry ) {
1093 1093
 		if ( ! $entry || ! is_object( $entry ) ) {
@@ -1099,153 +1099,153 @@  discard block
 block discarded – undo
1099 1099
 		}
1100 1100
 	}
1101 1101
 
1102
-    public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
1103
-        return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
1104
-    }
1102
+	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
1103
+		return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
1104
+	}
1105 1105
 
1106
-    public static function process_bulk_form_actions( $errors ) {
1107
-        if ( ! $_REQUEST ) {
1108
-            return $errors;
1109
-        }
1106
+	public static function process_bulk_form_actions( $errors ) {
1107
+		if ( ! $_REQUEST ) {
1108
+			return $errors;
1109
+		}
1110 1110
 
1111 1111
 		$bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
1112
-        if ( $bulkaction == -1 ) {
1112
+		if ( $bulkaction == -1 ) {
1113 1113
 			$bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
1114
-        }
1114
+		}
1115 1115
 
1116
-        if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
1117
-            FrmAppHelper::remove_get_action();
1116
+		if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
1117
+			FrmAppHelper::remove_get_action();
1118 1118
 
1119
-            $bulkaction = str_replace( 'bulk_', '', $bulkaction );
1120
-        }
1119
+			$bulkaction = str_replace( 'bulk_', '', $bulkaction );
1120
+		}
1121 1121
 
1122 1122
 		$ids = FrmAppHelper::get_param( 'item-action', '', 'get', 'sanitize_text_field' );
1123
-        if ( empty( $ids ) ) {
1124
-            $errors[] = __( 'No forms were specified', 'formidable' );
1125
-            return $errors;
1126
-        }
1127
-
1128
-        $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
1129
-        if ( $permission_error !== false ) {
1130
-            $errors[] = $permission_error;
1131
-            return $errors;
1132
-        }
1133
-
1134
-        if ( ! is_array( $ids ) ) {
1135
-            $ids = explode( ',', $ids );
1136
-        }
1137
-
1138
-        switch ( $bulkaction ) {
1139
-            case 'delete':
1140
-                $message = self::bulk_destroy( $ids );
1123
+		if ( empty( $ids ) ) {
1124
+			$errors[] = __( 'No forms were specified', 'formidable' );
1125
+			return $errors;
1126
+		}
1127
+
1128
+		$permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
1129
+		if ( $permission_error !== false ) {
1130
+			$errors[] = $permission_error;
1131
+			return $errors;
1132
+		}
1133
+
1134
+		if ( ! is_array( $ids ) ) {
1135
+			$ids = explode( ',', $ids );
1136
+		}
1137
+
1138
+		switch ( $bulkaction ) {
1139
+			case 'delete':
1140
+				$message = self::bulk_destroy( $ids );
1141 1141
 				break;
1142
-            case 'trash':
1143
-                $message = self::bulk_trash( $ids );
1142
+			case 'trash':
1143
+				$message = self::bulk_trash( $ids );
1144 1144
 				break;
1145
-            case 'untrash':
1146
-                $message = self::bulk_untrash( $ids );
1147
-        }
1145
+			case 'untrash':
1146
+				$message = self::bulk_untrash( $ids );
1147
+		}
1148 1148
 
1149
-        if ( isset( $message ) && ! empty( $message ) ) {
1149
+		if ( isset( $message ) && ! empty( $message ) ) {
1150 1150
 			$errors['message'] = $message;
1151
-        }
1151
+		}
1152 1152
 
1153
-        return $errors;
1154
-    }
1153
+		return $errors;
1154
+	}
1155 1155
 
1156
-    public static function route() {
1156
+	public static function route() {
1157 1157
 		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
1158
-        $vars = array();
1158
+		$vars = array();
1159 1159
 		if ( isset( $_POST['frm_compact_fields'] ) ) {
1160 1160
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
1161 1161
 
1162 1162
 			$json_vars = htmlspecialchars_decode( nl2br( stripslashes( str_replace( '&quot;', '\\\"', $_POST['frm_compact_fields'] ) ) ) );
1163 1163
 			$json_vars = json_decode( $json_vars, true );
1164 1164
 			if ( empty( $json_vars ) ) {
1165
-                // json decoding failed so we should return an error message
1165
+				// json decoding failed so we should return an error message
1166 1166
 				$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
1167
-                if ( 'edit' == $action ) {
1168
-                    $action = 'update';
1169
-                }
1167
+				if ( 'edit' == $action ) {
1168
+					$action = 'update';
1169
+				}
1170 1170
 
1171 1171
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1172
-            } else {
1172
+			} else {
1173 1173
 				$vars = FrmAppHelper::json_to_array( $json_vars );
1174
-                $action = $vars[ $action ];
1174
+				$action = $vars[ $action ];
1175 1175
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
1176 1176
 				$_REQUEST = array_merge( $_REQUEST, $vars );
1177 1177
 				$_POST = array_merge( $_POST, $_REQUEST );
1178
-            }
1179
-        } else {
1178
+			}
1179
+		} else {
1180 1180
 			$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
1181
-    		if ( isset( $_REQUEST['delete_all'] ) ) {
1182
-                // override the action for this page
1183
-    			$action = 'delete_all';
1184
-            }
1185
-        }
1181
+			if ( isset( $_REQUEST['delete_all'] ) ) {
1182
+				// override the action for this page
1183
+				$action = 'delete_all';
1184
+			}
1185
+		}
1186 1186
 
1187 1187
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1188
-        FrmAppHelper::trigger_hook_load( 'form' );
1188
+		FrmAppHelper::trigger_hook_load( 'form' );
1189 1189
 
1190
-        switch ( $action ) {
1191
-            case 'new':
1190
+		switch ( $action ) {
1191
+			case 'new':
1192 1192
 				return self::new_form( $vars );
1193 1193
 			case 'add_new':
1194 1194
 			case 'list_templates':
1195
-            case 'create':
1196
-            case 'edit':
1197
-            case 'update':
1198
-            case 'duplicate':
1199
-            case 'trash':
1200
-            case 'untrash':
1201
-            case 'destroy':
1202
-            case 'delete_all':
1203
-            case 'settings':
1204
-            case 'update_settings':
1195
+			case 'create':
1196
+			case 'edit':
1197
+			case 'update':
1198
+			case 'duplicate':
1199
+			case 'trash':
1200
+			case 'untrash':
1201
+			case 'destroy':
1202
+			case 'delete_all':
1203
+			case 'settings':
1204
+			case 'update_settings':
1205 1205
 				return self::$action( $vars );
1206
-            default:
1206
+			default:
1207 1207
 				do_action( 'frm_form_action_' . $action );
1208 1208
 				if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) {
1209
-                    return;
1210
-                }
1209
+					return;
1210
+				}
1211 1211
 
1212 1212
 				$action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
1213
-                if ( $action == -1 ) {
1213
+				if ( $action == -1 ) {
1214 1214
 					$action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
1215
-                }
1215
+				}
1216 1216
 
1217 1217
 				if ( strpos( $action, 'bulk_' ) === 0 ) {
1218
-                    FrmAppHelper::remove_get_action();
1219
-                    return self::list_form();
1220
-                }
1218
+					FrmAppHelper::remove_get_action();
1219
+					return self::list_form();
1220
+				}
1221 1221
 
1222
-                return self::display_forms_list();
1223
-        }
1224
-    }
1222
+				return self::display_forms_list();
1223
+		}
1224
+	}
1225 1225
 
1226
-    public static function json_error( $errors ) {
1227
-        $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
1228
-        return $errors;
1229
-    }
1226
+	public static function json_error( $errors ) {
1227
+		$errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
1228
+		return $errors;
1229
+	}
1230 1230
 
1231 1231
 
1232
-    /* FRONT-END FORMS */
1233
-    public static function admin_bar_css() {
1232
+	/* FRONT-END FORMS */
1233
+	public static function admin_bar_css() {
1234 1234
 		if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) {
1235
-            return;
1236
-        }
1235
+			return;
1236
+		}
1237 1237
 
1238 1238
 		add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' );
1239 1239
 		FrmAppHelper::load_font_style();
1240 1240
 	}
1241 1241
 
1242 1242
 	public static function admin_bar_configure() {
1243
-        global $frm_vars;
1243
+		global $frm_vars;
1244 1244
 		if ( empty( $frm_vars['forms_loaded'] ) ) {
1245
-            return;
1246
-        }
1245
+			return;
1246
+		}
1247 1247
 
1248
-        $actions = array();
1248
+		$actions = array();
1249 1249
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
1250 1250
 			if ( is_object( $form ) ) {
1251 1251
 				$actions[ $form->id ] = $form->name;
@@ -1300,18 +1300,18 @@  discard block
 block discarded – undo
1300 1300
 		}
1301 1301
 	}
1302 1302
 
1303
-    //formidable shortcode
1303
+	//formidable shortcode
1304 1304
 	public static function get_form_shortcode( $atts ) {
1305
-        global $frm_vars;
1305
+		global $frm_vars;
1306 1306
 		if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) {
1307
-            $sc = '[formidable';
1307
+			$sc = '[formidable';
1308 1308
 			if ( ! empty( $atts ) ) {
1309 1309
 				foreach ( $atts as $k => $v ) {
1310 1310
 					$sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1311 1311
 				}
1312 1312
 			}
1313 1313
 			return $sc . ']';
1314
-        }
1314
+		}
1315 1315
 
1316 1316
 		$shortcode_atts = shortcode_atts(
1317 1317
 			array(
@@ -1329,27 +1329,27 @@  discard block
 block discarded – undo
1329 1329
 		);
1330 1330
 		do_action( 'formidable_shortcode_atts', $shortcode_atts, $atts );
1331 1331
 
1332
-        return self::show_form( $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], $shortcode_atts['description'], $atts );
1333
-    }
1332
+		return self::show_form( $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'], $shortcode_atts['description'], $atts );
1333
+	}
1334 1334
 
1335
-    public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1336
-        if ( empty( $id ) ) {
1337
-            $id = $key;
1338
-        }
1335
+	public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1336
+		if ( empty( $id ) ) {
1337
+			$id = $key;
1338
+		}
1339 1339
 
1340
-        $form = self::maybe_get_form_to_show( $id );
1341
-        if ( ! $form ) {
1342
-            return __( 'Please select a valid form', 'formidable' );
1343
-        }
1340
+		$form = self::maybe_get_form_to_show( $id );
1341
+		if ( ! $form ) {
1342
+			return __( 'Please select a valid form', 'formidable' );
1343
+		}
1344 1344
 
1345 1345
 		FrmAppController::maybe_update_styles();
1346 1346
 
1347 1347
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1348
-        FrmAppHelper::trigger_hook_load( 'form', $form );
1348
+		FrmAppHelper::trigger_hook_load( 'form', $form );
1349 1349
 
1350
-        $form = apply_filters( 'frm_pre_display_form', $form );
1350
+		$form = apply_filters( 'frm_pre_display_form', $form );
1351 1351
 
1352
-        $frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) );
1352
+		$frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form->id ) );
1353 1353
 
1354 1354
 		if ( self::is_viewable_draft_form( $form ) ) {
1355 1355
 			// don't show a draft form on a page
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
 		}
1373 1373
 
1374 1374
 		return $form;
1375
-    }
1375
+	}
1376 1376
 
1377 1377
 	private static function maybe_get_form_to_show( $id ) {
1378 1378
 		$form = false;
@@ -1401,21 +1401,21 @@  discard block
 block discarded – undo
1401 1401
 		return $form->logged_in && get_current_user_id() && isset( $form->options['logged_in_role'] ) && $form->options['logged_in_role'] != '' && ! FrmAppHelper::user_has_permission( $form->options['logged_in_role'] );
1402 1402
 	}
1403 1403
 
1404
-    public static function get_form( $form, $title, $description, $atts = array() ) {
1404
+	public static function get_form( $form, $title, $description, $atts = array() ) {
1405 1405
 		ob_start();
1406 1406
 
1407 1407
 		do_action( 'frm_before_get_form', $atts );
1408 1408
 
1409
-        self::get_form_contents( $form, $title, $description, $atts );
1409
+		self::get_form_contents( $form, $title, $description, $atts );
1410 1410
 		self::enqueue_scripts( FrmForm::get_params( $form ) );
1411 1411
 
1412
-        $contents = ob_get_contents();
1413
-        ob_end_clean();
1412
+		$contents = ob_get_contents();
1413
+		ob_end_clean();
1414 1414
 
1415 1415
 		self::maybe_minimize_form( $atts, $contents );
1416 1416
 
1417
-        return $contents;
1418
-    }
1417
+		return $contents;
1418
+	}
1419 1419
 
1420 1420
 	public static function enqueue_scripts( $params ) {
1421 1421
 		do_action( 'frm_enqueue_form_scripts', $params );
@@ -1768,10 +1768,10 @@  discard block
 block discarded – undo
1768 1768
 	}
1769 1769
 
1770 1770
 	public static function defer_script_loading( $tag, $handle ) {
1771
-	    if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1772
-	        $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1771
+		if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1772
+			$tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1773 1773
 		}
1774
-	    return $tag;
1774
+		return $tag;
1775 1775
 	}
1776 1776
 
1777 1777
 	public static function footer_js( $location = 'footer' ) {
Please login to merge, or discard this patch.
classes/controllers/FrmFormActionsController.php 2 patches
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  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 7
 	/**
8 8
 	 * Variables saved in the post:
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	 * menu_order: form id
11 11
 	 * post_excerpt: action type
12 12
 	 */
13
-    public static function register_post_types() {
13
+	public static function register_post_types() {
14 14
 		register_post_type(
15 15
 			self::$action_post_type,
16 16
 			array(
@@ -27,85 +27,85 @@  discard block
 block discarded – undo
27 27
 			)
28 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',
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 49
 			'api'       => 'FrmDefApiAction',
50
-        );
50
+		);
51 51
 		$action_classes = apply_filters( 'frm_registered_form_actions', $action_classes );
52 52
 
53 53
 		include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php' );
54 54
 		include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php' );
55 55
 
56
-        foreach ( $action_classes as $action_class ) {
56
+		foreach ( $action_classes as $action_class ) {
57 57
 			self::$registered_actions->register( $action_class );
58
-        }
59
-    }
58
+		}
59
+	}
60 60
 
61 61
 	public static function get_form_actions( $action = 'all' ) {
62
-        $temp_actions = self::$registered_actions;
62
+		$temp_actions = self::$registered_actions;
63 63
 		if ( empty( $temp_actions ) ) {
64
-            self::actions_init();
65
-            $temp_actions = self::$registered_actions->actions;
66
-        } else {
67
-            $temp_actions = $temp_actions->actions;
68
-        }
64
+			self::actions_init();
65
+			$temp_actions = self::$registered_actions->actions;
66
+		} else {
67
+			$temp_actions = $temp_actions->actions;
68
+		}
69 69
 
70
-        $actions = array();
70
+		$actions = array();
71 71
 
72
-        foreach ( $temp_actions as $a ) {
73
-            if ( 'all' != $action && $a->id_base == $action ) {
74
-                return $a;
75
-            }
72
+		foreach ( $temp_actions as $a ) {
73
+			if ( 'all' != $action && $a->id_base == $action ) {
74
+				return $a;
75
+			}
76 76
 
77 77
 			$actions[ $a->id_base ] = $a;
78
-        }
79
-        unset( $temp_actions, $a );
80
-
81
-        $action_limit = 10;
82
-        if ( count( $actions ) <= $action_limit ) {
83
-            return $actions;
84
-        }
85
-
86
-        // remove the last few inactive icons if there are too many
87
-        $temp_actions = $actions;
88
-        arsort( $temp_actions );
89
-        foreach ( $temp_actions as $type => $a ) {
90
-            if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
78
+		}
79
+		unset( $temp_actions, $a );
80
+
81
+		$action_limit = 10;
82
+		if ( count( $actions ) <= $action_limit ) {
83
+			return $actions;
84
+		}
85
+
86
+		// remove the last few inactive icons if there are too many
87
+		$temp_actions = $actions;
88
+		arsort( $temp_actions );
89
+		foreach ( $temp_actions as $type => $a ) {
90
+			if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
91 91
 				unset( $actions[ $type ] );
92
-                if ( count( $actions ) <= $action_limit ) {
93
-                    break;
94
-                }
95
-            }
96
-            unset( $type, $a );
97
-        }
92
+				if ( count( $actions ) <= $action_limit ) {
93
+					break;
94
+				}
95
+			}
96
+			unset( $type, $a );
97
+		}
98 98
 
99
-        return $actions;
100
-    }
99
+		return $actions;
100
+	}
101 101
 
102 102
 	/**
103 103
 	 * @since 2.0
104 104
 	 */
105
-    public static function list_actions( $form, $values ) {
106
-        if ( empty( $form ) ) {
107
-            return;
108
-        }
105
+	public static function list_actions( $form, $values ) {
106
+		if ( empty( $form ) ) {
107
+			return;
108
+		}
109 109
 
110 110
 		/**
111 111
 		 * Use this hook to migrate old settings into a new action
@@ -119,23 +119,23 @@  discard block
 block discarded – undo
119 119
 		);
120 120
 		$form_actions = FrmFormAction::get_action_for_form( $form->id, 'all', $filters );
121 121
 
122
-        $action_controls = self::get_form_actions();
122
+		$action_controls = self::get_form_actions();
123 123
 
124
-        $action_map = array();
124
+		$action_map = array();
125 125
 
126 126
 		foreach ( $action_controls as $key => $control ) {
127
-            $action_map[ $control->id_base ] = $key;
128
-        }
127
+			$action_map[ $control->id_base ] = $key;
128
+		}
129 129
 
130
-    	foreach ( $form_actions as $action ) {
131
-    	    if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
132
-    	        // don't try and show settings if action no longer exists
133
-    	        continue;
134
-    	    }
130
+		foreach ( $form_actions as $action ) {
131
+			if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
132
+				// don't try and show settings if action no longer exists
133
+				continue;
134
+			}
135 135
 
136
-    		self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
137
-    	}
138
-    }
136
+			self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
137
+		}
138
+	}
139 139
 
140 140
 	public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
141 141
 		$action_control->_set( $action_key );
@@ -143,54 +143,54 @@  discard block
 block discarded – undo
143 143
 		$use_logging = self::should_show_log_message( $form_action->post_excerpt );
144 144
 
145 145
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
146
-    }
146
+	}
147 147
 
148
-    public static function add_form_action() {
148
+	public static function add_form_action() {
149 149
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
150
-        check_ajax_referer( 'frm_ajax', 'nonce' );
150
+		check_ajax_referer( 'frm_ajax', 'nonce' );
151 151
 
152
-        global $frm_vars;
152
+		global $frm_vars;
153 153
 
154 154
 		$action_key = absint( $_POST['list_id'] );
155
-        $action_type = sanitize_text_field( $_POST['type'] );
155
+		$action_type = sanitize_text_field( $_POST['type'] );
156 156
 
157
-        $action_control = self::get_form_actions( $action_type );
157
+		$action_control = self::get_form_actions( $action_type );
158 158
 		$action_control->_set( $action_key );
159 159
 
160
-        $form_id = absint( $_POST['form_id'] );
160
+		$form_id = absint( $_POST['form_id'] );
161 161
 
162 162
 		$form_action = $action_control->prepare_new( $form_id );
163 163
 		$use_logging = self::should_show_log_message( $action_type );
164 164
 
165
-        $values = array();
165
+		$values = array();
166 166
 		$form = self::fields_to_values( $form_id, $values );
167 167
 
168 168
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
169
-        wp_die();
170
-    }
169
+		wp_die();
170
+	}
171 171
 
172
-    public static function fill_action() {
172
+	public static function fill_action() {
173 173
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
174
-        check_ajax_referer( 'frm_ajax', 'nonce' );
174
+		check_ajax_referer( 'frm_ajax', 'nonce' );
175 175
 
176
-        $action_key = absint( $_POST['action_id'] );
177
-        $action_type = sanitize_text_field( $_POST['action_type'] );
176
+		$action_key = absint( $_POST['action_id'] );
177
+		$action_type = sanitize_text_field( $_POST['action_type'] );
178 178
 
179
-        $action_control = self::get_form_actions( $action_type );
179
+		$action_control = self::get_form_actions( $action_type );
180 180
 		if ( empty( $action_control ) ) {
181
-            wp_die();
182
-        }
181
+			wp_die();
182
+		}
183 183
 
184
-        $form_action = $action_control->get_single_action( $action_key );
184
+		$form_action = $action_control->get_single_action( $action_key );
185 185
 
186
-        $values = array();
186
+		$values = array();
187 187
 		$form = self::fields_to_values( $form_action->menu_order, $values );
188 188
 
189 189
 		$use_logging = self::should_show_log_message( $action_type );
190 190
 
191 191
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' );
192
-        wp_die();
193
-    }
192
+		wp_die();
193
+	}
194 194
 
195 195
 	/**
196 196
 	 * @since 3.06.04
@@ -210,19 +210,19 @@  discard block
 block discarded – undo
210 210
 		);
211 211
 
212 212
 		$fields = FrmField::get_all_for_form( $form->id );
213
-        foreach ( $fields as $k => $f ) {
214
-            $f = (array) $f;
215
-            $opts = (array) $f['field_options'];
213
+		foreach ( $fields as $k => $f ) {
214
+			$f = (array) $f;
215
+			$opts = (array) $f['field_options'];
216 216
 			$f = array_merge( $opts, $f );
217
-            if ( ! isset( $f['post_field'] ) ) {
218
-                $f['post_field'] = '';
219
-            }
220
-            $values['fields'][] = $f;
217
+			if ( ! isset( $f['post_field'] ) ) {
218
+				$f['post_field'] = '';
219
+			}
220
+			$values['fields'][] = $f;
221 221
 			unset( $k, $f );
222
-        }
222
+		}
223 223
 
224
-        return $form;
225
-    }
224
+		return $form;
225
+	}
226 226
 
227 227
 	public static function update_settings( $form_id ) {
228 228
 		$process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 			wp_die( esc_html__( 'You do not have permission to do that', 'formidable' ) );
231 231
 		}
232 232
 
233
-        global $wpdb;
233
+		global $wpdb;
234 234
 
235
-        $registered_actions = self::$registered_actions->actions;
235
+		$registered_actions = self::$registered_actions->actions;
236 236
 
237 237
 		$old_actions = FrmDb::get_col(
238 238
 			$wpdb->posts,
@@ -242,23 +242,23 @@  discard block
 block discarded – undo
242 242
 			),
243 243
 			'ID'
244 244
 		);
245
-        $new_actions = array();
245
+		$new_actions = array();
246 246
 
247
-        foreach ( $registered_actions as $registered_action ) {
247
+		foreach ( $registered_actions as $registered_action ) {
248 248
 			$action_ids = $registered_action->update_callback( $form_id );
249
-            if ( ! empty( $action_ids ) ) {
250
-                $new_actions[] = $action_ids;
251
-            }
252
-        }
249
+			if ( ! empty( $action_ids ) ) {
250
+				$new_actions[] = $action_ids;
251
+			}
252
+		}
253 253
 
254
-        //Only use array_merge if there are new actions
255
-        if ( ! empty( $new_actions ) ) {
256
-            $new_actions = call_user_func_array( 'array_merge', $new_actions );
257
-        }
258
-        $old_actions = array_diff( $old_actions, $new_actions );
254
+		//Only use array_merge if there are new actions
255
+		if ( ! empty( $new_actions ) ) {
256
+			$new_actions = call_user_func_array( 'array_merge', $new_actions );
257
+		}
258
+		$old_actions = array_diff( $old_actions, $new_actions );
259 259
 
260 260
 		self::delete_missing_actions( $old_actions );
261
-    }
261
+	}
262 262
 
263 263
 	public static function delete_missing_actions( $old_actions ) {
264 264
 		if ( ! empty( $old_actions ) ) {
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
 		self::trigger_actions( $event, $form_id, $entry_id, 'all', $args );
279 279
 	}
280 280
 
281
-    /**
282
-     * @param string $event
283
-     */
281
+	/**
282
+	 * @param string $event
283
+	 */
284 284
 	public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
285 285
 		$action_status = array(
286 286
 			'post_status' => 'publish',
@@ -288,15 +288,15 @@  discard block
 block discarded – undo
288 288
 		$form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type, $action_status );
289 289
 
290 290
 		if ( empty( $form_actions ) ) {
291
-            return;
292
-        }
291
+			return;
292
+		}
293 293
 
294 294
 		FrmForm::maybe_get_form( $form );
295 295
 
296
-        $link_settings = self::get_form_actions( $type );
297
-        if ( 'all' != $type ) {
298
-            $link_settings = array( $type => $link_settings );
299
-        }
296
+		$link_settings = self::get_form_actions( $type );
297
+		if ( 'all' != $type ) {
298
+			$link_settings = array( $type => $link_settings );
299
+		}
300 300
 
301 301
 		$stored_actions = array();
302 302
 		$action_priority = array();
@@ -307,17 +307,17 @@  discard block
 block discarded – undo
307 307
 			$this_event = $event;
308 308
 		}
309 309
 
310
-        foreach ( $form_actions as $action ) {
310
+		foreach ( $form_actions as $action ) {
311 311
 
312 312
 			$skip_this_action = ( ! in_array( $this_event, $action->post_content['event'] ) );
313 313
 			$skip_this_action = apply_filters( 'frm_skip_form_action', $skip_this_action, compact( 'action', 'entry', 'form', 'event' ) );
314 314
 			if ( $skip_this_action ) {
315
-                continue;
316
-            }
315
+				continue;
316
+			}
317 317
 
318
-            if ( ! is_object( $entry ) ) {
319
-                $entry = FrmEntry::getOne( $entry, true );
320
-            }
318
+			if ( ! is_object( $entry ) ) {
319
+				$entry = FrmEntry::getOne( $entry, true );
320
+			}
321 321
 
322 322
 			if ( empty( $entry ) || ( $entry->is_draft && $event != 'draft' ) ) {
323 323
 				continue;
@@ -331,64 +331,64 @@  discard block
 block discarded – undo
331 331
 				if ( ! $trigger_children ) {
332 332
 					continue;
333 333
 				}
334
-            }
334
+			}
335 335
 
336
-            // check conditional logic
336
+			// check conditional logic
337 337
 			$stop = FrmFormAction::action_conditions_met( $action, $entry );
338
-            if ( $stop ) {
339
-                continue;
340
-            }
338
+			if ( $stop ) {
339
+				continue;
340
+			}
341 341
 
342
-            // store actions so they can be triggered with the correct priority
343
-            $stored_actions[ $action->ID ] = $action;
344
-            $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
342
+			// store actions so they can be triggered with the correct priority
343
+			$stored_actions[ $action->ID ] = $action;
344
+			$action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
345 345
 
346 346
 			unset( $action );
347
-        }
347
+		}
348 348
 
349
-        if ( ! empty( $stored_actions ) ) {
349
+		if ( ! empty( $stored_actions ) ) {
350 350
 			asort( $action_priority );
351 351
 
352
-            // make sure hooks are loaded
353
-            new FrmNotification();
352
+			// make sure hooks are loaded
353
+			new FrmNotification();
354 354
 
355
-            foreach ( $action_priority as $action_id => $priority ) {
356
-                $action = $stored_actions[ $action_id ];
355
+			foreach ( $action_priority as $action_id => $priority ) {
356
+				$action = $stored_actions[ $action_id ];
357 357
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
358 358
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
359 359
 
360
-                // If post is created, get updated $entry object
361
-                if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
360
+				// If post is created, get updated $entry object
361
+				if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
362 362
 					$entry = FrmEntry::getOne( $entry->id, true );
363
-                }
364
-            }
365
-        }
366
-    }
363
+				}
364
+			}
365
+		}
366
+	}
367 367
 
368 368
 	public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
369 369
 		if ( ! isset( $args['old_id'] ) || empty( $args['old_id'] ) ) {
370
-            // continue if we know which actions to copy
371
-            return;
372
-        }
370
+			// continue if we know which actions to copy
371
+			return;
372
+		}
373 373
 
374 374
 		$action_controls = self::get_form_actions();
375 375
 
376
-        foreach ( $action_controls as $action_control ) {
377
-            $action_control->duplicate_form_actions( $form_id, $args['old_id'] );
378
-            unset( $action_control );
379
-        }
380
-    }
376
+		foreach ( $action_controls as $action_control ) {
377
+			$action_control->duplicate_form_actions( $form_id, $args['old_id'] );
378
+			unset( $action_control );
379
+		}
380
+	}
381 381
 
382
-    public static function limit_by_type( $where ) {
383
-        global $frm_vars, $wpdb;
382
+	public static function limit_by_type( $where ) {
383
+		global $frm_vars, $wpdb;
384 384
 
385
-        if ( ! isset( $frm_vars['action_type'] ) ) {
386
-            return $where;
387
-        }
385
+		if ( ! isset( $frm_vars['action_type'] ) ) {
386
+			return $where;
387
+		}
388 388
 
389
-        $where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
390
-        return $where;
391
-    }
389
+		$where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
390
+		return $where;
391
+	}
392 392
 }
393 393
 
394 394
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 		foreach ( $keys as $key ) {
416 416
 			// don't register new action if old action with the same id is already registered
417 417
 			if ( ! isset( $this->actions[ $key ] ) ) {
418
-			    $this->actions[ $key ]->_register();
418
+				$this->actions[ $key ]->_register();
419 419
 			}
420 420
 		}
421 421
 	}
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                 return $a;
75 75
             }
76 76
 
77
-			$actions[ $a->id_base ] = $a;
77
+			$actions[$a->id_base] = $a;
78 78
         }
79 79
         unset( $temp_actions, $a );
80 80
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         arsort( $temp_actions );
89 89
         foreach ( $temp_actions as $type => $a ) {
90 90
             if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
91
-				unset( $actions[ $type ] );
91
+				unset( $actions[$type] );
92 92
                 if ( count( $actions ) <= $action_limit ) {
93 93
                     break;
94 94
                 }
@@ -124,16 +124,16 @@  discard block
 block discarded – undo
124 124
         $action_map = array();
125 125
 
126 126
 		foreach ( $action_controls as $key => $control ) {
127
-            $action_map[ $control->id_base ] = $key;
127
+            $action_map[$control->id_base] = $key;
128 128
         }
129 129
 
130 130
     	foreach ( $form_actions as $action ) {
131
-    	    if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
131
+    	    if ( ! isset( $action_map[$action->post_excerpt] ) ) {
132 132
     	        // don't try and show settings if action no longer exists
133 133
     	        continue;
134 134
     	    }
135 135
 
136
-    		self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
136
+    		self::action_control( $action, $form, $action->ID, $action_controls[$action_map[$action->post_excerpt]], $values );
137 137
     	}
138 138
     }
139 139
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @return bool
198 198
 	 */
199 199
 	private static function should_show_log_message( $action_type ) {
200
-		$logging     = array( 'api', 'salesforce', 'constantcontact', 'activecampaign' );
200
+		$logging = array( 'api', 'salesforce', 'constantcontact', 'activecampaign' );
201 201
 		return in_array( $action_type, $logging ) && ! function_exists( 'frm_log_autoloader' );
202 202
 	}
203 203
 
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
             }
341 341
 
342 342
             // store actions so they can be triggered with the correct priority
343
-            $stored_actions[ $action->ID ] = $action;
344
-            $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
343
+            $stored_actions[$action->ID] = $action;
344
+            $action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority'];
345 345
 
346 346
 			unset( $action );
347 347
         }
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             new FrmNotification();
354 354
 
355 355
             foreach ( $action_priority as $action_id => $priority ) {
356
-                $action = $stored_actions[ $action_id ];
356
+                $action = $stored_actions[$action_id];
357 357
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
358 358
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
359 359
 
@@ -400,12 +400,12 @@  discard block
 block discarded – undo
400 400
 	}
401 401
 
402 402
 	public function register( $action_class ) {
403
-		$this->actions[ $action_class ] = new $action_class();
403
+		$this->actions[$action_class] = new $action_class();
404 404
 	}
405 405
 
406 406
 	public function unregister( $action_class ) {
407
-		if ( isset( $this->actions[ $action_class ] ) ) {
408
-			unset( $this->actions[ $action_class ] );
407
+		if ( isset( $this->actions[$action_class] ) ) {
408
+			unset( $this->actions[$action_class] );
409 409
 		}
410 410
 	}
411 411
 
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 
415 415
 		foreach ( $keys as $key ) {
416 416
 			// don't register new action if old action with the same id is already registered
417
-			if ( ! isset( $this->actions[ $key ] ) ) {
418
-			    $this->actions[ $key ]->_register();
417
+			if ( ! isset( $this->actions[$key] ) ) {
418
+			    $this->actions[$key]->_register();
419 419
 			}
420 420
 		}
421 421
 	}
Please login to merge, or discard this patch.