Completed
Branch 3.0 (991649)
by Stephanie
02:44
created
formidable.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 function load_formidable_forms() {
26 26
 	global $frm_vars;
27 27
 	$frm_vars = array(
28
-    	'load_css' => false, 'forms_loaded' => array(),
29
-    	'created_entries'   => array(),
30
-    	'pro_is_authorized' => false,
28
+		'load_css' => false, 'forms_loaded' => array(),
29
+		'created_entries'   => array(),
30
+		'pro_is_authorized' => false,
31 31
 	);
32 32
 
33 33
 	require_once( dirname( __FILE__ ) . '/classes/controllers/FrmHooksController.php' );
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
 
43 43
 // if __autoload is active, put it on the spl_autoload stack
44 44
 if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) {
45
-    spl_autoload_register('__autoload');
45
+	spl_autoload_register('__autoload');
46 46
 }
47 47
 
48 48
 // Add the autoloader
49 49
 spl_autoload_register('frm_forms_autoloader');
50 50
 
51 51
 function frm_forms_autoloader( $class_name ) {
52
-    // Only load Frm classes here
52
+	// Only load Frm classes here
53 53
 	if ( ! preg_match( '/^Frm.+$/', $class_name ) || preg_match( '/^FrmPro.+$/', $class_name ) ) {
54
-        return;
55
-    }
54
+		return;
55
+	}
56 56
 
57 57
 	FrmHooksController::autoloader( $class_name, dirname( __FILE__ ) );
58 58
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 
33 33
 	require_once( dirname( __FILE__ ) . '/classes/controllers/FrmHooksController.php' );
34 34
 
35
-	$frm_path = dirname(__FILE__);
36
-	if ( file_exists($frm_path . '/pro/formidable-pro.php') ) {
35
+	$frm_path = dirname( __FILE__ );
36
+	if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) {
37 37
 		include( $frm_path . '/pro/formidable-pro.php' );
38 38
 	}
39 39
 
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 
43 43
 // if __autoload is active, put it on the spl_autoload stack
44 44
 if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) {
45
-    spl_autoload_register('__autoload');
45
+    spl_autoload_register( '__autoload' );
46 46
 }
47 47
 
48 48
 // Add the autoloader
49
-spl_autoload_register('frm_forms_autoloader');
49
+spl_autoload_register( 'frm_forms_autoloader' );
50 50
 
51 51
 function frm_forms_autoloader( $class_name ) {
52 52
     // Only load Frm classes here
Please login to merge, or discard this patch.
classes/views/frm-fields/front-end/checkbox-field.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 				?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
38 38
 			}
39 39
 
40
-			?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php
40
+			?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action( 'frm_field_input_html', $field ) ?> /><?php
41 41
 
42 42
 			if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) {
43 43
 				echo ' ' . $opt . '</label>';
Please login to merge, or discard this patch.
classes/views/frm-fields/front-end/radio-field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
 			if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) {
19 19
 				?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
20 20
 			}
21
-			$checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
21
+			$checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' ';
22 22
 
23 23
 			$other_opt = false;
24 24
 			$other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
25 25
 			?>
26 26
 			<input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php
27 27
 			echo $checked;
28
-			do_action('frm_field_input_html', $field);
28
+			do_action( 'frm_field_input_html', $field );
29 29
 			?>/><?php
30 30
 
31 31
 			if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) {
Please login to merge, or discard this patch.
classes/views/frm-fields/back-end/field-multiple.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
4 4
 	do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
5 5
 } else {
6
-    do_action( 'frm_add_multiple_opts_labels', $field ); ?>
6
+	do_action( 'frm_add_multiple_opts_labels', $field ); ?>
7 7
     <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts frm_clear<?php echo ( count( $field['options'] ) > 10 ) ? ' frm_field_opts_list' : ''; ?>">
8 8
 		<?php FrmFieldsHelper::show_single_option( $field ); ?>
9 9
     </ul>
Please login to merge, or discard this patch.
classes/views/frm-fields/back-end/dropdown-field.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( isset($field['post_field']) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) {
3
+if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) {
4 4
 	echo FrmProPost::get_category_dropdown( $field, array( 'name' => $field_name, 'id' => 'placeholder_id', 'location' => 'form_builder' ) );
5 5
 } else { ?>
6 6
 	<select id="frm_dropdown_<?php echo esc_attr( $field['id'] ) ?>"
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 	<?php
28 28
 
29 29
 	if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) { ?>
30
-		<?php do_action('frm_add_multiple_opts_labels', $field); ?>
31
-		<ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts<?php echo ( count($field['options']) > 10 ) ? ' frm_field_opts_list' : ''; ?>">
32
-			<?php FrmFieldsHelper::show_single_option($field); ?>
30
+		<?php do_action( 'frm_add_multiple_opts_labels', $field ); ?>
31
+		<ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts<?php echo ( count( $field['options'] ) > 10 ) ? ' frm_field_opts_list' : ''; ?>">
32
+			<?php FrmFieldsHelper::show_single_option( $field ); ?>
33 33
 		</ul>
34 34
 		<?php
35 35
 	} ?>
Please login to merge, or discard this patch.
classes/views/frm-fields/back-end/field-captcha.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 $frm_settings = FrmAppHelper::get_settings();
3 3
 if ( empty( $frm_settings->pubkey ) ) { ?>
4
-    <div class="howto frm_no_captcha_text"><?php printf(__( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Secret Keys', 'formidable' ), '<a href="?page=formidable-settings">', '</a>') ?></div>
4
+    <div class="howto frm_no_captcha_text"><?php printf( __( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Secret Keys', 'formidable' ), '<a href="?page=formidable-settings">', '</a>' ) ?></div>
5 5
 <?php
6 6
 } ?>
7 7
 <img src="<?php echo esc_url( FrmAppHelper::plugin_url() . '/images/recaptcha.png' ) ?>" class="recaptcha_placeholder" alt="reCaptcha"/>
Please login to merge, or discard this patch.
classes/views/frm-forms/add_field.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! isset( $values['doing_ajax'] ) ) {
4
-    $li_classes .= ' ui-state-default widgets-holder-wrap'; ?>
4
+	$li_classes .= ' ui-state-default widgets-holder-wrap'; ?>
5 5
 <li id="frm_field_id_<?php echo esc_attr( $field['id'] ); ?>" class="<?php echo esc_attr( $li_classes ) ?>" data-fid="<?php echo esc_attr( $field['id'] ) ?>" data-formid="<?php echo esc_attr( 'divider' == $field['type'] ? $field['form_select'] : $field['form_id'] ); ?>" data-ftype="<?php echo esc_attr( $display['type'] ) ?>">
6 6
 <?php
7 7
 }
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     </span>
24 24
     <?php }
25 25
 
26
-    ?>
26
+	?>
27 27
     <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button': ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label>
28 28
 
29 29
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?>
72 72
     <div class="frm-show-click frm_small_top_margin"><?php
73 73
 
74
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
74
+	if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
75 75
 		echo '<p class="howto">' . FrmFieldsHelper::get_term_link( $field['taxonomy'] ) . '</p>';
76 76
 	} else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) {
77 77
 ?>
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 				<a href="javascript:void(0);" id="other_button_<?php echo esc_attr( $field['id'] ); ?>" data-opttype="other" data-ftype="<?php echo esc_attr( $field['type'] ) ?>" class="button frm_cb_button frm_add_opt<?php echo ( in_array( $field['type'], array( 'radio', 'select' ) ) && $field['other'] == true ? ' frm_hidden' : '' ); ?>"><?php _e( 'Add "Other"', 'formidable' ) ?></a>
84 84
                 <input type="hidden" value="<?php echo esc_attr( $field['other'] ); ?>" id="other_input_<?php echo esc_attr( $field['id'] ); ?>" name="field_options[other_<?php echo esc_attr( $field['id'] ); ?>]">
85 85
             <?php
86
-            }
86
+			}
87 87
 
88
-            if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?>
88
+			if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?>
89 89
 			<a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=frm_import_choices&field_id=' . $field['id'] . '&TB_iframe=1' ) ) ?>" title="<?php echo esc_attr( FrmAppHelper::truncate( strip_tags( str_replace( '"', '&quot;', $field['name'] ) ), 20 ) . ' ' . __( 'Field Choices', 'formidable' ) ); ?>" class="thickbox frm_orange">
90 90
 				<?php _e( 'Bulk Edit Options', 'formidable' ) ?>
91 91
 			</a>
92 92
             <?php } ?>
93 93
         </div>
94 94
 <?php
95
-    }
95
+	}
96 96
 ?>
97 97
     </div>
98 98
 <?php
@@ -127,31 +127,31 @@  discard block
 block discarded – undo
127 127
 						<?php _e( 'Required', 'formidable' ) ?>
128 128
 					</label>
129 129
                 <?php
130
-                }
130
+				}
131 131
 
132 132
 				if ( $display['unique'] ) {
133
-                    if ( ! isset( $field['unique'] ) ) {
134
-                        $field['unique'] = false;
135
-                    }
136
-                ?>
133
+					if ( ! isset( $field['unique'] ) ) {
134
+						$field['unique'] = false;
135
+					}
136
+				?>
137 137
                 <label for="frm_uniq_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Unique: Do not allow the same response multiple times. For example, if one user enters \'Joe\', then no one else will be allowed to enter the same name.', 'formidable' ) ?>"><input type="checkbox" name="field_options[unique_<?php echo esc_attr( $field['id'] ) ?>]" id="frm_uniq_field_<?php echo esc_attr( $field['id'] ) ?>" value="1" <?php checked( $field['unique'], 1 ); ?> class="frm_mark_unique" /> <?php _e( 'Unique', 'formidable' ) ?></label>
138 138
                 <?php
139
-                }
139
+				}
140 140
 
141 141
 				if ( $display['read_only'] ) {
142
-                    if ( ! isset( $field['read_only'] ) ) {
143
-                        $field['read_only'] = false;
142
+					if ( ! isset( $field['read_only'] ) ) {
143
+						$field['read_only'] = false;
144 144
 					}
145
-                ?>
145
+				?>
146 146
 				<label for="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Read Only: Show this field but do not allow the field value to be edited from the front-end.', 'formidable' ) ?>" >
147 147
 					<input type="checkbox" id="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" name="field_options[read_only_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php checked( $field['read_only'], 1 ) ?>/>
148 148
 					<?php _e( 'Read Only', 'formidable' ) ?>
149 149
 				</label>
150 150
                 <?php }
151 151
 
152
-                do_action('frm_field_options_form_top', $field, $display, $values);
152
+				do_action('frm_field_options_form_top', $field, $display, $values);
153 153
 
154
-                ?>
154
+				?>
155 155
                 <?php
156 156
 				if ( $display['required'] ) { ?>
157 157
                 <div class="frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>">
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 				do_action( 'frm_' . $field['type'] . '_field_options_form', $field, $display, $values );
256 256
 				do_action( 'frm_field_options_form', $field, $display, $values );
257 257
 
258
-                if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
258
+				if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
259 259
 					<tr class="frm_validation_msg <?php echo ($display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>">
260 260
 					<td colspan="2">
261 261
                     <div class="menu-settings">
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                             <input type="text" name="field_options[blank_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['blank'] ); ?>" />
269 269
                         </p>
270 270
                         <?php
271
-                        }
271
+						}
272 272
 
273 273
 						if ( $display['invalid'] ) { ?>
274 274
                             <p><label><?php _e( 'Invalid Format', 'formidable' ) ?></label>
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                             <input type="text" name="field_options[unique_msg_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['unique_msg'] ); ?>" />
284 284
                         </p>
285 285
                         <?php
286
-                        }
286
+						}
287 287
 
288 288
 						if ( $display['conf_field'] ) { ?>
289 289
                         <p class="frm_conf_details<?php echo esc_attr( $field['id'] . ( $field['conf_field'] ? '' : ' frm_hidden' ) ); ?>">
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
                             <input type="text" name="field_options[conf_msg_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_msg'] ); ?>" />
292 292
                         </p>
293 293
                         <?php
294
-                        } ?>
294
+						} ?>
295 295
                     </div>
296 296
                     </div>
297 297
                     </td>
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
     <a href="javascript:void(0);" class="frm_bstooltip alignright frm-show-hover frm-move frm-hover-icon frm_icon_font frm_move_icon" title="<?php esc_attr_e( 'Move Field', 'formidable' ) ?>"> </a>
16 16
     <a href="#" class="frm_bstooltip alignright frm-show-hover frm-hover-icon frm_icon_font frm_delete_icon frm_delete_field" title="<?php esc_attr_e( 'Delete Field', 'formidable' ) ?>"> </a>
17 17
     <a href="#" class="frm_bstooltip alignright frm-show-hover frm-hover-icon frm_icon_font frm_duplicate_icon" title="<?php ( $field['type'] == 'divider' ) ? esc_attr_e( 'Duplicate Section', 'formidable' ) : esc_attr_e( 'Duplicate Field', 'formidable' ) ?>"> </a>
18
-    <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr($field['id']) ?>" />
19
-    <?php do_action('frm_extra_field_actions', $field['id']); ?>
18
+    <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr( $field['id'] ) ?>" />
19
+    <?php do_action( 'frm_extra_field_actions', $field['id'] ); ?>
20 20
     <?php if ( $display['required'] ) { ?>
21 21
     <span id="require_field_<?php echo esc_attr( $field['id'] ); ?>">
22 22
 		<a href="javascript:void(0);" class="frm_req_field frm_action_icon frm_required_icon frm_icon_font alignleft frm_required<?php echo (int) $field['required'] ?>" id="req_field_<?php echo esc_attr( $field['id'] ); ?>" title="Click to Mark as <?php echo FrmField::is_required( $field ) ? 'not ' : ''; ?>Required"></a>
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     <?php }
25 25
 
26 26
     ?>
27
-    <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button': ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label>
27
+    <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button' : ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label>
28 28
 
29 29
 
30 30
 <div id="field_<?php echo esc_attr( $field['id'] ) ?>_inner_container" class="frm_inner_field_container">
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 </div>
44 44
 <?php
45 45
 if ( $display['description'] ) { ?>
46
-    <div class="frm_ipe_field_desc description <?php echo ($field['description'] == '') ? 'frm-show-click' : '' ?>" id="field_description_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ($field['description'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['description'] ); ?></div>
46
+    <div class="frm_ipe_field_desc description <?php echo ( $field['description'] == '' ) ? 'frm-show-click' : '' ?>" id="field_description_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['description'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['description'] ); ?></div>
47 47
     <input type="hidden" name="field_options[description_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['description'] ); ?>" />
48 48
 
49 49
 <?php } ?>
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 		<div class="frm_form_fields">
56 56
 			<input type="text" id="conf_field_<?php echo esc_attr( $field['field_key'] ) ?>" name="field_options[conf_input_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_input'] ); ?>" class="dyn_default_value" />
57 57
 		</div>
58
-    	<div id="conf_field_description_<?php echo esc_attr( $field['id'] ) ?>" class="frm_ipe_field_conf_desc description <?php echo ($field['conf_desc'] == '') ? 'frm-show-click' : '' ?>"><?php
59
-			echo ($field['conf_desc'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags($field['conf_desc']); ?></div>
58
+    	<div id="conf_field_description_<?php echo esc_attr( $field['id'] ) ?>" class="frm_ipe_field_conf_desc description <?php echo ( $field['conf_desc'] == '' ) ? 'frm-show-click' : '' ?>"><?php
59
+			echo ( $field['conf_desc'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['conf_desc'] ); ?></div>
60 60
     	<input type="hidden" name="field_options[conf_desc_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_desc'] ); ?>" />
61 61
 </div>
62 62
 	<?php if ( $display['clear_on_focus'] ) { ?>
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?>
72 72
     <div class="frm-show-click frm_small_top_margin"><?php
73 73
 
74
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
74
+    if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
75 75
 		echo '<p class="howto">' . FrmFieldsHelper::get_term_link( $field['taxonomy'] ) . '</p>';
76 76
 	} else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) {
77 77
 ?>
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             <?php
86 86
             }
87 87
 
88
-            if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?>
88
+            if ( ! isset( $field['post_field'] ) || $field['post_field'] != 'post_category' ) { ?>
89 89
 			<a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=frm_import_choices&field_id=' . $field['id'] . '&TB_iframe=1' ) ) ?>" title="<?php echo esc_attr( FrmAppHelper::truncate( strip_tags( str_replace( '"', '&quot;', $field['name'] ) ), 20 ) . ' ' . __( 'Field Choices', 'formidable' ) ); ?>" class="thickbox frm_orange">
90 90
 				<?php _e( 'Bulk Edit Options', 'formidable' ) ?>
91 91
 			</a>
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 <?php
99 99
 }
100 100
 
101
-do_action('frm_before_field_options', $field);
101
+do_action( 'frm_before_field_options', $field );
102 102
 
103 103
 if ( $display['options'] ) { ?>
104 104
     <div class="widget">
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
         </div>
109 109
     	<div class="widget-inside">
110 110
             <table class="form-table frm_clear_none">
111
-                <?php $field_types = FrmFieldsHelper::get_field_types($field['type']); ?>
111
+                <?php $field_types = FrmFieldsHelper::get_field_types( $field['type'] ); ?>
112 112
 				<tr><td class="frm_150_width"><label><?php _e( 'Field Type', 'formidable' ) ?></label></td>
113 113
                     <td>
114
-                <select <?php if ( count($field_types) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>>
114
+                <select <?php if ( count( $field_types ) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>>
115 115
                     <?php
116 116
 					foreach ( $field_types as $fkey => $ftype ) { ?>
117
-                        <option value="<?php echo esc_attr( $fkey ) ?>" <?php echo ( $fkey == $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists($fkey, $disabled_fields ) ? 'disabled="disabled"' : '';  ?>><?php echo is_array($ftype) ? $ftype['name'] : $ftype ?> </option>
117
+                        <option value="<?php echo esc_attr( $fkey ) ?>" <?php echo ( $fkey == $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists( $fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>><?php echo is_array( $ftype ) ? $ftype['name'] : $ftype ?> </option>
118 118
                     <?php
119 119
 						unset( $fkey, $ftype );
120 120
 					} ?>
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 				</label>
150 150
                 <?php }
151 151
 
152
-                do_action('frm_field_options_form_top', $field, $display, $values);
152
+                do_action( 'frm_field_options_form_top', $field, $display, $values );
153 153
 
154 154
                 ?>
155 155
                 <?php
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 						<td class="frm_150_width"><label><?php _e( 'Label Position', 'formidable' ) ?></label></td>
189 189
 						<td>
190 190
 							<select name="field_options[label_<?php echo esc_attr( $field['id'] ) ?>]">
191
-								<option value=""<?php selected($field['label'], ''); ?>>
191
+								<option value=""<?php selected( $field['label'], '' ); ?>>
192 192
 									<?php _e( 'Default', 'formidable' ) ?>
193 193
 								</option>
194 194
 								<?php foreach ( FrmStylesHelper::get_sigle_label_postitions() as $pos => $pos_label ) { ?>
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 				do_action( 'frm_field_options_form', $field, $display, $values );
257 257
 
258 258
                 if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
259
-					<tr class="frm_validation_msg <?php echo ($display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>">
259
+					<tr class="frm_validation_msg <?php echo ( $display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>">
260 260
 					<td colspan="2">
261 261
                     <div class="menu-settings">
262 262
                     <h3 class="frm_no_bg"><?php _e( 'Validation', 'formidable' ) ?></h3>
Please login to merge, or discard this patch.
classes/views/frm-forms/form.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1
-<?php wp_nonce_field('frm_save_form_nonce', 'frm_save_form'); ?>
1
+<?php wp_nonce_field( 'frm_save_form_nonce', 'frm_save_form' ); ?>
2 2
 <input type="hidden" name="status" value="<?php echo esc_attr( $values['status'] ); ?>" />
3 3
 <input type="hidden" name="new_status" value="" />
4 4
 
5 5
 <div id="frm_form_editor_container">
6 6
 <div id="titlediv">
7
-    <input type="text" name="name" value="<?php echo esc_attr($form->name); ?>" id="title" placeholder="<?php esc_attr_e( 'Enter title here') ?>" />
7
+    <input type="text" name="name" value="<?php echo esc_attr( $form->name ); ?>" id="title" placeholder="<?php esc_attr_e( 'Enter title here' ) ?>" />
8 8
     <div id="edit-slug-box" class="hide-if-no-js">
9 9
         <div id="frm_form_key_box" class="alignright">
10 10
         <strong><?php _e( 'Form Key:', 'formidable' ) ?></strong>
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 </div>
17 17
 
18 18
 <div class="postbox">
19
-    <div class="frm_no_fields <?php echo ( isset($values['fields']) && ! empty($values['fields']) ) ? 'frm_hidden' : ''; ?>">
19
+    <div class="frm_no_fields <?php echo ( isset( $values['fields'] ) && ! empty( $values['fields'] ) ) ? 'frm_hidden' : ''; ?>">
20 20
 	    <div class="alignleft sketch1">
21 21
 			<img src="<?php echo esc_url( FrmAppHelper::plugin_url() . '/images/sketch_arrow1.png' ); ?>" alt="" />
22 22
 	    </div>
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 if ( isset( $values['fields'] ) && ! empty( $values['fields'] ) ) {
54 54
 	$values['count'] = 0;
55 55
 	foreach ( $values['fields'] as $field ) {
56
-		$values['count']++;
56
+		$values['count'] ++;
57 57
 		FrmFieldsController::load_single_field( $field, $values );
58 58
 		unset( $field );
59 59
 	}
Please login to merge, or discard this patch.
classes/helpers/FrmEntriesHelper.php 2 patches
Indentation   +261 added lines, -261 removed lines patch added patch discarded remove patch
@@ -5,70 +5,70 @@  discard block
 block discarded – undo
5 5
 
6 6
 class FrmEntriesHelper {
7 7
 
8
-    public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9
-        $values = array();
8
+	public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9
+		$values = array();
10 10
 		foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) {
11 11
 			$values[ $var ] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' );
12
-        }
12
+		}
13 13
 
14
-        $values['fields'] = array();
15
-        if ( empty($fields) ) {
16
-            return apply_filters('frm_setup_new_entry', $values);
17
-        }
14
+		$values['fields'] = array();
15
+		if ( empty($fields) ) {
16
+			return apply_filters('frm_setup_new_entry', $values);
17
+		}
18 18
 
19
-        foreach ( (array) $fields as $field ) {
19
+		foreach ( (array) $fields as $field ) {
20 20
 			self::prepare_field_default_value( $field );
21
-            $new_value = self::get_field_value_for_new_entry( $field, $reset, $args );
22
-
23
-            $field_array = array(
24
-                'id' => $field->id,
25
-                'value' => $new_value,
26
-                'default_value' => $field->default_value,
27
-                'name' => $field->name,
28
-                'description' => $field->description,
29
-                'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
30
-                'options' => $field->options,
31
-                'required' => $field->required,
32
-                'field_key' => $field->field_key,
33
-                'field_order' => $field->field_order,
34
-                'form_id' => $field->form_id,
21
+			$new_value = self::get_field_value_for_new_entry( $field, $reset, $args );
22
+
23
+			$field_array = array(
24
+				'id' => $field->id,
25
+				'value' => $new_value,
26
+				'default_value' => $field->default_value,
27
+				'name' => $field->name,
28
+				'description' => $field->description,
29
+				'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
30
+				'options' => $field->options,
31
+				'required' => $field->required,
32
+				'field_key' => $field->field_key,
33
+				'field_order' => $field->field_order,
34
+				'form_id' => $field->form_id,
35 35
 				'parent_form_id' => isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id,
36
-	            'reset_value' => $reset,
36
+				'reset_value' => $reset,
37 37
 				'in_embed_form' => isset( $args['in_embed_form'] ) ? $args['in_embed_form'] : '0',
38
-            );
38
+			);
39 39
 
40 40
 			$opt_defaults = FrmFieldsHelper::get_default_field_options_from_field( $field );
41
-            $opt_defaults['required_indicator'] = '';
41
+			$opt_defaults['required_indicator'] = '';
42 42
 			$opt_defaults['original_type'] = $field->type;
43 43
 
44 44
 			foreach ( $opt_defaults as $opt => $default_opt ) {
45
-                $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
46
-                unset($opt, $default_opt);
47
-            }
45
+				$field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
46
+				unset($opt, $default_opt);
47
+			}
48 48
 
49
-            unset($opt_defaults);
49
+			unset($opt_defaults);
50 50
 
51
-            if ( $field_array['custom_html'] == '' ) {
52
-                $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
53
-            }
51
+			if ( $field_array['custom_html'] == '' ) {
52
+				$field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
53
+			}
54 54
 
55
-            $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args );
56
-            $field_array = array_merge( $field->field_options, $field_array );
55
+			$field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args );
56
+			$field_array = array_merge( $field->field_options, $field_array );
57 57
 
58
-            $values['fields'][] = $field_array;
58
+			$values['fields'][] = $field_array;
59 59
 
60
-            if ( ! $form || ! isset($form->id) ) {
61
-                $form = FrmForm::getOne($field->form_id);
62
-            }
63
-        }
60
+			if ( ! $form || ! isset($form->id) ) {
61
+				$form = FrmForm::getOne($field->form_id);
62
+			}
63
+		}
64 64
 
65
-        $form->options = maybe_unserialize($form->options);
66
-        if ( is_array($form->options) ) {
67
-            foreach ( $form->options as $opt => $value ) {
68
-                $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
69
-                unset($opt, $value);
70
-            }
71
-        }
65
+		$form->options = maybe_unserialize($form->options);
66
+		if ( is_array($form->options) ) {
67
+			foreach ( $form->options as $opt => $value ) {
68
+				$values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
69
+				unset($opt, $value);
70
+			}
71
+		}
72 72
 
73 73
 		$form_defaults = FrmFormsHelper::get_default_opts();
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		$values = array_merge( $form_defaults, $values );
79 79
 
80 80
 		return apply_filters( 'frm_setup_new_entry', $values );
81
-    }
81
+	}
82 82
 
83 83
 	/**
84 84
 	 * @since 2.05
@@ -93,16 +93,16 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 
95 95
 	/**
96
-	* Set the value for each field
97
-	* This function is used when the form is first loaded and on all page turns *for a new entry*
98
-	*
99
-	* @since 2.0.13
100
-	*
101
-	* @param object $field - this is passed by reference since it is an object
102
-	* @param boolean $reset
103
-	* @param array $args
104
-	* @return string|array $new_value
105
-	*/
96
+	 * Set the value for each field
97
+	 * This function is used when the form is first loaded and on all page turns *for a new entry*
98
+	 *
99
+	 * @since 2.0.13
100
+	 *
101
+	 * @param object $field - this is passed by reference since it is an object
102
+	 * @param boolean $reset
103
+	 * @param array $args
104
+	 * @return string|array $new_value
105
+	 */
106 106
 	private static function get_field_value_for_new_entry( $field, $reset, $args ) {
107 107
 		$new_value = $field->default_value;
108 108
 
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	/**
130
-	* Check if a field has a posted value
131
-	*
132
-	* @since 2.01.0
133
-	* @param object $field
134
-	* @param array $args
135
-	* @return boolean $value_is_posted
136
-	*/
130
+	 * Check if a field has a posted value
131
+	 *
132
+	 * @since 2.01.0
133
+	 * @param object $field
134
+	 * @param array $args
135
+	 * @return boolean $value_is_posted
136
+	 */
137 137
 	public static function value_is_posted( $field, $args ) {
138 138
 		$value_is_posted = false;
139 139
 		if ( $_POST ) {
@@ -151,130 +151,130 @@  discard block
 block discarded – undo
151 151
 
152 152
 	public static function setup_edit_vars( $values, $record ) {
153 153
 		$values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
154
-        $values['form_id'] = $record->form_id;
155
-        $values['is_draft'] = $record->is_draft;
156
-        return apply_filters('frm_setup_edit_entry_vars', $values, $record);
157
-    }
154
+		$values['form_id'] = $record->form_id;
155
+		$values['is_draft'] = $record->is_draft;
156
+		return apply_filters('frm_setup_edit_entry_vars', $values, $record);
157
+	}
158 158
 
159 159
 	public static function replace_default_message( $message, $atts ) {
160
-        if ( strpos($message, '[default-message') === false &&
161
-            strpos($message, '[default_message') === false &&
162
-            ! empty( $message ) ) {
163
-            return $message;
164
-        }
160
+		if ( strpos($message, '[default-message') === false &&
161
+			strpos($message, '[default_message') === false &&
162
+			! empty( $message ) ) {
163
+			return $message;
164
+		}
165 165
 
166
-        if ( empty($message) ) {
167
-            $message = '[default-message]';
168
-        }
166
+		if ( empty($message) ) {
167
+			$message = '[default-message]';
168
+		}
169 169
 
170
-        preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
170
+		preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
171 171
 
172
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
172
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
173 173
 			$add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
174 174
 			if ( ! empty( $add_atts ) ) {
175
-                $this_atts = array_merge($atts, $add_atts);
176
-            } else {
177
-                $this_atts = $atts;
178
-            }
175
+				$this_atts = array_merge($atts, $add_atts);
176
+			} else {
177
+				$this_atts = $atts;
178
+			}
179 179
 
180 180
 			$default = FrmEntriesController::show_entry_shortcode( $this_atts );
181 181
 
182
-            // Add the default message
183
-            $message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
184
-        }
182
+			// Add the default message
183
+			$message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
184
+		}
185 185
 
186
-        return $message;
187
-    }
186
+		return $message;
187
+	}
188 188
 
189 189
 	public static function prepare_display_value( $entry, $field, $atts ) {
190 190
 		$field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
191 191
 
192
-        if ( FrmAppHelper::pro_is_installed() ) {
192
+		if ( FrmAppHelper::pro_is_installed() ) {
193 193
 			FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
194
-        }
194
+		}
195 195
 
196
-        if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
197
-            return self::display_value($field_value, $field, $atts);
198
-        }
196
+		if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
197
+			return self::display_value($field_value, $field, $atts);
198
+		}
199 199
 
200
-        // this is an embeded form
201
-        $val = '';
200
+		// this is an embeded form
201
+		$val = '';
202 202
 
203
-	    if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
204
-            //this is a repeating section
203
+		if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
204
+			//this is a repeating section
205 205
 			$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
206
-        } else {
207
-            // get all values for this field
208
-	        $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
206
+		} else {
207
+			// get all values for this field
208
+			$child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
209 209
 
210
-            if ( $child_values ) {
211
-	            $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
212
-	        }
213
-	    }
210
+			if ( $child_values ) {
211
+				$child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
212
+			}
213
+		}
214 214
 
215
-	    $field_value = array();
215
+		$field_value = array();
216 216
 
217
-        if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
218
-            return $val;
219
-        }
217
+		if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
218
+			return $val;
219
+		}
220 220
 
221
-        foreach ( $child_entries as $child_entry ) {
222
-            $atts['item_id'] = $child_entry->id;
223
-            $atts['post_id'] = $child_entry->post_id;
221
+		foreach ( $child_entries as $child_entry ) {
222
+			$atts['item_id'] = $child_entry->id;
223
+			$atts['post_id'] = $child_entry->post_id;
224 224
 
225
-            // get the value for this field -- check for post values as well
226
-            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
225
+			// get the value for this field -- check for post values as well
226
+			$entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
227 227
 
228
-            if ( $entry_val ) {
229
-                // foreach entry get display_value
230
-                $field_value[] = self::display_value($entry_val, $field, $atts);
231
-            }
228
+			if ( $entry_val ) {
229
+				// foreach entry get display_value
230
+				$field_value[] = self::display_value($entry_val, $field, $atts);
231
+			}
232 232
 
233
-            unset($child_entry);
234
-        }
233
+			unset($child_entry);
234
+		}
235 235
 
236
-        $val = implode(', ', (array) $field_value );
236
+		$val = implode(', ', (array) $field_value );
237 237
 		$val = wp_kses_post( $val );
238 238
 
239
-        return $val;
240
-    }
239
+		return $val;
240
+	}
241 241
 
242
-    /**
243
-     * Prepare the saved value for display
244
-     * @return string
245
-     */
242
+	/**
243
+	 * Prepare the saved value for display
244
+	 * @return string
245
+	 */
246 246
 	public static function display_value( $value, $field, $atts = array() ) {
247 247
 
248
-        $defaults = array(
249
-            'type' => '', 'html' => false, 'show_filename' => true,
250
-            'truncate' => false, 'sep' => ', ', 'post_id' => 0,
251
-            'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0,
248
+		$defaults = array(
249
+			'type' => '', 'html' => false, 'show_filename' => true,
250
+			'truncate' => false, 'sep' => ', ', 'post_id' => 0,
251
+			'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0,
252 252
 			'return_array' => false,
253
-        );
253
+		);
254 254
 
255
-        $atts = wp_parse_args( $atts, $defaults );
256
-        $atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
255
+		$atts = wp_parse_args( $atts, $defaults );
256
+		$atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
257 257
 
258
-        if ( ! isset($field->field_options['post_field']) ) {
259
-            $field->field_options['post_field'] = '';
260
-        }
258
+		if ( ! isset($field->field_options['post_field']) ) {
259
+			$field->field_options['post_field'] = '';
260
+		}
261 261
 
262
-        if ( ! isset($field->field_options['custom_field']) ) {
263
-            $field->field_options['custom_field'] = '';
264
-        }
262
+		if ( ! isset($field->field_options['custom_field']) ) {
263
+			$field->field_options['custom_field'] = '';
264
+		}
265 265
 
266
-        if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
267
-            $atts['pre_truncate'] = $atts['truncate'];
268
-            $atts['truncate'] = true;
269
-            $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
266
+		if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
267
+			$atts['pre_truncate'] = $atts['truncate'];
268
+			$atts['truncate'] = true;
269
+			$atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
270 270
 
271
-            $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
272
-            $atts['truncate'] = $atts['pre_truncate'];
273
-        }
271
+			$value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
272
+			$atts['truncate'] = $atts['pre_truncate'];
273
+		}
274 274
 
275
-        if ( $value == '' ) {
276
-            return $value;
277
-        }
275
+		if ( $value == '' ) {
276
+			return $value;
277
+		}
278 278
 
279 279
 		$unfiltered_value = maybe_unserialize( $value );
280 280
 		$value = apply_filters('frm_display_value_custom', $unfiltered_value, $field, $atts);
@@ -284,130 +284,130 @@  discard block
 block discarded – undo
284 284
 			$value = FrmFieldsHelper::get_unfiltered_display_value( compact( 'value', 'field', 'atts' ) );
285 285
 		}
286 286
 
287
-        if ( $atts['truncate'] && $atts['type'] != 'image' ) {
288
-            $value = FrmAppHelper::truncate($value, 50);
289
-        }
287
+		if ( $atts['truncate'] && $atts['type'] != 'image' ) {
288
+			$value = FrmAppHelper::truncate($value, 50);
289
+		}
290 290
 
291 291
 		if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
292 292
 			$value = wp_kses_post( $value );
293 293
 		}
294 294
 
295 295
 		return apply_filters( 'frm_display_value', $value, $field, $atts );
296
-    }
296
+	}
297 297
 
298 298
 	public static function set_posted_value( $field, $value, $args ) {
299
-        // If validating a field with "other" opt, set back to prev value now
300
-        if ( isset( $args['other'] ) && $args['other'] ) {
301
-            $value = $args['temp_value'];
302
-        }
303
-        if ( empty($args['parent_field_id']) ) {
304
-            $_POST['item_meta'][ $field->id ] = $value;
305
-        } else {
306
-            $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
307
-        }
308
-    }
299
+		// If validating a field with "other" opt, set back to prev value now
300
+		if ( isset( $args['other'] ) && $args['other'] ) {
301
+			$value = $args['temp_value'];
302
+		}
303
+		if ( empty($args['parent_field_id']) ) {
304
+			$_POST['item_meta'][ $field->id ] = $value;
305
+		} else {
306
+			$_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
307
+		}
308
+	}
309 309
 
310 310
 	public static function get_posted_value( $field, &$value, $args ) {
311 311
 		$field_id = is_object( $field ) ? $field->id : $field;
312 312
 
313
-        if ( empty($args['parent_field_id']) ) {
314
-            $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
315
-        } else {
316
-            $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
317
-        }
313
+		if ( empty($args['parent_field_id']) ) {
314
+			$value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
315
+		} else {
316
+			$value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
317
+		}
318 318
 		FrmAppHelper::sanitize_value( 'wp_kses_post', $value );
319 319
 		$value = stripslashes_deep( $value );
320
-    }
321
-
322
-    /**
323
-    * Check if field has an "Other" option and if any other values are posted
324
-    *
325
-    * @since 2.0
326
-    *
327
-    * @param object $field
328
-    * @param string|array $value
329
-    * @param array $args
330
-    */
331
-    public static function maybe_set_other_validation( $field, &$value, &$args ) {
332
-        $args['other'] = false;
333
-        if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) {
334
-            return;
335
-        }
336
-
337
-        // Get other value for fields in repeating section
338
-        self::set_other_repeating_vals( $field, $value, $args );
339
-
340
-        // Check if there are any posted "Other" values
320
+	}
321
+
322
+	/**
323
+	 * Check if field has an "Other" option and if any other values are posted
324
+	 *
325
+	 * @since 2.0
326
+	 *
327
+	 * @param object $field
328
+	 * @param string|array $value
329
+	 * @param array $args
330
+	 */
331
+	public static function maybe_set_other_validation( $field, &$value, &$args ) {
332
+		$args['other'] = false;
333
+		if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) {
334
+			return;
335
+		}
336
+
337
+		// Get other value for fields in repeating section
338
+		self::set_other_repeating_vals( $field, $value, $args );
339
+
340
+		// Check if there are any posted "Other" values
341 341
 		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) {
342 342
 
343
-            // Save original value
344
-            $args['temp_value'] = $value;
345
-            $args['other'] = true;
346
-            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
347
-
348
-            // Set the validation value now
349
-            self::set_other_validation_val( $value, $other_vals, $field, $args );
350
-        }
351
-    }
352
-
353
-    /**
354
-    * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS
355
-    *
356
-    * @since 2.0
357
-    *
358
-    * @param object $field
359
-    * @param string|array $value
360
-    * @param array $args
361
-    */
362
-    public static function set_other_repeating_vals( $field, &$value, &$args ) {
363
-        if ( ! $args['parent_field_id'] ) {
364
-            return;
365
-        }
366
-
367
-        // Check if there are any other posted "other" values for this field
343
+			// Save original value
344
+			$args['temp_value'] = $value;
345
+			$args['other'] = true;
346
+			$other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
347
+
348
+			// Set the validation value now
349
+			self::set_other_validation_val( $value, $other_vals, $field, $args );
350
+		}
351
+	}
352
+
353
+	/**
354
+	 * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS
355
+	 *
356
+	 * @since 2.0
357
+	 *
358
+	 * @param object $field
359
+	 * @param string|array $value
360
+	 * @param array $args
361
+	 */
362
+	public static function set_other_repeating_vals( $field, &$value, &$args ) {
363
+		if ( ! $args['parent_field_id'] ) {
364
+			return;
365
+		}
366
+
367
+		// Check if there are any other posted "other" values for this field
368 368
 		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) {
369
-            // Save original value
370
-            $args['temp_value'] = $value;
371
-            $args['other'] = true;
372
-
373
-            $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
374
-
375
-            // Set the validation value now
376
-            self::set_other_validation_val( $value, $other_vals, $field, $args );
377
-        }
378
-    }
379
-
380
-    /**
381
-    * Modify value used for validation
382
-    * This function essentially removes the "Other" radio or checkbox value from the $value being validated.
383
-    * It also adds any text from the free text fields to the value
384
-    *
385
-    * Needs to accommodate for times when other opt is selected, but no other free text is entered
386
-    *
387
-    * @since 2.0
388
-    *
389
-    * @param string|array $value
390
-    * @param string|array $other_vals (usually of posted values)
391
-    * @param object $field
392
-    * @param array $args
393
-    */
394
-    public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) {
395
-        // Checkboxes and multi-select dropdowns
396
-        if ( is_array( $value ) && $field->type == 'checkbox' ) {
397
-            // Combine "Other" values with checked values. "Other" values will override checked box values.
398
-            $value = array_merge( $value, $other_vals );
399
-            $value = array_filter( $value );
400
-            if ( count( $value ) == 0 ) {
401
-                $value = '';
402
-            }
403
-        } else {
369
+			// Save original value
370
+			$args['temp_value'] = $value;
371
+			$args['other'] = true;
372
+
373
+			$other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
374
+
375
+			// Set the validation value now
376
+			self::set_other_validation_val( $value, $other_vals, $field, $args );
377
+		}
378
+	}
379
+
380
+	/**
381
+	 * Modify value used for validation
382
+	 * This function essentially removes the "Other" radio or checkbox value from the $value being validated.
383
+	 * It also adds any text from the free text fields to the value
384
+	 *
385
+	 * Needs to accommodate for times when other opt is selected, but no other free text is entered
386
+	 *
387
+	 * @since 2.0
388
+	 *
389
+	 * @param string|array $value
390
+	 * @param string|array $other_vals (usually of posted values)
391
+	 * @param object $field
392
+	 * @param array $args
393
+	 */
394
+	public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) {
395
+		// Checkboxes and multi-select dropdowns
396
+		if ( is_array( $value ) && $field->type == 'checkbox' ) {
397
+			// Combine "Other" values with checked values. "Other" values will override checked box values.
398
+			$value = array_merge( $value, $other_vals );
399
+			$value = array_filter( $value );
400
+			if ( count( $value ) == 0 ) {
401
+				$value = '';
402
+			}
403
+		} else {
404 404
 			// Radio and dropdowns
405
-            $other_key = array_filter( array_keys($field->options), 'is_string');
406
-            $other_key = reset( $other_key );
405
+			$other_key = array_filter( array_keys($field->options), 'is_string');
406
+			$other_key = reset( $other_key );
407 407
 
408
-            // Multi-select dropdown
409
-            if ( is_array( $value ) ) {
410
-                $o_key = array_search( $field->options[ $other_key ], $value );
408
+			// Multi-select dropdown
409
+			if ( is_array( $value ) ) {
410
+				$o_key = array_search( $field->options[ $other_key ], $value );
411 411
 
412 412
 				if ( $o_key !== false ) {
413 413
 					// Modify the original value so other key will be preserved
@@ -422,15 +422,15 @@  discard block
 block discarded – undo
422 422
 					$args['temp_value'] = $value;
423 423
 					$value[ $other_key ] = reset( $other_vals );
424 424
 				}
425
-            } else if ( $field->options[ $other_key ] == $value ) {
426
-                $value = $other_vals;
427
-            }
428
-        }
429
-    }
425
+			} else if ( $field->options[ $other_key ] == $value ) {
426
+				$value = $other_vals;
427
+			}
428
+		}
429
+	}
430 430
 
431
-    // Add submitted values to a string for spam checking
431
+	// Add submitted values to a string for spam checking
432 432
 	public static function entry_array_to_string( $values ) {
433
-        $content = '';
433
+		$content = '';
434 434
 		foreach ( $values['item_meta'] as $val ) {
435 435
 			if ( $content != '' ) {
436 436
 				$content .= "\n\n";
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		}
446 446
 
447 447
 		return $content;
448
-    }
448
+	}
449 449
 
450 450
 	/**
451 451
 	 * Get the browser from the user agent
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 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
 
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
     public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9 9
         $values = array();
10 10
 		foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) {
11
-			$values[ $var ] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' );
11
+			$values[$var] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' );
12 12
         }
13 13
 
14 14
         $values['fields'] = array();
15
-        if ( empty($fields) ) {
16
-            return apply_filters('frm_setup_new_entry', $values);
15
+        if ( empty( $fields ) ) {
16
+            return apply_filters( 'frm_setup_new_entry', $values );
17 17
         }
18 18
 
19 19
         foreach ( (array) $fields as $field ) {
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
                 'default_value' => $field->default_value,
27 27
                 'name' => $field->name,
28 28
                 'description' => $field->description,
29
-                'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
29
+                'type' => apply_filters( 'frm_field_type', $field->type, $field, $new_value ),
30 30
                 'options' => $field->options,
31 31
                 'required' => $field->required,
32 32
                 'field_key' => $field->field_key,
@@ -42,38 +42,38 @@  discard block
 block discarded – undo
42 42
 			$opt_defaults['original_type'] = $field->type;
43 43
 
44 44
 			foreach ( $opt_defaults as $opt => $default_opt ) {
45
-                $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
46
-                unset($opt, $default_opt);
45
+                $field_array[$opt] = ( isset( $field->field_options[$opt] ) && $field->field_options[$opt] != '' ) ? $field->field_options[$opt] : $default_opt;
46
+                unset( $opt, $default_opt );
47 47
             }
48 48
 
49
-            unset($opt_defaults);
49
+            unset( $opt_defaults );
50 50
 
51 51
             if ( $field_array['custom_html'] == '' ) {
52
-                $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
52
+                $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $field->type );
53 53
             }
54 54
 
55
-            $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args );
55
+            $field_array = apply_filters( 'frm_setup_new_fields_vars', $field_array, $field, $args );
56 56
             $field_array = array_merge( $field->field_options, $field_array );
57 57
 
58 58
             $values['fields'][] = $field_array;
59 59
 
60
-            if ( ! $form || ! isset($form->id) ) {
61
-                $form = FrmForm::getOne($field->form_id);
60
+            if ( ! $form || ! isset( $form->id ) ) {
61
+                $form = FrmForm::getOne( $field->form_id );
62 62
             }
63 63
         }
64 64
 
65
-        $form->options = maybe_unserialize($form->options);
66
-        if ( is_array($form->options) ) {
65
+        $form->options = maybe_unserialize( $form->options );
66
+        if ( is_array( $form->options ) ) {
67 67
             foreach ( $form->options as $opt => $value ) {
68
-                $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
69
-                unset($opt, $value);
68
+                $values[$opt] = FrmAppHelper::get_post_param( $opt, $value );
69
+                unset( $opt, $value );
70 70
             }
71 71
         }
72 72
 
73 73
 		$form_defaults = FrmFormsHelper::get_default_opts();
74 74
 
75 75
 		$frm_settings = FrmAppHelper::get_settings();
76
-		$form_defaults['custom_style']  = ( $frm_settings->load_style != 'none' );
76
+		$form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' );
77 77
 
78 78
 		$values = array_merge( $form_defaults, $values );
79 79
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		}
121 121
 
122 122
 		if ( ! is_array( $new_value ) ) {
123
-			$new_value = str_replace('"', '&quot;', $new_value);
123
+			$new_value = str_replace( '"', '&quot;', $new_value );
124 124
 		}
125 125
 
126 126
 		return $new_value;
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 		if ( $_POST ) {
140 140
 			$repeating = isset( $args['repeating'] ) && $args['repeating'];
141 141
 			if ( $repeating ) {
142
-				if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) {
142
+				if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) {
143 143
 					$value_is_posted = true;
144 144
 				}
145
-			} else if ( isset( $_POST['item_meta'][ $field->id ] ) ) {
145
+			} else if ( isset( $_POST['item_meta'][$field->id] ) ) {
146 146
 				$value_is_posted = true;
147 147
 			}
148 148
 		}
@@ -153,26 +153,26 @@  discard block
 block discarded – undo
153 153
 		$values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
154 154
         $values['form_id'] = $record->form_id;
155 155
         $values['is_draft'] = $record->is_draft;
156
-        return apply_filters('frm_setup_edit_entry_vars', $values, $record);
156
+        return apply_filters( 'frm_setup_edit_entry_vars', $values, $record );
157 157
     }
158 158
 
159 159
 	public static function replace_default_message( $message, $atts ) {
160
-        if ( strpos($message, '[default-message') === false &&
161
-            strpos($message, '[default_message') === false &&
160
+        if ( strpos( $message, '[default-message' ) === false &&
161
+            strpos( $message, '[default_message' ) === false &&
162 162
             ! empty( $message ) ) {
163 163
             return $message;
164 164
         }
165 165
 
166
-        if ( empty($message) ) {
166
+        if ( empty( $message ) ) {
167 167
             $message = '[default-message]';
168 168
         }
169 169
 
170
-        preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
170
+        preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER );
171 171
 
172 172
         foreach ( $shortcodes[0] as $short_key => $tag ) {
173
-			$add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
173
+			$add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
174 174
 			if ( ! empty( $add_atts ) ) {
175
-                $this_atts = array_merge($atts, $add_atts);
175
+                $this_atts = array_merge( $atts, $add_atts );
176 176
             } else {
177 177
                 $this_atts = $atts;
178 178
             }
@@ -180,32 +180,32 @@  discard block
 block discarded – undo
180 180
 			$default = FrmEntriesController::show_entry_shortcode( $this_atts );
181 181
 
182 182
             // Add the default message
183
-            $message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
183
+            $message = str_replace( $shortcodes[0][$short_key], $default, $message );
184 184
         }
185 185
 
186 186
         return $message;
187 187
     }
188 188
 
189 189
 	public static function prepare_display_value( $entry, $field, $atts ) {
190
-		$field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
190
+		$field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false;
191 191
 
192 192
         if ( FrmAppHelper::pro_is_installed() ) {
193 193
 			FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
194 194
         }
195 195
 
196
-        if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
197
-            return self::display_value($field_value, $field, $atts);
196
+        if ( $field->form_id == $entry->form_id || empty( $atts['embedded_field_id'] ) ) {
197
+            return self::display_value( $field_value, $field, $atts );
198 198
         }
199 199
 
200 200
         // this is an embeded form
201 201
         $val = '';
202 202
 
203
-	    if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
203
+	    if ( strpos( $atts['embedded_field_id'], 'form' ) === 0 ) {
204 204
             //this is a repeating section
205 205
 			$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
206 206
         } else {
207 207
             // get all values for this field
208
-	        $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
208
+	        $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false;
209 209
 
210 210
             if ( $child_values ) {
211 211
 	            $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
 	    $field_value = array();
216 216
 
217
-        if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
217
+        if ( ! isset( $child_entries ) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
218 218
             return $val;
219 219
         }
220 220
 
@@ -223,17 +223,17 @@  discard block
 block discarded – undo
223 223
             $atts['post_id'] = $child_entry->post_id;
224 224
 
225 225
             // get the value for this field -- check for post values as well
226
-            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
226
+            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value( $child_entry, $field );
227 227
 
228 228
             if ( $entry_val ) {
229 229
                 // foreach entry get display_value
230
-                $field_value[] = self::display_value($entry_val, $field, $atts);
230
+                $field_value[] = self::display_value( $entry_val, $field, $atts );
231 231
             }
232 232
 
233
-            unset($child_entry);
233
+            unset( $child_entry );
234 234
         }
235 235
 
236
-        $val = implode(', ', (array) $field_value );
236
+        $val = implode( ', ', (array) $field_value );
237 237
 		$val = wp_kses_post( $val );
238 238
 
239 239
         return $val;
@@ -253,22 +253,22 @@  discard block
 block discarded – undo
253 253
         );
254 254
 
255 255
         $atts = wp_parse_args( $atts, $defaults );
256
-        $atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
256
+        $atts = apply_filters( 'frm_display_value_atts', $atts, $field, $value );
257 257
 
258
-        if ( ! isset($field->field_options['post_field']) ) {
258
+        if ( ! isset( $field->field_options['post_field'] ) ) {
259 259
             $field->field_options['post_field'] = '';
260 260
         }
261 261
 
262
-        if ( ! isset($field->field_options['custom_field']) ) {
262
+        if ( ! isset( $field->field_options['custom_field'] ) ) {
263 263
             $field->field_options['custom_field'] = '';
264 264
         }
265 265
 
266 266
         if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
267 267
             $atts['pre_truncate'] = $atts['truncate'];
268 268
             $atts['truncate'] = true;
269
-            $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
269
+            $atts['exclude_cat'] = isset( $field->field_options['exclude_cat'] ) ? $field->field_options['exclude_cat'] : 0;
270 270
 
271
-            $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
271
+            $value = FrmProEntryMetaHelper::get_post_value( $atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts );
272 272
             $atts['truncate'] = $atts['pre_truncate'];
273 273
         }
274 274
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         }
278 278
 
279 279
 		$unfiltered_value = maybe_unserialize( $value );
280
-		$value = apply_filters('frm_display_value_custom', $unfiltered_value, $field, $atts);
280
+		$value = apply_filters( 'frm_display_value_custom', $unfiltered_value, $field, $atts );
281 281
 		$value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) );
282 282
 
283 283
 		if ( $value == $unfiltered_value ) {
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 		}
286 286
 
287 287
         if ( $atts['truncate'] && $atts['type'] != 'image' ) {
288
-            $value = FrmAppHelper::truncate($value, 50);
288
+            $value = FrmAppHelper::truncate( $value, 50 );
289 289
         }
290 290
 
291 291
 		if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
@@ -300,20 +300,20 @@  discard block
 block discarded – undo
300 300
         if ( isset( $args['other'] ) && $args['other'] ) {
301 301
             $value = $args['temp_value'];
302 302
         }
303
-        if ( empty($args['parent_field_id']) ) {
304
-            $_POST['item_meta'][ $field->id ] = $value;
303
+        if ( empty( $args['parent_field_id'] ) ) {
304
+            $_POST['item_meta'][$field->id] = $value;
305 305
         } else {
306
-            $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
306
+            $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value;
307 307
         }
308 308
     }
309 309
 
310 310
 	public static function get_posted_value( $field, &$value, $args ) {
311 311
 		$field_id = is_object( $field ) ? $field->id : $field;
312 312
 
313
-        if ( empty($args['parent_field_id']) ) {
314
-            $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
313
+        if ( empty( $args['parent_field_id'] ) ) {
314
+            $value = isset( $_POST['item_meta'][$field_id] ) ? $_POST['item_meta'][$field_id] : '';
315 315
         } else {
316
-            $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
316
+            $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] : '';
317 317
         }
318 318
 		FrmAppHelper::sanitize_value( 'wp_kses_post', $value );
319 319
 		$value = stripslashes_deep( $value );
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
         self::set_other_repeating_vals( $field, $value, $args );
339 339
 
340 340
         // Check if there are any posted "Other" values
341
-		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) {
341
+		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) {
342 342
 
343 343
             // Save original value
344 344
             $args['temp_value'] = $value;
345 345
             $args['other'] = true;
346
-            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
346
+            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][$field->id] );
347 347
 
348 348
             // Set the validation value now
349 349
             self::set_other_validation_val( $value, $other_vals, $field, $args );
@@ -365,12 +365,12 @@  discard block
 block discarded – undo
365 365
         }
366 366
 
367 367
         // Check if there are any other posted "other" values for this field
368
-		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) {
368
+		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) {
369 369
             // Save original value
370 370
             $args['temp_value'] = $value;
371 371
             $args['other'] = true;
372 372
 
373
-            $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
373
+            $other_vals = $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id];
374 374
 
375 375
             // Set the validation value now
376 376
             self::set_other_validation_val( $value, $other_vals, $field, $args );
@@ -402,27 +402,27 @@  discard block
 block discarded – undo
402 402
             }
403 403
         } else {
404 404
 			// Radio and dropdowns
405
-            $other_key = array_filter( array_keys($field->options), 'is_string');
405
+            $other_key = array_filter( array_keys( $field->options ), 'is_string' );
406 406
             $other_key = reset( $other_key );
407 407
 
408 408
             // Multi-select dropdown
409 409
             if ( is_array( $value ) ) {
410
-                $o_key = array_search( $field->options[ $other_key ], $value );
410
+                $o_key = array_search( $field->options[$other_key], $value );
411 411
 
412 412
 				if ( $o_key !== false ) {
413 413
 					// Modify the original value so other key will be preserved
414
-					$value[ $other_key ] = $value[ $o_key ];
414
+					$value[$other_key] = $value[$o_key];
415 415
 
416 416
 					// By default, the array keys will be numeric for multi-select dropdowns
417 417
 					// If going backwards and forwards between pages, the array key will match the other key
418 418
 					if ( $o_key != $other_key ) {
419
-						unset( $value[ $o_key ] );
419
+						unset( $value[$o_key] );
420 420
 					}
421 421
 
422 422
 					$args['temp_value'] = $value;
423
-					$value[ $other_key ] = reset( $other_vals );
423
+					$value[$other_key] = reset( $other_vals );
424 424
 				}
425
-            } else if ( $field->options[ $other_key ] == $value ) {
425
+            } else if ( $field->options[$other_key] == $value ) {
426 426
                 $value = $other_vals;
427 427
             }
428 428
         }
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 				$content .= "\n\n";
437 437
 			}
438 438
 
439
-			if ( is_array($val) ) {
439
+			if ( is_array( $val ) ) {
440 440
 				$val = FrmAppHelper::array_flatten( $val );
441 441
 				$val = implode( ', ', $val );
442 442
 			}
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 		preg_match_all( $pattern, $u_agent, $matches ); // get the matching numbers
501 501
 
502 502
 		// see how many we have
503
-		$i = count($matches['browser']);
503
+		$i = count( $matches['browser'] );
504 504
 
505 505
 		if ( $i > 1 ) {
506 506
 			//we will have two since we are not using 'other' argument yet
Please login to merge, or discard this patch.