Completed
Push — master ( cbbb72...0e27d3 )
by Stephanie
03:08
created
classes/models/FrmEntryValidate.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -1,27 +1,27 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmEntryValidate {
4
-    public static function validate( $values, $exclude = false ) {
5
-        global $wpdb;
4
+	public static function validate( $values, $exclude = false ) {
5
+		global $wpdb;
6 6
 
7
-        FrmEntry::sanitize_entry_post( $values );
8
-        $errors = array();
7
+		FrmEntry::sanitize_entry_post( $values );
8
+		$errors = array();
9 9
 
10
-        if ( ! isset($values['form_id']) || ! isset($values['item_meta']) ) {
11
-            $errors['form'] = __( 'There was a problem with your submission. Please try again.', 'formidable' );
12
-            return $errors;
13
-        }
10
+		if ( ! isset($values['form_id']) || ! isset($values['item_meta']) ) {
11
+			$errors['form'] = __( 'There was a problem with your submission. Please try again.', 'formidable' );
12
+			return $errors;
13
+		}
14 14
 
15 15
 		if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) {
16
-            $errors['form'] = __( 'You do not have permission to do that', 'formidable' );
17
-        }
16
+			$errors['form'] = __( 'You do not have permission to do that', 'formidable' );
17
+		}
18 18
 
19 19
 		if ( ! isset( $values['item_key'] ) || $values['item_key'] == '' ) {
20 20
 			$values['item_key'] = FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_items', 'item_key' );
21 21
 			$_POST['item_key'] = $values['item_key'];
22 22
 		}
23 23
 
24
-        $where = apply_filters('frm_posted_field_ids', array( 'fi.form_id' => $values['form_id'] ) );
24
+		$where = apply_filters('frm_posted_field_ids', array( 'fi.form_id' => $values['form_id'] ) );
25 25
 		// Don't get subfields
26 26
 		$where['fr.parent_form_id'] = array( null, 0 );
27 27
 		// Don't get excluded fields (like file upload fields in the ajax validation)
@@ -29,42 +29,42 @@  discard block
 block discarded – undo
29 29
 			$where['fi.type not'] = $exclude;
30 30
 		}
31 31
 
32
-        $posted_fields = FrmField::getAll($where, 'field_order');
32
+		$posted_fields = FrmField::getAll($where, 'field_order');
33 33
 
34
-        // Pass exclude value to validate_field function so it can be used for repeating sections
35
-        $args = array( 'exclude' => $exclude );
34
+		// Pass exclude value to validate_field function so it can be used for repeating sections
35
+		$args = array( 'exclude' => $exclude );
36 36
 
37
-        foreach ( $posted_fields as $posted_field ) {
38
-            self::validate_field($posted_field, $errors, $values, $args);
39
-            unset($posted_field);
40
-        }
37
+		foreach ( $posted_fields as $posted_field ) {
38
+			self::validate_field($posted_field, $errors, $values, $args);
39
+			unset($posted_field);
40
+		}
41 41
 
42
-        // check for spam
43
-        self::spam_check( $exclude, $values, $errors );
42
+		// check for spam
43
+		self::spam_check( $exclude, $values, $errors );
44 44
 
45
-        $errors = apply_filters( 'frm_validate_entry', $errors, $values, compact('exclude') );
45
+		$errors = apply_filters( 'frm_validate_entry', $errors, $values, compact('exclude') );
46 46
 
47
-        return $errors;
48
-    }
47
+		return $errors;
48
+	}
49 49
 
50
-    public static function validate_field( $posted_field, &$errors, $values, $args = array() ) {
51
-        $defaults = array(
52
-            'id'              => $posted_field->id,
53
-            'parent_field_id' => '', // the id of the repeat or embed form
54
-            'key_pointer'     => '', // the pointer in the posted array
55
-            'exclude'         => array(), // exclude these field types from validation
56
-        );
57
-        $args = wp_parse_args( $args, $defaults );
50
+	public static function validate_field( $posted_field, &$errors, $values, $args = array() ) {
51
+		$defaults = array(
52
+			'id'              => $posted_field->id,
53
+			'parent_field_id' => '', // the id of the repeat or embed form
54
+			'key_pointer'     => '', // the pointer in the posted array
55
+			'exclude'         => array(), // exclude these field types from validation
56
+		);
57
+		$args = wp_parse_args( $args, $defaults );
58 58
 
59
-        if ( empty($args['parent_field_id']) ) {
59
+		if ( empty($args['parent_field_id']) ) {
60 60
 			$value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : '';
61
-        } else {
62
-            // value is from a nested form
63
-            $value = $values;
64
-        }
61
+		} else {
62
+			// value is from a nested form
63
+			$value = $values;
64
+		}
65 65
 
66
-        // Check for values in "Other" fields
67
-        FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args );
66
+		// Check for values in "Other" fields
67
+		FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args );
68 68
 
69 69
 		self::maybe_clear_value_for_default_blank_setting( $posted_field, $value );
70 70
 
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 			$value = reset($value);
74 74
 		}
75 75
 
76
-        if ( $posted_field->required == '1' && ! is_array( $value ) && trim( $value ) == '' ) {
76
+		if ( $posted_field->required == '1' && ! is_array( $value ) && trim( $value ) == '' ) {
77 77
 			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
78
-        } else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) {
79
-            $_POST['item_name'] = $value;
80
-        }
78
+		} else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) {
79
+			$_POST['item_name'] = $value;
80
+		}
81 81
 
82 82
 		if ( $value != '' ) {
83 83
 			self::validate_url_field( $errors, $posted_field, $value, $args );
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 			self::validate_phone_field( $errors, $posted_field, $value, $args );
87 87
 		}
88 88
 
89
-        FrmEntriesHelper::set_posted_value($posted_field, $value, $args);
89
+		FrmEntriesHelper::set_posted_value($posted_field, $value, $args);
90 90
 
91
-        self::validate_recaptcha($errors, $posted_field, $args);
91
+		self::validate_recaptcha($errors, $posted_field, $args);
92 92
 
93 93
 		$errors = apply_filters( 'frm_validate_' . $posted_field->type . '_field_entry', $errors, $posted_field, $value, $args );
94 94
 		$errors = apply_filters( 'frm_validate_field_entry', $errors, $posted_field, $value, $args );
95
-    }
95
+	}
96 96
 
97 97
 	private static function maybe_clear_value_for_default_blank_setting( $field, &$value ) {
98 98
 		if ( FrmField::is_option_true_in_object( $field, 'default_blank' ) && $value == $field->default_value ) {
@@ -102,32 +102,32 @@  discard block
 block discarded – undo
102 102
 
103 103
 	public static function validate_url_field( &$errors, $field, &$value, $args ) {
104 104
 		if ( $value == '' || ! in_array( $field->type, array( 'website', 'url', 'image' ) ) ) {
105
-            return;
106
-        }
105
+			return;
106
+		}
107 107
 
108
-        if ( trim($value) == 'http://' ) {
109
-            $value = '';
110
-        } else {
111
-            $value = esc_url_raw( $value );
108
+		if ( trim($value) == 'http://' ) {
109
+			$value = '';
110
+		} else {
111
+			$value = esc_url_raw( $value );
112 112
 			$value = preg_match( '/^(https?|ftps?|mailto|news|feed|telnet):/is', $value ) ? $value : 'http://' . $value;
113
-        }
113
+		}
114 114
 
115
-        // validate the url format
115
+		// validate the url format
116 116
 		if ( ! preg_match('/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value) ) {
117 117
 			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
118 118
 		}
119
-    }
119
+	}
120 120
 
121 121
 	public static function validate_email_field( &$errors, $field, $value, $args ) {
122
-        if ( $value == '' || $field->type != 'email' ) {
123
-            return;
124
-        }
122
+		if ( $value == '' || $field->type != 'email' ) {
123
+			return;
124
+		}
125 125
 
126
-        //validate the email format
127
-        if ( ! is_email($value) ) {
126
+		//validate the email format
127
+		if ( ! is_email($value) ) {
128 128
 			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
129
-        }
130
-    }
129
+		}
130
+	}
131 131
 
132 132
 	public static function validate_number_field( &$errors, $field, $value, $args ) {
133 133
 		//validate the number format
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 	}
222 222
 
223 223
 	public static function validate_recaptcha( &$errors, $field, $args ) {
224
-        if ( $field->type != 'captcha' || FrmAppHelper::is_admin() || apply_filters( 'frm_is_field_hidden', false, $field, stripslashes_deep( $_POST ) ) ) {
225
-            return;
226
-        }
224
+		if ( $field->type != 'captcha' || FrmAppHelper::is_admin() || apply_filters( 'frm_is_field_hidden', false, $field, stripslashes_deep( $_POST ) ) ) {
225
+			return;
226
+		}
227 227
 
228 228
 		$frm_settings = FrmAppHelper::get_settings();
229 229
 		if ( empty( $frm_settings->pubkey ) ) {
@@ -231,61 +231,61 @@  discard block
 block discarded – undo
231 231
 			return;
232 232
 		}
233 233
 
234
-        if ( ! isset($_POST['g-recaptcha-response']) ) {
235
-            // If captcha is missing, check if it was already verified
234
+		if ( ! isset($_POST['g-recaptcha-response']) ) {
235
+			// If captcha is missing, check if it was already verified
236 236
 			if ( ! isset( $_POST['recaptcha_checked'] ) || ! wp_verify_nonce( $_POST['recaptcha_checked'], 'frm_ajax' ) ) {
237
-                // There was no captcha submitted
237
+				// There was no captcha submitted
238 238
 				$errors[ 'field' . $args['id'] ] = __( 'The captcha is missing from this form', 'formidable' );
239
-            }
240
-            return;
241
-        }
239
+			}
240
+			return;
241
+		}
242 242
 
243
-        $arg_array = array(
244
-            'body'      => array(
243
+		$arg_array = array(
244
+			'body'      => array(
245 245
 				'secret'   => $frm_settings->privkey,
246 246
 				'response' => $_POST['g-recaptcha-response'],
247 247
 				'remoteip' => FrmAppHelper::get_ip_address(),
248 248
 			),
249 249
 		);
250
-        $resp = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', $arg_array );
251
-        $response = json_decode(wp_remote_retrieve_body( $resp ), true);
250
+		$resp = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', $arg_array );
251
+		$response = json_decode(wp_remote_retrieve_body( $resp ), true);
252 252
 
253
-        if ( isset( $response['success'] ) && ! $response['success'] ) {
254
-            // What happens when the CAPTCHA was entered incorrectly
253
+		if ( isset( $response['success'] ) && ! $response['success'] ) {
254
+			// What happens when the CAPTCHA was entered incorrectly
255 255
 			$errors[ 'field' . $args['id'] ] = ( ! isset( $field->field_options['invalid'] ) || $field->field_options['invalid'] == '' ) ? $frm_settings->re_msg : $field->field_options['invalid'];
256
-        } else if ( is_wp_error( $resp ) ) {
256
+		} else if ( is_wp_error( $resp ) ) {
257 257
 			$error_string = $resp->get_error_message();
258 258
 			$errors[ 'field' . $args['id'] ] = __( 'There was a problem verifying your recaptcha', 'formidable' );
259 259
 			$errors[ 'field' . $args['id'] ] .= ' ' . $error_string;
260
-        }
261
-    }
262
-
263
-    /**
264
-     * check for spam
265
-     * @param boolean $exclude
266
-     * @param array $values
267
-     * @param array $errors by reference
268
-     */
269
-    public static function spam_check( $exclude, $values, &$errors ) {
270
-        if ( ! empty( $exclude ) || ! isset( $values['item_meta'] ) || empty( $values['item_meta'] ) || ! empty( $errors ) ) {
271
-            // only check spam if there are no other errors
272
-            return;
273
-        }
260
+		}
261
+	}
262
+
263
+	/**
264
+	 * check for spam
265
+	 * @param boolean $exclude
266
+	 * @param array $values
267
+	 * @param array $errors by reference
268
+	 */
269
+	public static function spam_check( $exclude, $values, &$errors ) {
270
+		if ( ! empty( $exclude ) || ! isset( $values['item_meta'] ) || empty( $values['item_meta'] ) || ! empty( $errors ) ) {
271
+			// only check spam if there are no other errors
272
+			return;
273
+		}
274 274
 
275 275
 		if ( self::is_honeypot_spam() || self::is_spam_bot() ) {
276 276
 			$errors['spam'] = __( 'Your entry appears to be spam!', 'formidable' );
277 277
 		}
278 278
 
279
-    	if ( self::blacklist_check( $values ) ) {
280
-            $errors['spam'] = __( 'Your entry appears to be blacklist spam!', 'formidable' );
281
-    	}
279
+		if ( self::blacklist_check( $values ) ) {
280
+			$errors['spam'] = __( 'Your entry appears to be blacklist spam!', 'formidable' );
281
+		}
282 282
 
283
-        if ( self::is_akismet_spam( $values ) ) {
283
+		if ( self::is_akismet_spam( $values ) ) {
284 284
 			if ( self::is_akismet_enabled_for_user( $values['form_id'] ) ) {
285 285
 				$errors['spam'] = __( 'Your entry appears to be spam!', 'formidable' );
286 286
 			}
287
-	    }
288
-    }
287
+		}
288
+	}
289 289
 
290 290
 	private static function is_honeypot_spam() {
291 291
 		$honeypot_value = FrmAppHelper::get_param( 'frm_verify', '', 'get', 'sanitize_text_field' );
@@ -307,15 +307,15 @@  discard block
 block discarded – undo
307 307
 		return ( isset( $form->options['akismet'] ) && ! empty( $form->options['akismet'] ) && ( $form->options['akismet'] != 'logged' || ! is_user_logged_in() ) );
308 308
 	}
309 309
 
310
-    public static function blacklist_check( $values ) {
311
-        if ( ! apply_filters('frm_check_blacklist', true, $values) ) {
312
-            return false;
313
-        }
310
+	public static function blacklist_check( $values ) {
311
+		if ( ! apply_filters('frm_check_blacklist', true, $values) ) {
312
+			return false;
313
+		}
314 314
 
315
-    	$mod_keys = trim( get_option( 'blacklist_keys' ) );
316
-    	if ( empty( $mod_keys ) ) {
317
-    		return false;
318
-    	}
315
+		$mod_keys = trim( get_option( 'blacklist_keys' ) );
316
+		if ( empty( $mod_keys ) ) {
317
+			return false;
318
+		}
319 319
 
320 320
 		$content = FrmEntriesHelper::entry_array_to_string( $values );
321 321
 		if ( empty( $content ) ) {
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 		$user_info = self::get_spam_check_user_info( $values );
328 328
 
329 329
 		return wp_blacklist_check( $user_info['comment_author'], $user_info['comment_author_email'], $user_info['comment_author_url'], $content, $ip, $user_agent );
330
-    }
330
+	}
331 331
 
332 332
 	/**
333 333
 	 * Check entries for Akismet spam
Please login to merge, or discard this patch.
classes/helpers/FrmFormsHelper.php 2 patches
Indentation   +249 added lines, -249 removed lines patch added patch discarded remove patch
@@ -19,38 +19,38 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public static function get_direct_link( $key, $form = false ) {
21 21
 		$target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) );
22
-        $target_url = apply_filters('frm_direct_link', $target_url, $key, $form);
23
-
24
-        return $target_url;
25
-    }
26
-
27
-    public static function forms_dropdown( $field_name, $field_value = '', $args = array() ) {
28
-        $defaults = array(
29
-            'blank'     => true,
30
-            'field_id'  => false,
31
-            'onchange'  => false,
32
-            'exclude'   => false,
33
-            'class'     => '',
22
+		$target_url = apply_filters('frm_direct_link', $target_url, $key, $form);
23
+
24
+		return $target_url;
25
+	}
26
+
27
+	public static function forms_dropdown( $field_name, $field_value = '', $args = array() ) {
28
+		$defaults = array(
29
+			'blank'     => true,
30
+			'field_id'  => false,
31
+			'onchange'  => false,
32
+			'exclude'   => false,
33
+			'class'     => '',
34 34
 			'inc_children' => 'exclude',
35
-        );
36
-        $args = wp_parse_args( $args, $defaults );
35
+		);
36
+		$args = wp_parse_args( $args, $defaults );
37 37
 
38
-        if ( ! $args['field_id'] ) {
39
-            $args['field_id'] = $field_name;
40
-        }
38
+		if ( ! $args['field_id'] ) {
39
+			$args['field_id'] = $field_name;
40
+		}
41 41
 
42 42
 		$query = array();
43
-        if ( $args['exclude'] ) {
43
+		if ( $args['exclude'] ) {
44 44
 			$query['id !'] = $args['exclude'];
45
-        }
45
+		}
46 46
 
47
-        $where = apply_filters('frm_forms_dropdown', $query, $field_name);
47
+		$where = apply_filters('frm_forms_dropdown', $query, $field_name);
48 48
 		$forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] );
49 49
 		$add_html = array();
50 50
 		self::add_html_attr( $args['onchange'], 'onchange', $add_html );
51 51
 		self::add_html_attr( $args['class'], 'class', $add_html );
52 52
 
53
-        ?>
53
+		?>
54 54
 		<select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $args['field_id'] ) ?>" <?php echo implode( ' ', $add_html ); ?>>
55 55
 		<?php if ( $args['blank'] ) { ?>
56 56
 			<option value=""><?php echo ( $args['blank'] == 1 ) ? ' ' : '- ' . esc_attr( $args['blank'] ) . ' -'; ?></option>
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		<?php } ?>
63 63
         </select>
64 64
         <?php
65
-    }
65
+	}
66 66
 
67 67
 	/**
68 68
 	 * @param string $class
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		}
78 78
 	}
79 79
 
80
-    public static function form_switcher() {
80
+	public static function form_switcher() {
81 81
 		$where = apply_filters( 'frm_forms_dropdown', array(), '' );
82 82
 		$forms = FrmForm::get_published_forms( $where );
83 83
 
@@ -86,32 +86,32 @@  discard block
 block discarded – undo
86 86
 			unset( $args['form'] );
87 87
 		} else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) {
88 88
 			unset( $args['id'] );
89
-        }
89
+		}
90 90
 
91 91
 		$frm_action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
92 92
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) {
93
-            $args['frm_action'] = 'list';
94
-            $args['form'] = 0;
93
+			$args['frm_action'] = 'list';
94
+			$args['form'] = 0;
95 95
 		} else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) {
96
-            $args['frm_action'] = 'edit';
96
+			$args['frm_action'] = 'edit';
97 97
 		} else if ( isset( $_GET['post'] ) ) {
98
-            $args['form'] = 0;
99
-            $base = admin_url('edit.php?post_type=frm_display');
100
-        }
98
+			$args['form'] = 0;
99
+			$base = admin_url('edit.php?post_type=frm_display');
100
+		}
101 101
 
102
-        ?>
102
+		?>
103 103
 		<li class="dropdown last" id="frm_bs_dropdown">
104 104
 			<a href="#" id="frm-navbarDrop" class="frm-dropdown-toggle" data-toggle="dropdown"><?php _e( 'Switch Form', 'formidable' ) ?> <b class="caret"></b></a>
105 105
 		    <ul class="frm-dropdown-menu frm-on-top" role="menu" aria-labelledby="frm-navbarDrop">
106 106
 			<?php
107 107
 			foreach ( $forms as $form ) {
108 108
 				if ( isset( $args['id'] ) ) {
109
-			        $args['id'] = $form->id;
109
+					$args['id'] = $form->id;
110 110
 				}
111
-			    if ( isset( $args['form'] ) ) {
112
-			        $args['form'] = $form->id;
111
+				if ( isset( $args['form'] ) ) {
112
+					$args['form'] = $form->id;
113 113
 				}
114
-                ?>
114
+				?>
115 115
 				<li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li>
116 116
 			<?php
117 117
 				unset( $form );
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
 			</ul>
120 120
 		</li>
121 121
         <?php
122
-    }
122
+	}
123 123
 
124 124
 	public static function get_sortable_classes( $col, $sort_col, $sort_dir ) {
125
-        echo ($sort_col == $col) ? 'sorted' : 'sortable';
126
-        echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc';
127
-    }
125
+		echo ($sort_col == $col) ? 'sorted' : 'sortable';
126
+		echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc';
127
+	}
128 128
 
129 129
 	/**
130 130
 	 * Get the invalid form error message
@@ -148,104 +148,104 @@  discard block
 block discarded – undo
148 148
 		return $message;
149 149
 	}
150 150
 
151
-    /**
152
-     * Used when a form is created
153
-     */
154
-    public static function setup_new_vars( $values = array() ) {
155
-        global $wpdb;
151
+	/**
152
+	 * Used when a form is created
153
+	 */
154
+	public static function setup_new_vars( $values = array() ) {
155
+		global $wpdb;
156 156
 
157
-        if ( ! empty( $values ) ) {
158
-            $post_values = $values;
159
-        } else {
160
-            $values = array();
161
-            $post_values = isset($_POST) ? $_POST : array();
162
-        }
157
+		if ( ! empty( $values ) ) {
158
+			$post_values = $values;
159
+		} else {
160
+			$values = array();
161
+			$post_values = isset($_POST) ? $_POST : array();
162
+		}
163 163
 
164 164
 		foreach ( array( 'name' => '', 'description' => '' ) as $var => $default ) {
165 165
 			if ( ! isset( $values[ $var ] ) ) {
166 166
 				$values[ $var ] = FrmAppHelper::get_param( $var, $default );
167
-            }
168
-        }
167
+			}
168
+		}
169 169
 
170
-        $values['description'] = FrmAppHelper::use_wpautop($values['description']);
170
+		$values['description'] = FrmAppHelper::use_wpautop($values['description']);
171 171
 
172 172
 		foreach ( array( 'form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0 ) as $var => $default ) {
173
-            if ( ! isset( $values[ $var ] ) ) {
173
+			if ( ! isset( $values[ $var ] ) ) {
174 174
 				$values[ $var ] = FrmAppHelper::get_param( $var, $default );
175
-            }
176
-        }
175
+			}
176
+		}
177 177
 
178
-        if ( ! isset( $values['form_key'] ) ) {
178
+		if ( ! isset( $values['form_key'] ) ) {
179 179
 			$values['form_key'] = ( $post_values && isset( $post_values['form_key'] ) ) ? $post_values['form_key'] : FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_forms', 'form_key' );
180
-        }
180
+		}
181 181
 
182 182
 		$values = self::fill_default_opts( $values, false, $post_values );
183 183
 		$values['custom_style'] = FrmAppHelper::custom_style_value( $post_values );
184 184
 
185
-        return apply_filters('frm_setup_new_form_vars', $values);
186
-    }
185
+		return apply_filters('frm_setup_new_form_vars', $values);
186
+	}
187 187
 
188
-    /**
189
-     * Used when editing a form
190
-     */
191
-    public static function setup_edit_vars( $values, $record, $post_values = array() ) {
188
+	/**
189
+	 * Used when editing a form
190
+	 */
191
+	public static function setup_edit_vars( $values, $record, $post_values = array() ) {
192 192
 		if ( empty( $post_values ) ) {
193 193
 			$post_values = stripslashes_deep( $_POST );
194 194
 		}
195 195
 
196
-        $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key;
197
-        $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template;
198
-        $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template;
199
-        $values['status'] = $record->status;
196
+		$values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key;
197
+		$values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template;
198
+		$values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template;
199
+		$values['status'] = $record->status;
200 200
 
201
-        $values = self::fill_default_opts($values, $record, $post_values);
201
+		$values = self::fill_default_opts($values, $record, $post_values);
202 202
 
203
-        return apply_filters('frm_setup_edit_form_vars', $values);
204
-    }
203
+		return apply_filters('frm_setup_edit_form_vars', $values);
204
+	}
205 205
 
206 206
 	public static function fill_default_opts( $values, $record, $post_values ) {
207 207
 
208
-        $defaults = self::get_default_opts();
208
+		$defaults = self::get_default_opts();
209 209
 		foreach ( $defaults as $var => $default ) {
210
-            if ( is_array($default) ) {
211
-                if ( ! isset( $values[ $var ] ) ) {
210
+			if ( is_array($default) ) {
211
+				if ( ! isset( $values[ $var ] ) ) {
212 212
 					$values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array();
213
-                }
213
+				}
214 214
 
215
-                foreach ( $default as $k => $v ) {
215
+				foreach ( $default as $k => $v ) {
216 216
 					$values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v);
217 217
 
218
-                    if ( is_array( $v ) ) {
219
-                        foreach ( $v as $k1 => $v1 ) {
218
+					if ( is_array( $v ) ) {
219
+						foreach ( $v as $k1 => $v1 ) {
220 220
 							$values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 );
221
-                            unset( $k1, $v1 );
222
-                        }
223
-                    }
221
+							unset( $k1, $v1 );
222
+						}
223
+					}
224 224
 
225
-                    unset($k, $v);
226
-                }
227
-            } else {
225
+					unset($k, $v);
226
+				}
227
+			} else {
228 228
 				$values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default );
229
-            }
229
+			}
230 230
 
231
-            unset($var, $default);
232
-        }
231
+			unset($var, $default);
232
+		}
233 233
 
234
-        return $values;
235
-    }
234
+		return $values;
235
+	}
236 236
 
237
-    public static function get_default_opts() {
238
-        $frm_settings = FrmAppHelper::get_settings();
237
+	public static function get_default_opts() {
238
+		$frm_settings = FrmAppHelper::get_settings();
239 239
 
240
-        return array(
241
-            'submit_value' => $frm_settings->submit_value, 'success_action' => 'message',
242
-            'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '',
243
-            'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1,
244
-            'before_html' => self::get_default_html('before'),
245
-            'after_html' => '',
246
-            'submit_html' => self::get_default_html('submit'),
247
-        );
248
-    }
240
+		return array(
241
+			'submit_value' => $frm_settings->submit_value, 'success_action' => 'message',
242
+			'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '',
243
+			'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1,
244
+			'before_html' => self::get_default_html('before'),
245
+			'after_html' => '',
246
+			'submit_html' => self::get_default_html('submit'),
247
+		);
248
+	}
249 249
 
250 250
 	/**
251 251
 	 * @param array $options
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
 		}
261 261
 	}
262 262
 
263
-    /**
264
-     * @param string $loc
265
-     */
263
+	/**
264
+	 * @param string $loc
265
+	 */
266 266
 	public static function get_default_html( $loc ) {
267 267
 		if ( $loc == 'submit' ) {
268
-            $draft_link = self::get_draft_link();
269
-            $default_html = <<<SUBMIT_HTML
268
+			$draft_link = self::get_draft_link();
269
+			$default_html = <<<SUBMIT_HTML
270 270
 <div class="frm_submit">
271 271
 [if back_button]<button type="submit" name="frm_prev_page" formnovalidate="formnovalidate" class="frm_prev_page" [back_hook]>[back_label]</button>[/if back_button]
272 272
 <button class="frm_button_submit" type="submit"  [button_action]>[button_label]</button>
@@ -274,22 +274,22 @@  discard block
 block discarded – undo
274 274
 </div>
275 275
 SUBMIT_HTML;
276 276
 		} else if ( $loc == 'before' ) {
277
-            $default_html = <<<BEFORE_HTML
277
+			$default_html = <<<BEFORE_HTML
278 278
 <legend class="frm_hidden">[form_name]</legend>
279 279
 [if form_name]<h3 class="frm_form_title">[form_name]</h3>[/if form_name]
280 280
 [if form_description]<div class="frm_description">[form_description]</div>[/if form_description]
281 281
 BEFORE_HTML;
282 282
 		} else {
283
-            $default_html = '';
284
-        }
283
+			$default_html = '';
284
+		}
285 285
 
286
-        return $default_html;
287
-    }
286
+		return $default_html;
287
+	}
288 288
 
289
-    public static function get_draft_link() {
290
-        $link = '[if save_draft]<a href="#" class="frm_save_draft" [draft_hook]>[draft_label]</a>[/if save_draft]';
291
-        return $link;
292
-    }
289
+	public static function get_draft_link() {
290
+		$link = '[if save_draft]<a href="#" class="frm_save_draft" [draft_hook]>[draft_label]</a>[/if save_draft]';
291
+		return $link;
292
+	}
293 293
 
294 294
 	public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) {
295 295
 		$button = self::replace_shortcodes( $html, $form, $submit, $form_action, $values );
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
 		echo $button_parts[1];
317 317
 	}
318 318
 
319
-    /**
320
-     * Automatically add end section fields if they don't exist (2.0 migration)
321
-     * @since 2.0
322
-     *
323
-     * @param boolean $reset_fields
324
-     */
325
-    public static function auto_add_end_section_fields( $form, $fields, &$reset_fields ) {
319
+	/**
320
+	 * Automatically add end section fields if they don't exist (2.0 migration)
321
+	 * @since 2.0
322
+	 *
323
+	 * @param boolean $reset_fields
324
+	 */
325
+	public static function auto_add_end_section_fields( $form, $fields, &$reset_fields ) {
326 326
 		if ( empty( $fields ) ) {
327 327
 			return;
328 328
 		}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 		$prev_order = false;
333 333
 		$add_order = 0;
334 334
 		$last_field = false;
335
-        foreach ( $fields as $field ) {
335
+		foreach ( $fields as $field ) {
336 336
 			if ( $prev_order === $field->field_order ) {
337 337
 				$add_order++;
338 338
 			}
@@ -343,48 +343,48 @@  discard block
 block discarded – undo
343 343
 				FrmField::update( $field->id, array( 'field_order' => $field->field_order ) );
344 344
 			}
345 345
 
346
-            switch ( $field->type ) {
347
-                case 'divider':
348
-                    // create an end section if open
346
+			switch ( $field->type ) {
347
+				case 'divider':
348
+					// create an end section if open
349 349
 					self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $field, 'move' );
350 350
 
351
-                    // mark it open for the next end section
352
-                    $open = true;
353
-                break;
354
-                case 'break';
351
+					// mark it open for the next end section
352
+					$open = true;
353
+				break;
354
+				case 'break';
355 355
 					self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $field, 'move' );
356
-                break;
357
-                case 'end_divider':
358
-                    if ( ! $open ) {
359
-                        // the section isn't open, so this is an extra field that needs to be removed
360
-                        FrmField::destroy( $field->id );
361
-                        $reset_fields = true;
362
-                    }
363
-
364
-                    // There is already an end section here, so there is no need to create one
365
-                    $open = false;
366
-            }
356
+				break;
357
+				case 'end_divider':
358
+					if ( ! $open ) {
359
+						// the section isn't open, so this is an extra field that needs to be removed
360
+						FrmField::destroy( $field->id );
361
+						$reset_fields = true;
362
+					}
363
+
364
+					// There is already an end section here, so there is no need to create one
365
+					$open = false;
366
+			}
367 367
 			$prev_order = $field->field_order;
368 368
 
369 369
 			$last_field = $field;
370 370
 			unset( $field );
371
-        }
371
+		}
372 372
 
373 373
 		self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $last_field );
374
-    }
374
+	}
375 375
 
376 376
 	/**
377 377
 	 * Create end section field if it doesn't exist. This is for migration from < 2.0
378 378
 	 * Fix any ordering that may be messed up
379 379
 	 */
380 380
 	public static function maybe_create_end_section( &$open, &$reset_fields, &$add_order, $end_section_values, $field, $move = 'no' ) {
381
-        if ( ! $open ) {
382
-            return;
383
-        }
381
+		if ( ! $open ) {
382
+			return;
383
+		}
384 384
 
385 385
 		$end_section_values['field_order'] = $field->field_order + 1;
386 386
 
387
-        FrmField::create( $end_section_values );
387
+		FrmField::create( $end_section_values );
388 388
 
389 389
 		if ( $move == 'move' ) {
390 390
 			// bump the order of current field unless we're at the end of the form
@@ -392,39 +392,39 @@  discard block
 block discarded – undo
392 392
 		}
393 393
 
394 394
 		$add_order += 2;
395
-        $open = false;
396
-        $reset_fields = true;
397
-    }
395
+		$open = false;
396
+		$reset_fields = true;
397
+	}
398 398
 
399
-    public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) {
399
+	public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) {
400 400
 		foreach ( array( 'form_name' => $title, 'form_description' => $description, 'entry_key' => true ) as $code => $show ) {
401
-            if ( $code == 'form_name' ) {
402
-                $replace_with = $form->name;
403
-            } else if ( $code == 'form_description' ) {
404
-                $replace_with = FrmAppHelper::use_wpautop($form->description);
405
-            } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) {
406
-                $replace_with = FrmAppHelper::simple_get( 'entry' );
407
-            } else {
408
-                $replace_with = '';
409
-            }
401
+			if ( $code == 'form_name' ) {
402
+				$replace_with = $form->name;
403
+			} else if ( $code == 'form_description' ) {
404
+				$replace_with = FrmAppHelper::use_wpautop($form->description);
405
+			} else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) {
406
+				$replace_with = FrmAppHelper::simple_get( 'entry' );
407
+			} else {
408
+				$replace_with = '';
409
+			}
410 410
 
411
-            FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true($show) && $replace_with != '' ), $code, $replace_with, $html );
412
-        }
411
+			FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true($show) && $replace_with != '' ), $code, $replace_with, $html );
412
+		}
413 413
 
414
-        //replace [form_key]
415
-        $html = str_replace('[form_key]', $form->form_key, $html);
414
+		//replace [form_key]
415
+		$html = str_replace('[form_key]', $form->form_key, $html);
416 416
 
417
-        //replace [frmurl]
418
-        $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html);
417
+		//replace [frmurl]
418
+		$html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html);
419 419
 
420 420
 		if ( strpos( $html, '[button_label]' ) ) {
421 421
 			add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 );
422 422
 			$submit_label = apply_filters( 'frm_submit_button', $title, $form );
423 423
 			$submit_label = esc_attr( do_shortcode( $submit_label ) );
424 424
 			$html = str_replace( '[button_label]', $submit_label, $html );
425
-        }
425
+		}
426 426
 
427
-        $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values);
427
+		$html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values);
428 428
 
429 429
 		if ( strpos( $html, '[if back_button]' ) ) {
430 430
 			$html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html );
@@ -438,17 +438,17 @@  discard block
 block discarded – undo
438 438
 			$html = do_shortcode( $html );
439 439
 		}
440 440
 
441
-        return $html;
442
-    }
441
+		return $html;
442
+	}
443 443
 
444 444
 	public static function submit_button_label( $submit ) {
445
-        if ( ! $submit || empty($submit) ) {
446
-            $frm_settings = FrmAppHelper::get_settings();
447
-            $submit = $frm_settings->submit_value;
448
-        }
445
+		if ( ! $submit || empty($submit) ) {
446
+			$frm_settings = FrmAppHelper::get_settings();
447
+			$submit = $frm_settings->submit_value;
448
+		}
449 449
 
450
-        return $submit;
451
-    }
450
+		return $submit;
451
+	}
452 452
 
453 453
 	/**
454 454
 	 * If the Formidable styling isn't being loaded,
@@ -465,19 +465,19 @@  discard block
 block discarded – undo
465 465
 	}
466 466
 
467 467
 	public static function get_form_style_class( $form = false ) {
468
-        $style = self::get_form_style($form);
469
-        $class = ' with_frm_style';
470
-
471
-        if ( empty($style) ) {
472
-            if ( FrmAppHelper::is_admin_page('formidable-entries') ) {
473
-                return $class;
474
-            } else {
475
-                return;
476
-            }
477
-        }
478
-
479
-        //If submit button needs to be inline or centered
480
-        if ( is_object($form) ) {
468
+		$style = self::get_form_style($form);
469
+		$class = ' with_frm_style';
470
+
471
+		if ( empty($style) ) {
472
+			if ( FrmAppHelper::is_admin_page('formidable-entries') ) {
473
+				return $class;
474
+			} else {
475
+				return;
476
+			}
477
+		}
478
+
479
+		//If submit button needs to be inline or centered
480
+		if ( is_object($form) ) {
481 481
 			$form = $form->options;
482 482
 		}
483 483
 
@@ -489,17 +489,17 @@  discard block
 block discarded – undo
489 489
 			$class .= ' frm_center_submit';
490 490
 		}
491 491
 
492
-        $class = apply_filters('frm_add_form_style_class', $class, $style);
492
+		$class = apply_filters('frm_add_form_style_class', $class, $style);
493 493
 
494
-        return $class;
495
-    }
494
+		return $class;
495
+	}
496 496
 
497
-    /**
498
-     * @param string|boolean $form
499
-     *
500
-     * @return string
501
-     */
502
-    public static function get_form_style( $form ) {
497
+	/**
498
+	 * @param string|boolean $form
499
+	 *
500
+	 * @return string
501
+	 */
502
+	public static function get_form_style( $form ) {
503 503
 		$style = 1;
504 504
 		if ( empty( $form ) || 'default' == 'form' ) {
505 505
 			return $style;
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 		$style = ( $form && is_object( $form ) && isset( $form->options['custom_style'] ) ) ? $form->options['custom_style'] : $style;
520 520
 
521 521
 		return $style;
522
-    }
522
+	}
523 523
 
524 524
 	/**
525 525
 	 * Display the validation error messages when an entry is submitted
@@ -581,74 +581,74 @@  discard block
 block discarded – undo
581 581
 	}
582 582
 
583 583
 	public static function get_scroll_js( $form_id ) {
584
-        ?><script type="text/javascript">document.addEventListener('DOMContentLoaded',function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php
585
-    }
584
+		?><script type="text/javascript">document.addEventListener('DOMContentLoaded',function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php
585
+	}
586 586
 
587 587
 	public static function edit_form_link( $form_id ) {
588
-        if ( is_object($form_id) ) {
589
-            $form = $form_id;
590
-            $name = $form->name;
591
-            $form_id = $form->id;
592
-        } else {
593
-            $name = FrmForm::getName($form_id);
594
-        }
595
-
596
-        if ( $form_id ) {
588
+		if ( is_object($form_id) ) {
589
+			$form = $form_id;
590
+			$name = $form->name;
591
+			$form_id = $form->id;
592
+		} else {
593
+			$name = FrmForm::getName($form_id);
594
+		}
595
+
596
+		if ( $form_id ) {
597 597
 			$val = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ) ) . '">' . ( '' == $name ? __( '(no title)' ) : FrmAppHelper::truncate( $name, 40 ) ) . '</a>';
598
-	    } else {
599
-	        $val = '';
600
-	    }
598
+		} else {
599
+			$val = '';
600
+		}
601 601
 
602
-	    return $val;
602
+		return $val;
603 603
 	}
604 604
 
605 605
 	public static function delete_trash_link( $id, $status, $length = 'long' ) {
606
-        $link = '';
607
-        $labels = array(
608
-            'restore' => array(
609
-                'long'  => __( 'Restore from Trash', 'formidable' ),
610
-                'short' => __( 'Restore', 'formidable' ),
611
-            ),
612
-            'trash' => array(
613
-                'long'  => __( 'Move to Trash', 'formidable' ),
614
-                'short' => __( 'Trash', 'formidable' ),
615
-            ),
616
-            'delete' => array(
617
-                'long'  => __( 'Delete Permanently', 'formidable' ),
618
-                'short' => __( 'Delete', 'formidable' ),
619
-            ),
620
-        );
621
-
622
-        $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
606
+		$link = '';
607
+		$labels = array(
608
+			'restore' => array(
609
+				'long'  => __( 'Restore from Trash', 'formidable' ),
610
+				'short' => __( 'Restore', 'formidable' ),
611
+			),
612
+			'trash' => array(
613
+				'long'  => __( 'Move to Trash', 'formidable' ),
614
+				'short' => __( 'Trash', 'formidable' ),
615
+			),
616
+			'delete' => array(
617
+				'long'  => __( 'Delete Permanently', 'formidable' ),
618
+				'short' => __( 'Delete', 'formidable' ),
619
+			),
620
+		);
621
+
622
+		$current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
623 623
 		$base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id;
624
-        if ( 'trash' == $status ) {
624
+		if ( 'trash' == $status ) {
625 625
 			$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>';
626
-        } else if ( current_user_can('frm_delete_forms') ) {
627
-            if ( EMPTY_TRASH_DAYS ) {
626
+		} else if ( current_user_can('frm_delete_forms') ) {
627
+			if ( EMPTY_TRASH_DAYS ) {
628 628
 				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>';
629
-            } else {
629
+			} else {
630 630
 				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>';
631
-            }
632
-        }
631
+			}
632
+		}
633 633
 
634
-        return $link;
635
-    }
634
+		return $link;
635
+	}
636 636
 
637 637
 	public static function status_nice_name( $status ) {
638
-        $nice_names = array(
639
-            'draft'     => __( 'Draft', 'formidable' ),
640
-            'trash'     => __( 'Trash', 'formidable' ),
641
-            'publish'   => __( 'Published', 'formidable' ),
642
-        );
643
-
644
-        if ( ! in_array($status, array_keys($nice_names)) ) {
645
-            $status = 'publish';
646
-        }
638
+		$nice_names = array(
639
+			'draft'     => __( 'Draft', 'formidable' ),
640
+			'trash'     => __( 'Trash', 'formidable' ),
641
+			'publish'   => __( 'Published', 'formidable' ),
642
+		);
643
+
644
+		if ( ! in_array($status, array_keys($nice_names)) ) {
645
+			$status = 'publish';
646
+		}
647 647
 
648 648
 		$name = $nice_names[ $status ];
649 649
 
650
-        return $name;
651
-    }
650
+		return $name;
651
+	}
652 652
 
653 653
 	public static function get_params() {
654 654
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::list_page_params' );
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined('ABSPATH') ) {
2
+if ( ! defined( 'ABSPATH' ) ) {
3 3
 	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public static function get_direct_link( $key, $form = false ) {
21 21
 		$target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) );
22
-        $target_url = apply_filters('frm_direct_link', $target_url, $key, $form);
22
+        $target_url = apply_filters( 'frm_direct_link', $target_url, $key, $form );
23 23
 
24 24
         return $target_url;
25 25
     }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$query['id !'] = $args['exclude'];
45 45
         }
46 46
 
47
-        $where = apply_filters('frm_forms_dropdown', $query, $field_name);
47
+        $where = apply_filters( 'frm_forms_dropdown', $query, $field_name );
48 48
 		$forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] );
49 49
 		$add_html = array();
50 50
 		self::add_html_attr( $args['onchange'], 'onchange', $add_html );
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		<?php } ?>
58 58
 		<?php foreach ( $forms as $form ) { ?>
59 59
 			<option value="<?php echo esc_attr( $form->id ); ?>" <?php selected( $field_value, $form->id ); ?>><?php
60
-				echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 50 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ) ;
60
+				echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 50 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' );
61 61
 			?></option>
62 62
 		<?php } ?>
63 63
         </select>
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public static function add_html_attr( $class, $param, &$add_html ) {
75 75
 		if ( ! empty( $class ) ) {
76
-			$add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
76
+			$add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
77 77
 		}
78 78
 	}
79 79
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		$args = array( 'id' => 0, 'form' => 0 );
85 85
 		if ( isset( $_GET['id'] ) && ! isset( $_GET['form'] ) ) {
86 86
 			unset( $args['form'] );
87
-		} else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) {
87
+		} else if ( isset( $_GET['form'] ) && ! isset( $_GET['id'] ) ) {
88 88
 			unset( $args['id'] );
89 89
         }
90 90
 
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) {
93 93
             $args['frm_action'] = 'list';
94 94
             $args['form'] = 0;
95
-		} else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) {
95
+		} else if ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) {
96 96
             $args['frm_action'] = 'edit';
97 97
 		} else if ( isset( $_GET['post'] ) ) {
98 98
             $args['form'] = 0;
99
-            $base = admin_url('edit.php?post_type=frm_display');
99
+            $base = admin_url( 'edit.php?post_type=frm_display' );
100 100
         }
101 101
 
102 102
         ?>
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 			        $args['form'] = $form->id;
113 113
 				}
114 114
                 ?>
115
-				<li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li>
115
+				<li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li>
116 116
 			<?php
117 117
 				unset( $form );
118 118
 			} ?>
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
     }
123 123
 
124 124
 	public static function get_sortable_classes( $col, $sort_col, $sort_dir ) {
125
-        echo ($sort_col == $col) ? 'sorted' : 'sortable';
126
-        echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc';
125
+        echo ( $sort_col == $col ) ? 'sorted' : 'sortable';
126
+        echo ( $sort_col == $col && $sort_dir == 'desc' ) ? ' asc' : ' desc';
127 127
     }
128 128
 
129 129
 	/**
@@ -158,20 +158,20 @@  discard block
 block discarded – undo
158 158
             $post_values = $values;
159 159
         } else {
160 160
             $values = array();
161
-            $post_values = isset($_POST) ? $_POST : array();
161
+            $post_values = isset( $_POST ) ? $_POST : array();
162 162
         }
163 163
 
164 164
 		foreach ( array( 'name' => '', 'description' => '' ) as $var => $default ) {
165
-			if ( ! isset( $values[ $var ] ) ) {
166
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default );
165
+			if ( ! isset( $values[$var] ) ) {
166
+				$values[$var] = FrmAppHelper::get_param( $var, $default );
167 167
             }
168 168
         }
169 169
 
170
-        $values['description'] = FrmAppHelper::use_wpautop($values['description']);
170
+        $values['description'] = FrmAppHelper::use_wpautop( $values['description'] );
171 171
 
172 172
 		foreach ( array( 'form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0 ) as $var => $default ) {
173
-            if ( ! isset( $values[ $var ] ) ) {
174
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default );
173
+            if ( ! isset( $values[$var] ) ) {
174
+				$values[$var] = FrmAppHelper::get_param( $var, $default );
175 175
             }
176 176
         }
177 177
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		$values = self::fill_default_opts( $values, false, $post_values );
183 183
 		$values['custom_style'] = FrmAppHelper::custom_style_value( $post_values );
184 184
 
185
-        return apply_filters('frm_setup_new_form_vars', $values);
185
+        return apply_filters( 'frm_setup_new_form_vars', $values );
186 186
     }
187 187
 
188 188
     /**
@@ -193,42 +193,42 @@  discard block
 block discarded – undo
193 193
 			$post_values = stripslashes_deep( $_POST );
194 194
 		}
195 195
 
196
-        $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key;
197
-        $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template;
198
-        $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template;
196
+        $values['form_key'] = isset( $post_values['form_key'] ) ? $post_values['form_key'] : $record->form_key;
197
+        $values['default_template'] = isset( $post_values['default_template'] ) ? $post_values['default_template'] : $record->default_template;
198
+        $values['is_template'] = isset( $post_values['is_template'] ) ? $post_values['is_template'] : $record->is_template;
199 199
         $values['status'] = $record->status;
200 200
 
201
-        $values = self::fill_default_opts($values, $record, $post_values);
201
+        $values = self::fill_default_opts( $values, $record, $post_values );
202 202
 
203
-        return apply_filters('frm_setup_edit_form_vars', $values);
203
+        return apply_filters( 'frm_setup_edit_form_vars', $values );
204 204
     }
205 205
 
206 206
 	public static function fill_default_opts( $values, $record, $post_values ) {
207 207
 
208 208
         $defaults = self::get_default_opts();
209 209
 		foreach ( $defaults as $var => $default ) {
210
-            if ( is_array($default) ) {
211
-                if ( ! isset( $values[ $var ] ) ) {
212
-					$values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array();
210
+            if ( is_array( $default ) ) {
211
+                if ( ! isset( $values[$var] ) ) {
212
+					$values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array();
213 213
                 }
214 214
 
215 215
                 foreach ( $default as $k => $v ) {
216
-					$values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v);
216
+					$values[$var][$k] = ( $post_values && isset( $post_values[$var][$k] ) ) ? $post_values[$var][$k] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ) ? $record->options[$var][$k] : $v );
217 217
 
218 218
                     if ( is_array( $v ) ) {
219 219
                         foreach ( $v as $k1 => $v1 ) {
220
-							$values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 );
220
+							$values[$var][$k][$k1] = ( $post_values && isset( $post_values[$var][$k][$k1] ) ) ? $post_values[$var][$k][$k1] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ) ? $record->options[$var][$k][$k1] : $v1 );
221 221
                             unset( $k1, $v1 );
222 222
                         }
223 223
                     }
224 224
 
225
-                    unset($k, $v);
225
+                    unset( $k, $v );
226 226
                 }
227 227
             } else {
228
-				$values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default );
228
+				$values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default );
229 229
             }
230 230
 
231
-            unset($var, $default);
231
+            unset( $var, $default );
232 232
         }
233 233
 
234 234
         return $values;
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
             'submit_value' => $frm_settings->submit_value, 'success_action' => 'message',
242 242
             'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '',
243 243
             'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1,
244
-            'before_html' => self::get_default_html('before'),
244
+            'before_html' => self::get_default_html( 'before' ),
245 245
             'after_html' => '',
246
-            'submit_html' => self::get_default_html('submit'),
246
+            'submit_html' => self::get_default_html( 'submit' ),
247 247
         );
248 248
     }
249 249
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	public static function fill_form_options( &$options, $values ) {
256 256
 		$defaults = self::get_default_opts();
257 257
 		foreach ( $defaults as $var => $default ) {
258
-			$options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default;
258
+			$options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default;
259 259
 			unset( $var, $default );
260 260
 		}
261 261
 	}
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 		$last_field = false;
335 335
         foreach ( $fields as $field ) {
336 336
 			if ( $prev_order === $field->field_order ) {
337
-				$add_order++;
337
+				$add_order ++;
338 338
 			}
339 339
 
340 340
 			if ( $add_order ) {
@@ -401,21 +401,21 @@  discard block
 block discarded – undo
401 401
             if ( $code == 'form_name' ) {
402 402
                 $replace_with = $form->name;
403 403
             } else if ( $code == 'form_description' ) {
404
-                $replace_with = FrmAppHelper::use_wpautop($form->description);
405
-            } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) {
404
+                $replace_with = FrmAppHelper::use_wpautop( $form->description );
405
+            } else if ( $code == 'entry_key' && isset( $_GET ) && isset( $_GET['entry'] ) ) {
406 406
                 $replace_with = FrmAppHelper::simple_get( 'entry' );
407 407
             } else {
408 408
                 $replace_with = '';
409 409
             }
410 410
 
411
-            FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true($show) && $replace_with != '' ), $code, $replace_with, $html );
411
+            FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true( $show ) && $replace_with != '' ), $code, $replace_with, $html );
412 412
         }
413 413
 
414 414
         //replace [form_key]
415
-        $html = str_replace('[form_key]', $form->form_key, $html);
415
+        $html = str_replace( '[form_key]', $form->form_key, $html );
416 416
 
417 417
         //replace [frmurl]
418
-        $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html);
418
+        $html = str_replace( '[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html );
419 419
 
420 420
 		if ( strpos( $html, '[button_label]' ) ) {
421 421
 			add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 );
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 			$html = str_replace( '[button_label]', $submit_label, $html );
425 425
         }
426 426
 
427
-        $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values);
427
+        $html = apply_filters( 'frm_form_replace_shortcodes', $html, $form, $values );
428 428
 
429 429
 		if ( strpos( $html, '[if back_button]' ) ) {
430 430
 			$html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html );
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
     }
443 443
 
444 444
 	public static function submit_button_label( $submit ) {
445
-        if ( ! $submit || empty($submit) ) {
445
+        if ( ! $submit || empty( $submit ) ) {
446 446
             $frm_settings = FrmAppHelper::get_settings();
447 447
             $submit = $frm_settings->submit_value;
448 448
         }
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
 	}
466 466
 
467 467
 	public static function get_form_style_class( $form = false ) {
468
-        $style = self::get_form_style($form);
468
+        $style = self::get_form_style( $form );
469 469
         $class = ' with_frm_style';
470 470
 
471
-        if ( empty($style) ) {
472
-            if ( FrmAppHelper::is_admin_page('formidable-entries') ) {
471
+        if ( empty( $style ) ) {
472
+            if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) {
473 473
                 return $class;
474 474
             } else {
475 475
                 return;
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
         }
478 478
 
479 479
         //If submit button needs to be inline or centered
480
-        if ( is_object($form) ) {
480
+        if ( is_object( $form ) ) {
481 481
 			$form = $form->options;
482 482
 		}
483 483
 
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 			$class .= ' frm_center_submit';
490 490
 		}
491 491
 
492
-        $class = apply_filters('frm_add_form_style_class', $class, $style);
492
+        $class = apply_filters( 'frm_add_form_style_class', $class, $style );
493 493
 
494 494
         return $class;
495 495
     }
@@ -585,12 +585,12 @@  discard block
 block discarded – undo
585 585
     }
586 586
 
587 587
 	public static function edit_form_link( $form_id ) {
588
-        if ( is_object($form_id) ) {
588
+        if ( is_object( $form_id ) ) {
589 589
             $form = $form_id;
590 590
             $name = $form->name;
591 591
             $form_id = $form->id;
592 592
         } else {
593
-            $name = FrmForm::getName($form_id);
593
+            $name = FrmForm::getName( $form_id );
594 594
         }
595 595
 
596 596
         if ( $form_id ) {
@@ -622,12 +622,12 @@  discard block
 block discarded – undo
622 622
         $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
623 623
 		$base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id;
624 624
         if ( 'trash' == $status ) {
625
-			$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>';
626
-        } else if ( current_user_can('frm_delete_forms') ) {
625
+			$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][$length] . '</a>';
626
+        } else if ( current_user_can( 'frm_delete_forms' ) ) {
627 627
             if ( EMPTY_TRASH_DAYS ) {
628
-				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>';
628
+				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][$length] . '</a>';
629 629
             } else {
630
-				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>';
630
+				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][$length] . '</a>';
631 631
             }
632 632
         }
633 633
 
@@ -641,11 +641,11 @@  discard block
 block discarded – undo
641 641
             'publish'   => __( 'Published', 'formidable' ),
642 642
         );
643 643
 
644
-        if ( ! in_array($status, array_keys($nice_names)) ) {
644
+        if ( ! in_array( $status, array_keys( $nice_names ) ) ) {
645 645
             $status = 'publish';
646 646
         }
647 647
 
648
-		$name = $nice_names[ $status ];
648
+		$name = $nice_names[$status];
649 649
 
650 650
         return $name;
651 651
     }
Please login to merge, or discard this patch.
classes/views/frm-entries/form.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( empty($values) || ! isset($values['fields']) || empty($values['fields']) ) { ?>
3
-<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class($form); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container">
2
+if ( empty( $values ) || ! isset( $values['fields'] ) || empty( $values['fields'] ) ) { ?>
3
+<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class( $form ); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container">
4 4
 	<div class="frm_error_style"><strong><?php _e( 'Oops!', 'formidable' ) ?></strong> <?php printf( __( 'You did not add any fields to your form. %1$sGo back%2$s and add some.', 'formidable' ), '<a href="' . esc_url( admin_url( '?page=formidable&frm_action=edit&id=' . $form->id ) ) . '">', '</a>' ) ?>
5 5
     </div>
6 6
 </div>
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 <div class="frm_form_fields <?php echo esc_attr( apply_filters( 'frm_form_fields_class', '', $values ) ); ?>">
19 19
 <fieldset>
20 20
 <?php echo FrmFormsHelper::replace_shortcodes( $values['before_html'], $form, $title, $description ); ?>
21
-<?php do_action( 'frm_after_title', compact('form') ) ?>
22
-<input type="hidden" name="frm_action" value="<?php echo esc_attr($form_action) ?>" />
23
-<input type="hidden" name="form_id" value="<?php echo esc_attr($form->id) ?>" />
24
-<input type="hidden" name="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" id="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" value="<?php echo esc_attr($frm_hide_fields) ?>" />
25
-<input type="hidden" name="form_key" value="<?php echo esc_attr($form->form_key) ?>" />
21
+<?php do_action( 'frm_after_title', compact( 'form' ) ) ?>
22
+<input type="hidden" name="frm_action" value="<?php echo esc_attr( $form_action ) ?>" />
23
+<input type="hidden" name="form_id" value="<?php echo esc_attr( $form->id ) ?>" />
24
+<input type="hidden" name="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" id="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" value="<?php echo esc_attr( $frm_hide_fields ) ?>" />
25
+<input type="hidden" name="form_key" value="<?php echo esc_attr( $form->form_key ) ?>" />
26 26
 <input type="hidden" name="item_meta[0]" value="" />
27 27
 <?php wp_nonce_field( 'frm_submit_entry_nonce', 'frm_submit_entry_' . $form->id ); ?>
28 28
 <input type="text" class="frm_hidden" id="frm_verify" name="frm_verify" value="" <?php FrmFormsHelper::maybe_hide_inline() ?> />
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		} else {
37 37
 			do_action( 'frm_show_other_field_type', $field, $form, array( 'action' => $form_action ) );
38 38
 		}
39
-    	do_action('frm_get_field_scripts', $field, $form, $form->id);
39
+    	do_action( 'frm_get_field_scripts', $field, $form, $form->id );
40 40
 	}
41 41
 }
42 42
 
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 if ( FrmAppHelper::is_admin() ) { ?>
45 45
 <div class="frm_form_field form-field">
46 46
 <label class="frm_primary_label"><?php _e( 'Entry Key', 'formidable' ) ?></label>
47
-<input type="text" name="item_key" value="<?php echo esc_attr($values['item_key']) ?>" />
47
+<input type="text" name="item_key" value="<?php echo esc_attr( $values['item_key'] ) ?>" />
48 48
 </div>
49 49
 <?php } else { ?>
50
-<input type="hidden" name="item_key" value="<?php echo esc_attr($values['item_key']) ?>" />
50
+<input type="hidden" name="item_key" value="<?php echo esc_attr( $values['item_key'] ) ?>" />
51 51
 <?php }
52 52
 
53
-do_action('frm_entry_form', $form, $form_action, $errors);
53
+do_action( 'frm_entry_form', $form, $form_action, $errors );
54 54
 
55 55
 global $frm_vars;
56 56
 // close open section div
@@ -60,22 +60,22 @@  discard block
 block discarded – undo
60 60
 }
61 61
 
62 62
 // close open collapsible toggle div
63
-if ( isset($frm_vars['collapse_div']) && $frm_vars['collapse_div'] ) {
63
+if ( isset( $frm_vars['collapse_div'] ) && $frm_vars['collapse_div'] ) {
64 64
     echo "</div>\n";
65
-    unset($frm_vars['collapse_div']);
65
+    unset( $frm_vars['collapse_div'] );
66 66
 }
67 67
 
68
-echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form);
68
+echo FrmFormsHelper::replace_shortcodes( $values['after_html'], $form );
69 69
 
70 70
 if ( FrmForm::show_submit( $form ) ) {
71
-    unset($values['fields']);
72
-    FrmFormsHelper::get_custom_submit($values['submit_html'], $form, $submit, $form_action, $values);
71
+    unset( $values['fields'] );
72
+    FrmFormsHelper::get_custom_submit( $values['submit_html'], $form, $submit, $form_action, $values );
73 73
 }
74 74
 ?>
75 75
 </fieldset>
76 76
 </div>
77 77
 <?php
78
-if ( has_action('frm_entries_footer_scripts') ) {
78
+if ( has_action( 'frm_entries_footer_scripts' ) ) {
79 79
 ?><script type="text/javascript"><?php
80 80
 do_action( 'frm_entries_footer_scripts', $values['fields'], $form );
81 81
 ?></script><?php
Please login to merge, or discard this patch.