Completed
Push — master ( aa3cec...1326c1 )
by Jamie
03:04
created
classes/views/frm-forms/add_field.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $display = apply_filters('frm_display_field_options', array(
4
-    'type' => $field['type'], 'field_data' => $field,
5
-    'required' => true, 'unique' => false, 'read_only' => false,
6
-    'description' => true, 'options' => true, 'label_position' => true,
7
-    'invalid' => false, 'size' => false, 'clear_on_focus' => false,
8
-    'default_blank' => true, 'css' => true, 'conf_field' => false,
4
+	'type' => $field['type'], 'field_data' => $field,
5
+	'required' => true, 'unique' => false, 'read_only' => false,
6
+	'description' => true, 'options' => true, 'label_position' => true,
7
+	'invalid' => false, 'size' => false, 'clear_on_focus' => false,
8
+	'default_blank' => true, 'css' => true, 'conf_field' => false,
9 9
 	'max' => true, 'captcha_size' => false,
10 10
 ));
11 11
 
@@ -25,19 +25,19 @@  discard block
 block discarded – undo
25 25
 $frm_settings = FrmAppHelper::get_settings();
26 26
 
27 27
 if ( ! isset( $frm_all_field_selection ) ) {
28
-    if ( isset($frm_field_selection) && isset($pro_field_selection) ) {
29
-        $frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection);
30
-    } else {
28
+	if ( isset($frm_field_selection) && isset($pro_field_selection) ) {
29
+		$frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection);
30
+	} else {
31 31
 		$pro_field_selection = FrmField::pro_field_selection();
32 32
 		$frm_all_field_selection = array_merge( FrmField::field_selection(), $pro_field_selection );
33
-    }
33
+	}
34 34
 }
35 35
 
36 36
 $disabled_fields = FrmAppHelper::pro_is_installed() ? array() : $pro_field_selection;
37 37
 
38 38
 
39 39
 if ( ! isset( $ajax ) ) {
40
-    $li_classes .= ' ui-state-default widgets-holder-wrap'; ?>
40
+	$li_classes .= ' ui-state-default widgets-holder-wrap'; ?>
41 41
 <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 ( 'divider' == $field['type'] ) ? esc_attr( $field['form_select'] ) : esc_attr( $field['form_id'] ); ?>">
42 42
 <?php
43 43
 }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     </span>
60 60
     <?php }
61 61
 
62
-    ?>
62
+	?>
63 63
     <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>
64 64
 
65 65
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?>
106 106
     <div class="frm-show-click frm_small_top_margin"><?php
107 107
 
108
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
108
+	if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
109 109
 		echo '<p class="howto">' . FrmFieldsHelper::get_term_link( $field['taxonomy'] ) . '</p>';
110 110
 	} else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) {
111 111
 ?>
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 				<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>
118 118
                 <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'] ); ?>]">
119 119
             <?php
120
-            }
120
+			}
121 121
 
122
-            if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?>
122
+			if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?>
123 123
 			<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">
124 124
 				<?php _e( 'Bulk Edit Options', 'formidable' ) ?>
125 125
 			</a>
126 126
             <?php } ?>
127 127
         </div>
128 128
 <?php
129
-    }
129
+	}
130 130
 ?>
131 131
     </div>
132 132
 <?php
@@ -158,28 +158,28 @@  discard block
 block discarded – undo
158 158
 				if ( $display['required'] ) { ?>
159 159
                     <label for="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label"><input type="checkbox" id="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_req_field" name="field_options[required_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['required'] ? 'checked="checked"': ''; ?> /> <?php _e( 'Required', 'formidable' ) ?></label>
160 160
                 <?php
161
-                }
161
+				}
162 162
 
163 163
 				if ( $display['unique'] ) {
164
-                    if ( ! isset( $field['unique'] ) ) {
165
-                        $field['unique'] = false;
166
-                    }
167
-                ?>
164
+					if ( ! isset( $field['unique'] ) ) {
165
+						$field['unique'] = false;
166
+					}
167
+				?>
168 168
                 <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>
169 169
                 <?php
170
-                }
170
+				}
171 171
 
172 172
 				if ( $display['read_only'] ) {
173
-                    if ( ! isset( $field['read_only'] ) ) {
174
-                        $field['read_only'] = false;
173
+					if ( ! isset( $field['read_only'] ) ) {
174
+						$field['read_only'] = false;
175 175
 					}
176
-                ?>
176
+				?>
177 177
                 <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' ) ?>" ><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 echo $field['read_only'] ? ' checked="checked"' : ''; ?>/> <?php _e( 'Read Only', 'formidable' ) ?></label>
178 178
                 <?php }
179 179
 
180
-                do_action('frm_field_options_form_top', $field, $display, $values);
180
+				do_action('frm_field_options_form_top', $field, $display, $values);
181 181
 
182
-                ?>
182
+				?>
183 183
                 <?php
184 184
 				if ( $display['required'] ) { ?>
185 185
                 <div class="frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>">
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 				do_action( 'frm_' . $field['type'] . '_field_options_form', $field, $display, $values );
266 266
 				do_action( 'frm_field_options_form', $field, $display, $values );
267 267
 
268
-                if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
268
+				if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
269 269
 					<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'; ?>">
270 270
 					<td colspan="2">
271 271
                     <div class="menu-settings">
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
                             <input type="text" name="field_options[blank_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['blank'] ); ?>" />
279 279
                         </p>
280 280
                         <?php
281
-                        }
281
+						}
282 282
 
283 283
 						if ( $display['invalid'] ) { ?>
284 284
                             <p><label><?php _e( 'Invalid Format', 'formidable' ) ?></label>
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
                             <input type="text" name="field_options[unique_msg_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['unique_msg'] ); ?>" />
294 294
                         </p>
295 295
                         <?php
296
-                        }
296
+						}
297 297
 
298 298
 						if ( $display['conf_field'] ) { ?>
299 299
                         <p class="frm_conf_details<?php echo esc_attr( $field['id'] . ( $field['conf_field'] ? '' : ' frm_hidden' ) ); ?>">
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                             <input type="text" name="field_options[conf_msg_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_msg'] ); ?>" />
302 302
                         </p>
303 303
                         <?php
304
-                        } ?>
304
+						} ?>
305 305
                     </div>
306 306
                     </div>
307 307
                     </td>
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-$display = apply_filters('frm_display_field_options', array(
3
+$display = apply_filters( 'frm_display_field_options', array(
4 4
     'type' => $field['type'], 'field_data' => $field,
5 5
     'required' => true, 'unique' => false, 'read_only' => false,
6 6
     'description' => true, 'options' => true, 'label_position' => true,
7 7
     'invalid' => false, 'size' => false, 'clear_on_focus' => false,
8 8
     'default_blank' => true, 'css' => true, 'conf_field' => false,
9 9
 	'max' => true, 'captcha_size' => false,
10
-));
10
+) );
11 11
 
12 12
 $li_classes = 'form-field edit_form_item frm_field_box frm_top_container frm_not_divider edit_field_type_' . $display['type'];
13
-$li_classes = apply_filters('frm_build_field_class', $li_classes, $field );
13
+$li_classes = apply_filters( 'frm_build_field_class', $li_classes, $field );
14 14
 
15 15
 if ( isset( $values ) && isset( $values['ajax_load'] ) && $values['ajax_load'] && isset( $count ) && $count > 10 && ! in_array( $field['type'], array( 'divider', 'end_divider' ) ) ) {
16 16
 ?>
17 17
 <li id="frm_field_id_<?php echo esc_attr( $field['id'] ); ?>" class="<?php echo esc_attr( $li_classes ) ?> frm_field_loading" 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'] ) ?>">
18 18
 <img src="<?php echo FrmAppHelper::plugin_url() ?>/images/ajax_loader.gif" alt="<?php esc_attr_e( 'Loading', 'formidable' ) ?>" />
19
-<span class="frm_hidden_fdata frm_hidden"><?php echo htmlspecialchars(json_encode($field)) ?></span>
19
+<span class="frm_hidden_fdata frm_hidden"><?php echo htmlspecialchars( json_encode( $field ) ) ?></span>
20 20
 </li>
21 21
 <?php
22 22
    return;
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 $frm_settings = FrmAppHelper::get_settings();
26 26
 
27 27
 if ( ! isset( $frm_all_field_selection ) ) {
28
-    if ( isset($frm_field_selection) && isset($pro_field_selection) ) {
29
-        $frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection);
28
+    if ( isset( $frm_field_selection ) && isset( $pro_field_selection ) ) {
29
+        $frm_all_field_selection = array_merge( $frm_field_selection, $pro_field_selection );
30 30
     } else {
31 31
 		$pro_field_selection = FrmField::pro_field_selection();
32 32
 		$frm_all_field_selection = array_merge( FrmField::field_selection(), $pro_field_selection );
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
     <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>
52 52
     <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>
53 53
     <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>
54
-    <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr($field['id']) ?>" />
55
-    <?php do_action('frm_extra_field_actions', $field['id']); ?>
54
+    <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr( $field['id'] ) ?>" />
55
+    <?php do_action( 'frm_extra_field_actions', $field['id'] ); ?>
56 56
     <?php if ( $display['required'] ) { ?>
57 57
     <span id="require_field_<?php echo esc_attr( $field['id'] ); ?>">
58 58
 		<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>
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     <?php }
61 61
 
62 62
     ?>
63
-    <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>
63
+    <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>
64 64
 
65 65
 
66 66
 <div id="field_<?php echo esc_attr( $field['id'] ) ?>_inner_container" class="frm_inner_field_container">
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 </div>
79 79
 <?php
80 80
 if ( $display['description'] ) { ?>
81
-    <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>
81
+    <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>
82 82
     <input type="hidden" name="field_options[description_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['description'] ); ?>" />
83 83
 
84 84
 <?php } ?>
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 		<div class="frm_form_fields">
91 91
 			<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" />
92 92
 		</div>
93
-    	<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
94
-			echo ($field['conf_desc'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags($field['conf_desc']); ?></div>
93
+    	<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
94
+			echo ( $field['conf_desc'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['conf_desc'] ); ?></div>
95 95
     	<input type="hidden" name="field_options[conf_desc_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_desc'] ); ?>" />
96 96
 </div>
97 97
 	<?php if ( $display['clear_on_focus'] ) { ?>
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?>
107 107
     <div class="frm-show-click frm_small_top_margin"><?php
108 108
 
109
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
109
+    if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
110 110
 		echo '<p class="howto">' . FrmFieldsHelper::get_term_link( $field['taxonomy'] ) . '</p>';
111 111
 	} else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) {
112 112
 ?>
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             <?php
121 121
             }
122 122
 
123
-            if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?>
123
+            if ( ! isset( $field['post_field'] ) || $field['post_field'] != 'post_category' ) { ?>
124 124
 			<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">
125 125
 				<?php _e( 'Bulk Edit Options', 'formidable' ) ?>
126 126
 			</a>
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 <?php
134 134
 }
135 135
 
136
-do_action('frm_before_field_options', $field);
136
+do_action( 'frm_before_field_options', $field );
137 137
 
138 138
 if ( $display['options'] ) { ?>
139 139
     <div class="widget">
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
         </div>
144 144
     	<div class="widget-inside">
145 145
             <table class="form-table frm_clear_none">
146
-                <?php $field_types = FrmFieldsHelper::get_field_types($field['type']); ?>
146
+                <?php $field_types = FrmFieldsHelper::get_field_types( $field['type'] ); ?>
147 147
 				<tr><td class="frm_150_width"><label><?php _e( 'Field Type', 'formidable' ) ?></label></td>
148 148
                     <td>
149
-                <select <?php if ( count($field_types) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>>
149
+                <select <?php if ( count( $field_types ) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>>
150 150
                     <?php
151 151
 					foreach ( $field_types as $fkey => $ftype ) { ?>
152
-                        <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>
152
+                        <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>
153 153
                     <?php
154 154
 						unset( $fkey, $ftype );
155 155
 					} ?>
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 				</label>
185 185
                 <?php }
186 186
 
187
-                do_action('frm_field_options_form_top', $field, $display, $values);
187
+                do_action( 'frm_field_options_form_top', $field, $display, $values );
188 188
 
189 189
                 ?>
190 190
                 <?php
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 				if ( $display['label_position'] ) { ?>
222 222
                     <tr><td class="frm_150_width"><label><?php _e( 'Label Position', 'formidable' ) ?></label></td>
223 223
                         <td><select name="field_options[label_<?php echo esc_attr( $field['id'] ) ?>]">
224
-                            <option value=""<?php selected($field['label'], ''); ?>><?php _e( 'Default', 'formidable' ) ?></option>
225
-                            <option value="top"<?php selected($field['label'], 'top'); ?>><?php _e( 'Top', 'formidable' ) ?></option>
226
-                            <option value="left"<?php selected($field['label'], 'left'); ?>><?php _e( 'Left', 'formidable' ) ?></option>
227
-                            <option value="right"<?php selected($field['label'], 'right'); ?>><?php _e( 'Right', 'formidable' ) ?></option>
228
-                            <option value="inline"<?php selected($field['label'], 'inline'); ?>><?php _e( 'Inline (left without a set width)', 'formidable' ) ?></option>
229
-                            <option value="none"<?php selected($field['label'], 'none'); ?>><?php _e( 'None', 'formidable' ) ?></option>
230
-                            <option value="hidden"<?php selected($field['label'], 'hidden'); ?>><?php _e( 'Hidden (but leave the space)', 'formidable' ) ?></option>
224
+                            <option value=""<?php selected( $field['label'], '' ); ?>><?php _e( 'Default', 'formidable' ) ?></option>
225
+                            <option value="top"<?php selected( $field['label'], 'top' ); ?>><?php _e( 'Top', 'formidable' ) ?></option>
226
+                            <option value="left"<?php selected( $field['label'], 'left' ); ?>><?php _e( 'Left', 'formidable' ) ?></option>
227
+                            <option value="right"<?php selected( $field['label'], 'right' ); ?>><?php _e( 'Right', 'formidable' ) ?></option>
228
+                            <option value="inline"<?php selected( $field['label'], 'inline' ); ?>><?php _e( 'Inline (left without a set width)', 'formidable' ) ?></option>
229
+                            <option value="none"<?php selected( $field['label'], 'none' ); ?>><?php _e( 'None', 'formidable' ) ?></option>
230
+                            <option value="hidden"<?php selected( $field['label'], 'hidden' ); ?>><?php _e( 'Hidden (but leave the space)', 'formidable' ) ?></option>
231 231
                         </select>
232 232
                         </td>
233 233
                     </tr>
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 					<span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Set the size of the captcha field. The compact option is best if your form is in a small area.', 'formidable' ) ?>" ></span>
251 251
                     </td>
252 252
                     <td><select name="field_options[captcha_size_<?php echo esc_attr( $field['id'] ) ?>]">
253
-                        <option value="normal"<?php selected($field['captcha_size'], 'normal'); ?>><?php _e( 'Normal', 'formidable' ) ?></option>
254
-                        <option value="compact"<?php selected($field['captcha_size'], 'compact'); ?>><?php _e( 'Compact', 'formidable' ) ?></option>
253
+                        <option value="normal"<?php selected( $field['captcha_size'], 'normal' ); ?>><?php _e( 'Normal', 'formidable' ) ?></option>
254
+                        <option value="compact"<?php selected( $field['captcha_size'], 'compact' ); ?>><?php _e( 'Compact', 'formidable' ) ?></option>
255 255
                     </select>
256 256
                     </td>
257 257
                 </tr>
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 				do_action( 'frm_field_options_form', $field, $display, $values );
274 274
 
275 275
                 if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
276
-					<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'; ?>">
276
+					<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'; ?>">
277 277
 					<td colspan="2">
278 278
                     <div class="menu-settings">
279 279
                     <h3 class="frm_no_bg"><?php _e( 'Validation', 'formidable' ) ?></h3>
@@ -337,4 +337,4 @@  discard block
 block discarded – undo
337 337
 <?php
338 338
 }
339 339
 
340
-unset($display);
340
+unset( $display );
Please login to merge, or discard this patch.
classes/models/FrmStyle.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 	public $id = 0; // the id of the post
5 5
 
6 6
 	/**
7
-	 * @param int|string $id The id of the stylsheet or 'default'
7
+	 * @param integer $id The id of the stylsheet or 'default'
8 8
 	 */
9 9
 	public function __construct( $id = 0 ) {
10 10
         $this->id = $id;
@@ -120,6 +120,9 @@  discard block
 block discarded – undo
120 120
         set_transient('frmpro_css', $css);
121 121
 	}
122 122
 
123
+	/**
124
+	 * @param string $filename
125
+	 */
123 126
 	private function get_css_content( $filename ) {
124 127
 		$css = '/* ' . __( 'WARNING: Any changes made to this file will be lost when your Formidable settings are updated', 'formidable' ) . ' */' . "\n";
125 128
 
Please login to merge, or discard this patch.
Indentation   +275 added lines, -275 removed lines patch added patch discarded remove patch
@@ -1,52 +1,52 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class FrmStyle {
3
-    public $number = false;	// Unique ID number of the current instance.
3
+	public $number = false;	// Unique ID number of the current instance.
4 4
 	public $id = 0; // the id of the post
5 5
 
6 6
 	/**
7 7
 	 * @param int|string $id The id of the stylsheet or 'default'
8 8
 	 */
9 9
 	public function __construct( $id = 0 ) {
10
-        $this->id = $id;
11
-    }
10
+		$this->id = $id;
11
+	}
12 12
 
13
-    public function get_new() {
13
+	public function get_new() {
14 14
 		$this->id = 0;
15 15
 
16
-        $max_slug_value = pow(36, 6);
17
-        $min_slug_value = 37; // we want to have at least 2 characters in the slug
18
-        $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
19
-
20
-        $style = array(
21
-            'post_type'     => FrmStylesController::$post_type,
22
-            'ID'            => '',
23
-            'post_title'    => __( 'New Style', 'formidable' ),
24
-            'post_name'     => $key,
25
-            'post_content'  => $this->get_defaults(),
26
-            'menu_order'    => '',
27
-            'post_status'   => 'publish',
28
-        );
16
+		$max_slug_value = pow(36, 6);
17
+		$min_slug_value = 37; // we want to have at least 2 characters in the slug
18
+		$key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
19
+
20
+		$style = array(
21
+			'post_type'     => FrmStylesController::$post_type,
22
+			'ID'            => '',
23
+			'post_title'    => __( 'New Style', 'formidable' ),
24
+			'post_name'     => $key,
25
+			'post_content'  => $this->get_defaults(),
26
+			'menu_order'    => '',
27
+			'post_status'   => 'publish',
28
+		);
29 29
 
30
-        return (object) $style;
31
-    }
30
+		return (object) $style;
31
+	}
32 32
 
33 33
 	public function save( $settings ) {
34 34
 		return FrmAppHelper::save_settings( $settings, 'frm_styles' );
35
-    }
35
+	}
36 36
 
37 37
 	public function duplicate( $id ) {
38
-        // duplicating is a pro feature
39
-    }
38
+		// duplicating is a pro feature
39
+	}
40 40
 
41
-    public function update( $id = 'default' ) {
41
+	public function update( $id = 'default' ) {
42 42
  		$all_instances = $this->get_all();
43 43
 
44 44
  		if ( empty($id) ) {
45
- 		     $new_style = (array) $this->get_new();
46
- 		     $all_instances[] = $new_style;
45
+ 			 $new_style = (array) $this->get_new();
46
+ 			 $all_instances[] = $new_style;
47 47
  		}
48 48
 
49
-        $action_ids = array();
49
+		$action_ids = array();
50 50
 
51 51
  		foreach ( $all_instances as $number => $new_instance ) {
52 52
  			$new_instance = stripslashes_deep( (array) $new_instance);
@@ -54,42 +54,42 @@  discard block
 block discarded – undo
54 54
  			if ( $id != $this->id || ! $_POST || ! isset($_POST['frm_style_setting']) ) {
55 55
 				$all_instances[ $number ] = $new_instance;
56 56
 
57
- 			    if ( $new_instance['menu_order'] && $_POST && empty($_POST['prev_menu_order']) && isset($_POST['frm_style_setting']['menu_order']) ) {
58
- 			        // this style was set to default, so remove default setting on previous default style
59
- 			        $new_instance['menu_order'] = 0;
60
- 			        $action_ids[] = $this->save($new_instance);
61
- 			    }
57
+ 				if ( $new_instance['menu_order'] && $_POST && empty($_POST['prev_menu_order']) && isset($_POST['frm_style_setting']['menu_order']) ) {
58
+ 					// this style was set to default, so remove default setting on previous default style
59
+ 					$new_instance['menu_order'] = 0;
60
+ 					$action_ids[] = $this->save($new_instance);
61
+ 				}
62 62
 
63
- 			    // don't continue if not saving this style
64
- 			    continue;
63
+ 				// don't continue if not saving this style
64
+ 				continue;
65 65
  			}
66 66
 
67 67
  			$new_instance['post_title'] = sanitize_text_field( $_POST['frm_style_setting']['post_title'] );
68 68
  			$new_instance['post_content'] = $_POST['frm_style_setting']['post_content'];
69 69
  			$new_instance['post_type']  = FrmStylesController::$post_type;
70
-            $new_instance['post_status']  = 'publish';
70
+			$new_instance['post_status']  = 'publish';
71 71
 			$new_instance['menu_order']  = isset( $_POST['frm_style_setting']['menu_order'] ) ? absint( $_POST['frm_style_setting']['menu_order'] ) : 0;
72 72
 
73
-            if ( empty($id) ) {
74
-                $new_instance['post_name'] = $new_instance['post_title'];
75
-            }
73
+			if ( empty($id) ) {
74
+				$new_instance['post_name'] = $new_instance['post_title'];
75
+			}
76 76
 
77
-            $default_settings = $this->get_defaults();
77
+			$default_settings = $this->get_defaults();
78 78
 
79
-            foreach ( $default_settings as $setting => $default ) {
79
+			foreach ( $default_settings as $setting => $default ) {
80 80
 				if ( strpos( $setting, 'color' ) !== false || in_array( $setting, array( 'error_bg', 'error_border', 'error_text' ) ) ) {
81
-                    //if is a color
81
+					//if is a color
82 82
 					$new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] );
83 83
 				} else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) {
84 84
 					$new_instance['post_content'][ $setting ] = 0;
85
-                } else if ( $setting == 'font' ) {
86
-                	$new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
87
-                }
88
-            }
85
+				} else if ( $setting == 'font' ) {
86
+					$new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
87
+				}
88
+			}
89 89
 
90 90
 			$all_instances[ $number ] = $new_instance;
91 91
 
92
-            $action_ids[] = $this->save($new_instance);
92
+			$action_ids[] = $this->save($new_instance);
93 93
 
94 94
  		}
95 95
 
@@ -98,27 +98,27 @@  discard block
 block discarded – undo
98 98
  		return $action_ids;
99 99
  	}
100 100
 
101
-    /**
102
-     * Create static css file
103
-     */
101
+	/**
102
+	 * Create static css file
103
+	 */
104 104
 	public function save_settings() {
105 105
 		$filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php';
106 106
 		update_option( 'frm_last_style_update', date('njGi') );
107 107
 
108
-        if ( ! is_file($filename) ) {
109
-            return;
110
-        }
108
+		if ( ! is_file($filename) ) {
109
+			return;
110
+		}
111 111
 
112 112
 		$css = $this->get_css_content( $filename );
113 113
 
114 114
 		$create_file = new FrmCreateFile( array( 'folder_name' => 'formidable/css', 'file_name' => 'formidablepro.css' ) );
115 115
 		$create_file->create_file( $css );
116 116
 
117
-        update_option('frmpro_css', $css);
117
+		update_option('frmpro_css', $css);
118 118
 
119 119
 		$this->clear_cache();
120 120
 
121
-        set_transient('frmpro_css', $css);
121
+		set_transient('frmpro_css', $css);
122 122
 	}
123 123
 
124 124
 	private function get_css_content( $filename ) {
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 		$saving = true;
128 128
 		$frm_style = $this;
129 129
 
130
-        ob_start();
131
-        include( $filename );
130
+		ob_start();
131
+		include( $filename );
132 132
 		$css .= preg_replace( '/\/\*(.|\s)*?\*\//', '', str_replace( array( "\r\n", "\r", "\n", "\t", '    ' ), '', ob_get_contents() ) );
133
-        ob_end_clean();
133
+		ob_end_clean();
134 134
 
135 135
 		return $css;
136 136
 	}
@@ -150,272 +150,272 @@  discard block
 block discarded – undo
150 150
 	}
151 151
 
152 152
 	public function destroy( $id ) {
153
-        return wp_delete_post($id);
154
-    }
153
+		return wp_delete_post($id);
154
+	}
155 155
 
156
-    public function get_one() {
157
-        if ( 'default' == $this->id ) {
158
-            $style = $this->get_default_style();
159
-            if ( $style ) {
160
-                $this->id = $style->ID;
161
-            } else {
162
-                $this->id = 0;
163
-            }
164
-            return $style;
165
-        }
156
+	public function get_one() {
157
+		if ( 'default' == $this->id ) {
158
+			$style = $this->get_default_style();
159
+			if ( $style ) {
160
+				$this->id = $style->ID;
161
+			} else {
162
+				$this->id = 0;
163
+			}
164
+			return $style;
165
+		}
166 166
 
167
-        $style = get_post($this->id);
167
+		$style = get_post($this->id);
168 168
 
169
-        if ( ! $style ) {
170
-            return $style;
171
-        }
169
+		if ( ! $style ) {
170
+			return $style;
171
+		}
172 172
 
173
-        $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
173
+		$style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
174 174
 
175
-        $default_values = $this->get_defaults();
175
+		$default_values = $this->get_defaults();
176 176
 
177
-        // fill default values
178
-        $style->post_content = $this->override_defaults($style->post_content);
179
-        $style->post_content = wp_parse_args( $style->post_content, $default_values);
177
+		// fill default values
178
+		$style->post_content = $this->override_defaults($style->post_content);
179
+		$style->post_content = wp_parse_args( $style->post_content, $default_values);
180 180
 
181
-        return $style;
182
-    }
181
+		return $style;
182
+	}
183 183
 
184
-    public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) {
185
-        $post_atts = array(
184
+	public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) {
185
+		$post_atts = array(
186 186
 			'post_type'   => FrmStylesController::$post_type,
187 187
 			'post_status' => 'publish',
188 188
 			'numberposts' => $limit,
189 189
 			'orderby'     => $orderby,
190 190
 			'order'       => $order,
191
-        );
191
+		);
192 192
 
193
-        $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts');
193
+		$temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts');
194 194
 
195
-        if ( empty($temp_styles) ) {
196
-            global $wpdb;
197
-            // make sure there wasn't a conflict with the query
195
+		if ( empty($temp_styles) ) {
196
+			global $wpdb;
197
+			// make sure there wasn't a conflict with the query
198 198
 			$query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' );
199
-            $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results');
200
-
201
-            if ( empty($temp_styles) ) {
202
-                // create a new style if there are none
203
-         		$new = $this->get_new();
204
-         		$new->post_title = $new->post_name = __( 'Formidable Style', 'formidable' );
205
-         		$new->menu_order = 1;
206
-         		$new = $this->save( (array) $new);
207
-         		$this->update('default');
208
-
209
-                $post_atts['include'] = $new;
210
-
211
-                $temp_styles = get_posts( $post_atts );
212
-            }
213
-        }
214
-
215
-        $default_values = $this->get_defaults();
216
-        $default_style = false;
217
-
218
-        $styles = array();
219
-        foreach ( $temp_styles as $style ) {
220
-            $this->id = $style->ID;
221
-            if ( $style->menu_order ) {
222
-                if ( $default_style ) {
223
-                    // only return one default
224
-                    $style->menu_order = 0;
225
-                } else {
226
-                    // check for a default style
227
-                    $default_style = $style->ID;
228
-                }
229
-            }
230
-
231
-            $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
232
-
233
-            // fill default values
234
-            $style->post_content = $this->override_defaults($style->post_content);
235
-            $style->post_content = wp_parse_args( $style->post_content, $default_values);
199
+			$temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results');
200
+
201
+			if ( empty($temp_styles) ) {
202
+				// create a new style if there are none
203
+		 		$new = $this->get_new();
204
+		 		$new->post_title = $new->post_name = __( 'Formidable Style', 'formidable' );
205
+		 		$new->menu_order = 1;
206
+		 		$new = $this->save( (array) $new);
207
+		 		$this->update('default');
208
+
209
+				$post_atts['include'] = $new;
210
+
211
+				$temp_styles = get_posts( $post_atts );
212
+			}
213
+		}
214
+
215
+		$default_values = $this->get_defaults();
216
+		$default_style = false;
217
+
218
+		$styles = array();
219
+		foreach ( $temp_styles as $style ) {
220
+			$this->id = $style->ID;
221
+			if ( $style->menu_order ) {
222
+				if ( $default_style ) {
223
+					// only return one default
224
+					$style->menu_order = 0;
225
+				} else {
226
+					// check for a default style
227
+					$default_style = $style->ID;
228
+				}
229
+			}
230
+
231
+			$style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
232
+
233
+			// fill default values
234
+			$style->post_content = $this->override_defaults($style->post_content);
235
+			$style->post_content = wp_parse_args( $style->post_content, $default_values);
236 236
 
237 237
 			$styles[ $style->ID ] = $style;
238
-        }
238
+		}
239 239
 
240
-        if ( ! $default_style ) {
241
-            $default_style = reset($styles);
240
+		if ( ! $default_style ) {
241
+			$default_style = reset($styles);
242 242
 			$styles[ $default_style->ID ]->menu_order = 1;
243
-        }
243
+		}
244 244
 
245
-        return $styles;
246
-    }
245
+		return $styles;
246
+	}
247 247
 
248 248
 	public function get_default_style( $styles = null ) {
249
-        if ( ! isset($styles) ) {
249
+		if ( ! isset($styles) ) {
250 250
 			$styles = $this->get_all( 'menu_order', 'DESC', 1 );
251
-        }
251
+		}
252 252
 
253
-        foreach ( $styles as $style ) {
254
-            if ( $style->menu_order ) {
255
-                return $style;
256
-            }
257
-        }
258
-    }
253
+		foreach ( $styles as $style ) {
254
+			if ( $style->menu_order ) {
255
+				return $style;
256
+			}
257
+		}
258
+	}
259 259
 
260 260
 	public function override_defaults( $settings ) {
261
-	    if ( ! is_array($settings) ) {
262
-	        return $settings;
263
-	    }
264
-
265
-	    $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height'];
266
-
267
-	    if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) {
268
-	        $settings['form_desc_size'] = $settings['description_font_size'];
269
-	        $settings['form_desc_color'] = $settings['description_color'];
270
-	        $settings['title_color'] = $settings['label_color'];
271
-	    }
272
-
273
-	    if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) {
274
-	        $settings['section_color'] = $settings['label_color'];
275
-	        $settings['section_border_color'] = $settings['border_color'];
276
-	    }
277
-
278
-	    if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) {
279
-	        $settings['submit_hover_bg_color'] = $settings['submit_bg_color'];
280
-	        $settings['submit_hover_color'] = $settings['submit_text_color'];
281
-	        $settings['submit_hover_border_color'] = $settings['submit_border_color'];
282
-
283
-	        $settings['submit_active_bg_color'] = $settings['submit_bg_color'];
284
-	        $settings['submit_active_color'] = $settings['submit_text_color'];
285
-            $settings['submit_active_border_color'] = $settings['submit_border_color'];
286
-	    }
287
-
288
-	    return $settings;
261
+		if ( ! is_array($settings) ) {
262
+			return $settings;
263
+		}
264
+
265
+		$settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height'];
266
+
267
+		if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) {
268
+			$settings['form_desc_size'] = $settings['description_font_size'];
269
+			$settings['form_desc_color'] = $settings['description_color'];
270
+			$settings['title_color'] = $settings['label_color'];
271
+		}
272
+
273
+		if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) {
274
+			$settings['section_color'] = $settings['label_color'];
275
+			$settings['section_border_color'] = $settings['border_color'];
276
+		}
277
+
278
+		if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) {
279
+			$settings['submit_hover_bg_color'] = $settings['submit_bg_color'];
280
+			$settings['submit_hover_color'] = $settings['submit_text_color'];
281
+			$settings['submit_hover_border_color'] = $settings['submit_border_color'];
282
+
283
+			$settings['submit_active_bg_color'] = $settings['submit_bg_color'];
284
+			$settings['submit_active_color'] = $settings['submit_text_color'];
285
+			$settings['submit_active_border_color'] = $settings['submit_border_color'];
286
+		}
287
+
288
+		return $settings;
289 289
 	}
290 290
 
291 291
 	public function get_defaults() {
292
-        return array(
293
-            'theme_css'         => 'ui-lightness',
294
-            'theme_name'        => 'UI Lightness',
292
+		return array(
293
+			'theme_css'         => 'ui-lightness',
294
+			'theme_name'        => 'UI Lightness',
295 295
 
296 296
 			'center_form'		=> '',
297
-            'form_width'        => '100%',
298
-            'form_align'        => 'left',
299
-            'direction'         => is_rtl() ? 'rtl' : 'ltr',
300
-            'fieldset'          => '0px',
301
-            'fieldset_color'    => '000000',
302
-            'fieldset_padding'  => '0 0 15px 0',
303
-            'fieldset_bg_color' => '',
304
-
305
-            'title_size'        => '20px',
306
-            'title_color'       => '444444',
297
+			'form_width'        => '100%',
298
+			'form_align'        => 'left',
299
+			'direction'         => is_rtl() ? 'rtl' : 'ltr',
300
+			'fieldset'          => '0px',
301
+			'fieldset_color'    => '000000',
302
+			'fieldset_padding'  => '0 0 15px 0',
303
+			'fieldset_bg_color' => '',
304
+
305
+			'title_size'        => '20px',
306
+			'title_color'       => '444444',
307 307
 			'title_margin_top'  => '10px',
308 308
 			'title_margin_bottom' => '10px',
309
-            'form_desc_size'    => '14px',
310
-            'form_desc_color'   => '666666',
309
+			'form_desc_size'    => '14px',
310
+			'form_desc_color'   => '666666',
311 311
 			'form_desc_margin_top' => '10px',
312 312
 			'form_desc_margin_bottom' => '25px',
313 313
 
314
-            'font'              => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif',
315
-            'font_size'         => '14px',
316
-            'label_color'       => '444444',
317
-            'weight'            => 'bold',
318
-            'position'          => 'none',
319
-            'align'             => 'left',
320
-            'width'             => '150px',
321
-            'required_color'    => 'B94A48',
322
-            'required_weight'   => 'bold',
323
-            'label_padding'     => '0 0 3px 0',
324
-
325
-            'description_font_size' => '12px',
326
-            'description_color' => '666666',
327
-            'description_weight' => 'normal',
328
-            'description_style' => 'normal',
329
-            'description_align' => 'left',
314
+			'font'              => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif',
315
+			'font_size'         => '14px',
316
+			'label_color'       => '444444',
317
+			'weight'            => 'bold',
318
+			'position'          => 'none',
319
+			'align'             => 'left',
320
+			'width'             => '150px',
321
+			'required_color'    => 'B94A48',
322
+			'required_weight'   => 'bold',
323
+			'label_padding'     => '0 0 3px 0',
324
+
325
+			'description_font_size' => '12px',
326
+			'description_color' => '666666',
327
+			'description_weight' => 'normal',
328
+			'description_style' => 'normal',
329
+			'description_align' => 'left',
330 330
 			'description_margin' => '0',
331 331
 
332
-            'field_font_size'   => '14px',
333
-            'field_height' 		=> '32px',
334
-            'line_height'		=> 'normal',
335
-            'field_width'       => '100%',
336
-            'auto_width'        => false,
337
-            'field_pad'         => '6px 10px',
338
-            'field_margin'      => '20px',
332
+			'field_font_size'   => '14px',
333
+			'field_height' 		=> '32px',
334
+			'line_height'		=> 'normal',
335
+			'field_width'       => '100%',
336
+			'auto_width'        => false,
337
+			'field_pad'         => '6px 10px',
338
+			'field_margin'      => '20px',
339 339
 			'field_weight' => 'normal',
340
-            'text_color'        => '555555',
341
-            //'border_color_hv'   => 'cccccc',
342
-            'border_color'      => 'cccccc',
343
-            'field_border_width' => '1px',
344
-            'field_border_style' => 'solid',
345
-
346
-            'bg_color'          => 'ffffff',
347
-            //'bg_color_hv'       => 'ffffff',
340
+			'text_color'        => '555555',
341
+			//'border_color_hv'   => 'cccccc',
342
+			'border_color'      => 'cccccc',
343
+			'field_border_width' => '1px',
344
+			'field_border_style' => 'solid',
345
+
346
+			'bg_color'          => 'ffffff',
347
+			//'bg_color_hv'       => 'ffffff',
348 348
 			'remove_box_shadow' => '',
349
-            'bg_color_active'   => 'ffffff',
349
+			'bg_color_active'   => 'ffffff',
350 350
 			'border_color_active' => '66afe9',
351 351
 			'remove_box_shadow_active' => '',
352
-            'text_color_error'  => '444444',
353
-            'bg_color_error'    => 'ffffff',
352
+			'text_color_error'  => '444444',
353
+			'bg_color_error'    => 'ffffff',
354 354
 			'border_color_error' => 'B94A48',
355 355
 			'border_width_error' => '1px',
356 356
 			'border_style_error' => 'solid',
357
-            'bg_color_disabled' => 'ffffff',
358
-            'border_color_disabled' => 'E5E5E5',
359
-            'text_color_disabled' => 'A1A1A1',
360
-
361
-            'radio_align'       => 'block',
362
-            'check_align'       => 'block',
363
-            'check_font_size'   => '13px',
364
-            'check_label_color' => '444444',
365
-            'check_weight'      => 'normal',
366
-
367
-            'section_font_size' => '18px',
368
-            'section_color'     => '444444',
369
-            'section_weight'    => 'bold',
370
-            'section_pad'       => '15px 0 3px 0',
371
-            'section_mar_top'   => '15px',
357
+			'bg_color_disabled' => 'ffffff',
358
+			'border_color_disabled' => 'E5E5E5',
359
+			'text_color_disabled' => 'A1A1A1',
360
+
361
+			'radio_align'       => 'block',
362
+			'check_align'       => 'block',
363
+			'check_font_size'   => '13px',
364
+			'check_label_color' => '444444',
365
+			'check_weight'      => 'normal',
366
+
367
+			'section_font_size' => '18px',
368
+			'section_color'     => '444444',
369
+			'section_weight'    => 'bold',
370
+			'section_pad'       => '15px 0 3px 0',
371
+			'section_mar_top'   => '15px',
372 372
 			'section_mar_bottom' => '12px',
373
-            'section_bg_color'  => '',
374
-            'section_border_color' => 'e8e8e8',
375
-            'section_border_width' => '2px',
376
-            'section_border_style' => 'solid',
377
-            'section_border_loc' => '-top',
378
-            'collapse_icon'     => '6',
379
-            'collapse_pos'      => 'after',
380
-            'repeat_icon'       => '1',
381
-
382
-            'submit_style'      => false,
383
-            'submit_font_size'  => '14px',
384
-            'submit_width'      => 'auto',
385
-            'submit_height'     => 'auto',
386
-            'submit_bg_color'   => 'ffffff',
387
-            'submit_border_color' => 'cccccc',
388
-            'submit_border_width' => '1px',
389
-            'submit_text_color' => '444444',
390
-            'submit_weight'     => 'normal',
391
-            'submit_border_radius' => '4px',
392
-            'submit_bg_img'     => '',
393
-            'submit_margin'     => '10px',
394
-            'submit_padding'    => '6px 11px',
395
-            'submit_shadow_color' => 'eeeeee',
396
-            'submit_hover_bg_color' => 'efefef',
397
-            'submit_hover_color' => '444444',
398
-            'submit_hover_border_color' => 'cccccc',
399
-            'submit_active_bg_color' => 'efefef',
400
-            'submit_active_color' => '444444',
401
-            'submit_active_border_color' => 'cccccc',
402
-
403
-            'border_radius'     => '4px',
404
-            'error_bg'          => 'F2DEDE',
405
-            'error_border'      => 'EBCCD1',
406
-            'error_text'        => 'B94A48',
407
-            'error_font_size'   => '14px',
408
-
409
-            'success_bg_color'  => 'DFF0D8',
410
-            'success_border_color' => 'D6E9C6',
411
-            'success_text_color' => '468847',
412
-            'success_font_size' => '14px',
413
-
414
-            'important_style'   => false,
415
-
416
-            'custom_css'        => '',
417
-        );
418
-    }
373
+			'section_bg_color'  => '',
374
+			'section_border_color' => 'e8e8e8',
375
+			'section_border_width' => '2px',
376
+			'section_border_style' => 'solid',
377
+			'section_border_loc' => '-top',
378
+			'collapse_icon'     => '6',
379
+			'collapse_pos'      => 'after',
380
+			'repeat_icon'       => '1',
381
+
382
+			'submit_style'      => false,
383
+			'submit_font_size'  => '14px',
384
+			'submit_width'      => 'auto',
385
+			'submit_height'     => 'auto',
386
+			'submit_bg_color'   => 'ffffff',
387
+			'submit_border_color' => 'cccccc',
388
+			'submit_border_width' => '1px',
389
+			'submit_text_color' => '444444',
390
+			'submit_weight'     => 'normal',
391
+			'submit_border_radius' => '4px',
392
+			'submit_bg_img'     => '',
393
+			'submit_margin'     => '10px',
394
+			'submit_padding'    => '6px 11px',
395
+			'submit_shadow_color' => 'eeeeee',
396
+			'submit_hover_bg_color' => 'efefef',
397
+			'submit_hover_color' => '444444',
398
+			'submit_hover_border_color' => 'cccccc',
399
+			'submit_active_bg_color' => 'efefef',
400
+			'submit_active_color' => '444444',
401
+			'submit_active_border_color' => 'cccccc',
402
+
403
+			'border_radius'     => '4px',
404
+			'error_bg'          => 'F2DEDE',
405
+			'error_border'      => 'EBCCD1',
406
+			'error_text'        => 'B94A48',
407
+			'error_font_size'   => '14px',
408
+
409
+			'success_bg_color'  => 'DFF0D8',
410
+			'success_border_color' => 'D6E9C6',
411
+			'success_text_color' => '468847',
412
+			'success_font_size' => '14px',
413
+
414
+			'important_style'   => false,
415
+
416
+			'custom_css'        => '',
417
+		);
418
+	}
419 419
 
420 420
 	public function get_field_name( $field_name, $post_field = 'post_content' ) {
421 421
 		return 'frm_style_setting' . ( empty( $post_field ) ? '' : '[' . $post_field . ']' ) . '[' . $field_name . ']';
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class FrmStyle {
3
-    public $number = false;	// Unique ID number of the current instance.
3
+    public $number = false; // Unique ID number of the current instance.
4 4
 	public $id = 0; // the id of the post
5 5
 
6 6
 	/**
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
     public function get_new() {
14 14
 		$this->id = 0;
15 15
 
16
-        $max_slug_value = pow(36, 6);
16
+        $max_slug_value = pow( 36, 6 );
17 17
         $min_slug_value = 37; // we want to have at least 2 characters in the slug
18
-        $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
18
+        $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
19 19
 
20 20
         $style = array(
21 21
             'post_type'     => FrmStylesController::$post_type,
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public function update( $id = 'default' ) {
42 42
  		$all_instances = $this->get_all();
43 43
 
44
- 		if ( empty($id) ) {
44
+ 		if ( empty( $id ) ) {
45 45
  		     $new_style = (array) $this->get_new();
46 46
  		     $all_instances[] = $new_style;
47 47
  		}
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
         $action_ids = array();
50 50
 
51 51
  		foreach ( $all_instances as $number => $new_instance ) {
52
- 			$new_instance = stripslashes_deep( (array) $new_instance);
52
+ 			$new_instance = stripslashes_deep( (array) $new_instance );
53 53
  			$this->id = $new_instance['ID'];
54
- 			if ( $id != $this->id || ! $_POST || ! isset($_POST['frm_style_setting']) ) {
55
-				$all_instances[ $number ] = $new_instance;
54
+ 			if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) {
55
+				$all_instances[$number] = $new_instance;
56 56
 
57
- 			    if ( $new_instance['menu_order'] && $_POST && empty($_POST['prev_menu_order']) && isset($_POST['frm_style_setting']['menu_order']) ) {
57
+ 			    if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) {
58 58
  			        // this style was set to default, so remove default setting on previous default style
59 59
  			        $new_instance['menu_order'] = 0;
60
- 			        $action_ids[] = $this->save($new_instance);
60
+ 			        $action_ids[] = $this->save( $new_instance );
61 61
  			    }
62 62
 
63 63
  			    // don't continue if not saving this style
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
  			$new_instance['post_title'] = sanitize_text_field( $_POST['frm_style_setting']['post_title'] );
68 68
  			$new_instance['post_content'] = $_POST['frm_style_setting']['post_content'];
69 69
  			$new_instance['post_type']  = FrmStylesController::$post_type;
70
-            $new_instance['post_status']  = 'publish';
70
+            $new_instance['post_status'] = 'publish';
71 71
 			$new_instance['menu_order']  = isset( $_POST['frm_style_setting']['menu_order'] ) ? absint( $_POST['frm_style_setting']['menu_order'] ) : 0;
72 72
 
73
-            if ( empty($id) ) {
73
+            if ( empty( $id ) ) {
74 74
                 $new_instance['post_name'] = $new_instance['post_title'];
75 75
             }
76 76
 
@@ -79,17 +79,17 @@  discard block
 block discarded – undo
79 79
             foreach ( $default_settings as $setting => $default ) {
80 80
 				if ( strpos( $setting, 'color' ) !== false || in_array( $setting, array( 'error_bg', 'error_border', 'error_text' ) ) ) {
81 81
                     //if is a color
82
-					$new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] );
83
-				} else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) {
84
-					$new_instance['post_content'][ $setting ] = 0;
82
+					$new_instance['post_content'][$setting] = str_replace( '#', '', $new_instance['post_content'][$setting] );
83
+				} else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][$setting] ) ) {
84
+					$new_instance['post_content'][$setting] = 0;
85 85
                 } else if ( $setting == 'font' ) {
86
-                	$new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
86
+                	$new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] );
87 87
                 }
88 88
             }
89 89
 
90
-			$all_instances[ $number ] = $new_instance;
90
+			$all_instances[$number] = $new_instance;
91 91
 
92
-            $action_ids[] = $this->save($new_instance);
92
+            $action_ids[] = $this->save( $new_instance );
93 93
 
94 94
  		}
95 95
 
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
      */
104 104
 	public function save_settings() {
105 105
 		$filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php';
106
-		update_option( 'frm_last_style_update', date('njGi') );
106
+		update_option( 'frm_last_style_update', date( 'njGi' ) );
107 107
 
108
-        if ( ! is_file($filename) ) {
108
+        if ( ! is_file( $filename ) ) {
109 109
             return;
110 110
         }
111 111
 
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 		$create_file = new FrmCreateFile( array( 'folder_name' => 'formidable/css', 'file_name' => 'formidablepro.css' ) );
115 115
 		$create_file->create_file( $css );
116 116
 
117
-        update_option('frmpro_css', $css);
117
+        update_option( 'frmpro_css', $css );
118 118
 
119 119
 		$this->clear_cache();
120 120
 
121
-        set_transient('frmpro_css', $css);
121
+        set_transient( 'frmpro_css', $css );
122 122
 	}
123 123
 
124 124
 	private function get_css_content( $filename ) {
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	}
151 151
 
152 152
 	public function destroy( $id ) {
153
-        return wp_delete_post($id);
153
+        return wp_delete_post( $id );
154 154
     }
155 155
 
156 156
     public function get_one() {
@@ -164,19 +164,19 @@  discard block
 block discarded – undo
164 164
             return $style;
165 165
         }
166 166
 
167
-        $style = get_post($this->id);
167
+        $style = get_post( $this->id );
168 168
 
169 169
         if ( ! $style ) {
170 170
             return $style;
171 171
         }
172 172
 
173
-        $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
173
+        $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content );
174 174
 
175 175
         $default_values = $this->get_defaults();
176 176
 
177 177
         // fill default values
178
-        $style->post_content = $this->override_defaults($style->post_content);
179
-        $style->post_content = wp_parse_args( $style->post_content, $default_values);
178
+        $style->post_content = $this->override_defaults( $style->post_content );
179
+        $style->post_content = wp_parse_args( $style->post_content, $default_values );
180 180
 
181 181
         return $style;
182 182
     }
@@ -190,21 +190,21 @@  discard block
 block discarded – undo
190 190
 			'order'       => $order,
191 191
         );
192 192
 
193
-        $temp_styles = FrmAppHelper::check_cache(serialize($post_atts), 'frm_styles', $post_atts, 'get_posts');
193
+        $temp_styles = FrmAppHelper::check_cache( serialize( $post_atts ), 'frm_styles', $post_atts, 'get_posts' );
194 194
 
195
-        if ( empty($temp_styles) ) {
195
+        if ( empty( $temp_styles ) ) {
196 196
             global $wpdb;
197 197
             // make sure there wasn't a conflict with the query
198 198
 			$query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' );
199
-            $temp_styles = FrmAppHelper::check_cache('frm_backup_style_check', 'frm_styles', $query, 'get_results');
199
+            $temp_styles = FrmAppHelper::check_cache( 'frm_backup_style_check', 'frm_styles', $query, 'get_results' );
200 200
 
201
-            if ( empty($temp_styles) ) {
201
+            if ( empty( $temp_styles ) ) {
202 202
                 // create a new style if there are none
203 203
          		$new = $this->get_new();
204 204
          		$new->post_title = $new->post_name = __( 'Formidable Style', 'formidable' );
205 205
          		$new->menu_order = 1;
206
-         		$new = $this->save( (array) $new);
207
-         		$this->update('default');
206
+         		$new = $this->save( (array) $new );
207
+         		$this->update( 'default' );
208 208
 
209 209
                 $post_atts['include'] = $new;
210 210
 
@@ -228,25 +228,25 @@  discard block
 block discarded – undo
228 228
                 }
229 229
             }
230 230
 
231
-            $style->post_content = FrmAppHelper::maybe_json_decode($style->post_content);
231
+            $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content );
232 232
 
233 233
             // fill default values
234
-            $style->post_content = $this->override_defaults($style->post_content);
235
-            $style->post_content = wp_parse_args( $style->post_content, $default_values);
234
+            $style->post_content = $this->override_defaults( $style->post_content );
235
+            $style->post_content = wp_parse_args( $style->post_content, $default_values );
236 236
 
237
-			$styles[ $style->ID ] = $style;
237
+			$styles[$style->ID] = $style;
238 238
         }
239 239
 
240 240
         if ( ! $default_style ) {
241
-            $default_style = reset($styles);
242
-			$styles[ $default_style->ID ]->menu_order = 1;
241
+            $default_style = reset( $styles );
242
+			$styles[$default_style->ID]->menu_order = 1;
243 243
         }
244 244
 
245 245
         return $styles;
246 246
     }
247 247
 
248 248
 	public function get_default_style( $styles = null ) {
249
-        if ( ! isset($styles) ) {
249
+        if ( ! isset( $styles ) ) {
250 250
 			$styles = $this->get_all( 'menu_order', 'DESC', 1 );
251 251
         }
252 252
 
@@ -258,24 +258,24 @@  discard block
 block discarded – undo
258 258
     }
259 259
 
260 260
 	public function override_defaults( $settings ) {
261
-	    if ( ! is_array($settings) ) {
261
+	    if ( ! is_array( $settings ) ) {
262 262
 	        return $settings;
263 263
 	    }
264 264
 
265
-	    $settings['line_height'] = ( ! isset($settings['field_height']) || $settings['field_height'] == '' || $settings['field_height'] == 'auto') ? 'normal' : $settings['field_height'];
265
+	    $settings['line_height'] = ( ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] == 'auto' ) ? 'normal' : $settings['field_height'];
266 266
 
267
-	    if ( ! isset($settings['form_desc_size']) && isset($settings['description_font_size']) ) {
267
+	    if ( ! isset( $settings['form_desc_size'] ) && isset( $settings['description_font_size'] ) ) {
268 268
 	        $settings['form_desc_size'] = $settings['description_font_size'];
269 269
 	        $settings['form_desc_color'] = $settings['description_color'];
270 270
 	        $settings['title_color'] = $settings['label_color'];
271 271
 	    }
272 272
 
273
-	    if ( ! isset($settings['section_color']) && isset($settings['label_color']) ) {
273
+	    if ( ! isset( $settings['section_color'] ) && isset( $settings['label_color'] ) ) {
274 274
 	        $settings['section_color'] = $settings['label_color'];
275 275
 	        $settings['section_border_color'] = $settings['border_color'];
276 276
 	    }
277 277
 
278
-	    if ( ! isset($settings['submit_hover_bg_color']) && isset($settings['submit_bg_color']) ) {
278
+	    if ( ! isset( $settings['submit_hover_bg_color'] ) && isset( $settings['submit_bg_color'] ) ) {
279 279
 	        $settings['submit_hover_bg_color'] = $settings['submit_bg_color'];
280 280
 	        $settings['submit_hover_color'] = $settings['submit_text_color'];
281 281
 	        $settings['submit_hover_border_color'] = $settings['submit_border_color'];
Please login to merge, or discard this patch.
classes/models/FrmCreateFile.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 		$this->file_name = $atts['file_name'];
19 19
 		$this->error_message = isset( $atts['error_message'] ) ? $atts['error_message'] : '';
20 20
 		$this->uploads = wp_upload_dir();
21
-		$this->chmod_dir = defined('FS_CHMOD_DIR') ? FS_CHMOD_DIR : ( fileperms( ABSPATH ) & 0777 | 0755 );
22
-		$this->chmod_file = defined('FS_CHMOD_FILE') ? FS_CHMOD_FILE : ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 );
21
+		$this->chmod_dir = defined( 'FS_CHMOD_DIR' ) ? FS_CHMOD_DIR : ( fileperms( ABSPATH ) & 0777 | 0755 );
22
+		$this->chmod_file = defined( 'FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 );
23 23
 	}
24 24
 
25 25
 	public function create_file( $file_content ) {
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 	private function get_ftp_creds( $type ) {
86 86
 		$credentials = get_option( 'ftp_credentials', array( 'hostname' => '', 'username' => '' ) );
87 87
 
88
-		$credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : $credentials['hostname'];
89
-		$credentials['username'] = defined('FTP_USER') ? FTP_USER : $credentials['username'];
90
-		$credentials['password'] = defined('FTP_PASS') ? FTP_PASS : '';
88
+		$credentials['hostname'] = defined( 'FTP_HOST' ) ? FTP_HOST : $credentials['hostname'];
89
+		$credentials['username'] = defined( 'FTP_USER' ) ? FTP_USER : $credentials['username'];
90
+		$credentials['password'] = defined( 'FTP_PASS' ) ? FTP_PASS : '';
91 91
 
92 92
 		// Check to see if we are setting the public/private keys for ssh
93
-		$credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : '';
94
-		$credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : '';
93
+		$credentials['public_key'] = defined( 'FTP_PUBKEY' ) ? FTP_PUBKEY : '';
94
+		$credentials['private_key'] = defined( 'FTP_PRIKEY' ) ? FTP_PRIKEY : '';
95 95
 
96 96
 		// Sanitize the hostname, Some people might pass in odd-data:
97 97
 		$credentials['hostname'] = preg_replace( '|\w+://|', '', $credentials['hostname'] ); //Strip any schemes off
Please login to merge, or discard this patch.
classes/views/frm-fields/single-option.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <li id="frm_delete_field_<?php echo esc_attr( $field['id'] ); ?>-<?php echo esc_attr( $opt_key ) ?>_container" class="frm_single_option">
2 2
     <a href="javascript:void(0)" class="frm_single_visible_hover frm_icon_font frm_delete_icon" data-fid="<?php echo esc_attr( $field['id'] ); ?>"> </a>
3 3
     <?php if ( $field['type'] != 'select' ) { ?>
4
-        <input type="<?php echo esc_attr( $field['type'] ) ?>" name="<?php echo esc_attr( $field_name ) ?><?php echo ( $field['type'] == 'checkbox' ) ? '[]' : ''; ?>" value="<?php echo esc_attr($field_val) ?>"<?php echo isset( $checked ) ? $checked : ''; ?>/>
4
+        <input type="<?php echo esc_attr( $field['type'] ) ?>" name="<?php echo esc_attr( $field_name ) ?><?php echo ( $field['type'] == 'checkbox' ) ? '[]' : ''; ?>" value="<?php echo esc_attr( $field_val ) ?>"<?php echo isset( $checked ) ? $checked : ''; ?>/>
5 5
     <?php } ?>
6
-	<label class="frm_ipe_field_option field_<?php echo esc_attr( $field['id'] ) ?>_option <?php echo esc_attr( $field['separate_value'] ? 'frm_with_key' : '' ); ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>"><?php echo ($opt == '') ? __( '(Blank)', 'formidable' ) : $opt ?></label>
6
+	<label class="frm_ipe_field_option field_<?php echo esc_attr( $field['id'] ) ?>_option <?php echo esc_attr( $field['separate_value'] ? 'frm_with_key' : '' ); ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>"><?php echo ( $opt == '' ) ? __( '(Blank)', 'formidable' ) : $opt ?></label>
7 7
     <span class="frm_option_key field_<?php echo esc_attr( $field['id'] ) ?>_option_key<?php echo esc_attr( $field['separate_value'] ? '' : ' frm_hidden' ); ?>">
8 8
 		<label class="frm-show-click frm_ipe_field_option_key" id="field_key_<?php echo esc_attr( $field['id'] . '-' . $opt_key ) ?>"><?php echo ( $field_val == '' ) ? esc_html__( '(Blank)', 'formidable' ) : $field_val ?></label>
9 9
     </span>
10 10
 </li>
11 11
 <?php
12
-unset($field_val, $opt, $opt_key);
12
+unset( $field_val, $opt, $opt_key );
Please login to merge, or discard this patch.
classes/views/styles/_field-labels.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <div class="field-group field-group-background clearfix frm-first-row">
2 2
 	<label><?php _e( 'Color', 'formidable' ) ?></label>
3
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('label_color') ) ?>" id="frm_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['label_color'] ) ?>" />
3
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'label_color' ) ) ?>" id="frm_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['label_color'] ) ?>" />
4 4
 </div>
5 5
 <div class="field-group clearfix frm-first-row">
6 6
 	<label><?php _e( 'Weight', 'formidable' ) ?></label>
7
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('weight') ) ?>" id="frm_weight">
7
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'weight' ) ) ?>" id="frm_weight">
8 8
 		<?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?>
9 9
 		<option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['weight'], $value ) ?>><?php echo esc_html( $name ) ?></option>
10 10
 		<?php } ?>
@@ -12,45 +12,45 @@  discard block
 block discarded – undo
12 12
 </div>
13 13
 <div class="field-group clearfix frm-first-row">
14 14
 	<label><?php _e( 'Size', 'formidable' ) ?></label>
15
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('font_size') ) ?>" id="frm_font_size" value="<?php echo esc_attr($style->post_content['font_size']) ?>"  size="3" />
15
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'font_size' ) ) ?>" id="frm_font_size" value="<?php echo esc_attr( $style->post_content['font_size'] ) ?>"  size="3" />
16 16
 </div>
17 17
 
18 18
 <div class="field-group clearfix frm_clear">
19 19
 	<label><?php _e( 'Position', 'formidable' ) ?></label>
20
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('position') ) ?>" id="frm_position">
20
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'position' ) ) ?>" id="frm_position">
21 21
 	    <?php foreach ( array( 'none' => __( 'top', 'formidable' ), 'left' => __( 'left', 'formidable' ), 'right' => __( 'right', 'formidable' ), 'no_label' => __( 'none', 'formidable' ) ) as $pos => $pos_label ) { ?>
22
-	        <option value="<?php echo esc_attr( $pos ) ?>" <?php selected($style->post_content['position'], $pos) ?>><?php echo esc_html( $pos_label ) ?></option>
22
+	        <option value="<?php echo esc_attr( $pos ) ?>" <?php selected( $style->post_content['position'], $pos ) ?>><?php echo esc_html( $pos_label ) ?></option>
23 23
 	    <?php } ?>
24 24
 	</select>
25 25
 </div>
26 26
 
27 27
 <div class="field-group clearfix">
28 28
 	<label><?php _e( 'Align', 'formidable' ) ?></label>
29
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('align') ) ?>" id="frm_align">
30
-		<option value="left" <?php selected($style->post_content['align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option>
31
-		<option value="right" <?php selected($style->post_content['align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option>
29
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'align' ) ) ?>" id="frm_align">
30
+		<option value="left" <?php selected( $style->post_content['align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option>
31
+		<option value="right" <?php selected( $style->post_content['align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option>
32 32
 	</select>
33 33
 </div>
34 34
 
35 35
 <div class="field-group clearfix">
36 36
 	<label><?php _e( 'Width', 'formidable' ) ?></label>
37
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('width') ) ?>" id="frm_width" value="<?php echo esc_attr( $style->post_content['width'] ) ?>" />
37
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'width' ) ) ?>" id="frm_width" value="<?php echo esc_attr( $style->post_content['width'] ) ?>" />
38 38
 </div>
39 39
 
40 40
 <div class="field-group clearfix frm_clear">
41 41
 	<label><?php _e( 'Padding', 'formidable' ) ?></label>
42
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('label_padding') ) ?>" id="frm_label_padding" value="<?php echo esc_attr( $style->post_content['label_padding'] ) ?>" />
42
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'label_padding' ) ) ?>" id="frm_label_padding" value="<?php echo esc_attr( $style->post_content['label_padding'] ) ?>" />
43 43
 </div>
44 44
 
45 45
 <div class="clear"></div>
46 46
 <h3><?php _e( 'Required Indicator', 'formidable' ) ?></h3>
47 47
 <div class="field-group field-group-border clearfix after-h3">
48 48
 	<label class="background"><?php _e( 'Color', 'formidable' ) ?></label>
49
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('required_color') ) ?>" id="frm_required_color" class="hex" value="<?php echo esc_attr( $style->post_content['required_color'] ) ?>" />
49
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'required_color' ) ) ?>" id="frm_required_color" class="hex" value="<?php echo esc_attr( $style->post_content['required_color'] ) ?>" />
50 50
 </div>
51 51
 <div class="field-group clearfix after-h3">
52 52
 	<label><?php _e( 'Weight', 'formidable' ) ?></label>
53
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('required_weight') ) ?>" id="frm_required_weight">
53
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'required_weight' ) ) ?>" id="frm_required_weight">
54 54
 		<?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?>
55 55
 		<option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['required_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option>
56 56
 		<?php } ?>
Please login to merge, or discard this patch.
classes/views/styles/_buttons.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <p class="frm_no_top_margin">
2 2
 	<label for="frm_submit_style">
3
-		<input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('submit_style') ) ?>" id="frm_submit_style" <?php checked( $style->post_content['submit_style'], 1 ) ?> value="1" />
3
+		<input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_style' ) ) ?>" id="frm_submit_style" <?php checked( $style->post_content['submit_style'], 1 ) ?> value="1" />
4 4
 		<?php esc_html_e( 'Disable submit button styling', 'formidable' ); ?>
5 5
 		<span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Note: If disabled, you may not see the change take effect until you make 2 more styling changes or click "Update Options".', 'formidable' ) ?>"></span>
6 6
 	</label>
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
 <div class="posttypediv">
10 10
 	<ul class="posttype-tabs add-menu-item-tabs">
11 11
 		<li <?php echo ( 'default' == $current_tab ? ' class="tabs"' : '' ); ?>>
12
-    		<a href="<?php echo esc_url('?page=formidable-styles&page-tab=default#tabs-panel-button-default') ?>" class="nav-tab-link" data-type="tabs-panel-button-default" ><?php _e( 'Default', 'formidable' ) ?></a>
12
+    		<a href="<?php echo esc_url( '?page=formidable-styles&page-tab=default#tabs-panel-button-default' ) ?>" class="nav-tab-link" data-type="tabs-panel-button-default" ><?php _e( 'Default', 'formidable' ) ?></a>
13 13
     	</li>
14 14
 		<li <?php echo ( 'button-hover' == $current_tab ? ' class="tabs"' : '' ); ?>>
15
-			<a href="<?php echo esc_url('?page=formidable-styles&page-tab=button-hover#page-button-hover') ?>" class="nav-tab-link" data-type="tabs-panel-button-hover" ><?php _e( 'Hover', 'formidable' ) ?></a>
15
+			<a href="<?php echo esc_url( '?page=formidable-styles&page-tab=button-hover#page-button-hover' ) ?>" class="nav-tab-link" data-type="tabs-panel-button-hover" ><?php _e( 'Hover', 'formidable' ) ?></a>
16 16
 		</li>
17 17
 		<li <?php echo ( 'button-click' == $current_tab ? ' class="tabs"' : '' ); ?>>
18 18
 			<a href="?page=formidable-styles&page-tab=button-click#tabs-panel-button-click" class="nav-tab-link" data-type="tabs-panel-button-click"><?php _e( 'Click', 'formidable' ) ?></a>
@@ -24,22 +24,22 @@  discard block
 block discarded – undo
24 24
 	?>">
25 25
 	    <div class="field-group field-group-border clearfix">
26 26
         	<label><?php _e( 'Size', 'formidable' ) ?></label>
27
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_font_size') ) ?>" id="frm_submit_font_size" value="<?php echo esc_attr( $style->post_content['submit_font_size'] ) ?>"  size="3" />
27
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_font_size' ) ) ?>" id="frm_submit_font_size" value="<?php echo esc_attr( $style->post_content['submit_font_size'] ) ?>"  size="3" />
28 28
         </div>
29 29
 
30 30
         <div class="field-group clearfix">
31 31
         	<label><?php _e( 'Width', 'formidable' ) ?></label>
32
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_width') ) ?>" id="frm_submit_width" value="<?php echo esc_attr( $style->post_content['submit_width'] ) ?>"  size="5" />
32
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_width' ) ) ?>" id="frm_submit_width" value="<?php echo esc_attr( $style->post_content['submit_width'] ) ?>"  size="5" />
33 33
         </div>
34 34
 
35 35
         <div class="field-group clearfix">
36 36
         	<label><?php _e( 'Height', 'formidable' ) ?></label>
37
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_height') ) ?>" id="frm_submit_height" value="<?php echo esc_attr( $style->post_content['submit_height'] ) ?>"  size="5" />
37
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_height' ) ) ?>" id="frm_submit_height" value="<?php echo esc_attr( $style->post_content['submit_height'] ) ?>"  size="5" />
38 38
         </div>
39 39
 
40 40
         <div class="field-group clearfix">
41 41
         	<label><?php _e( 'Weight', 'formidable' ) ?></label>
42
-        	<select name="<?php echo esc_attr( $frm_style->get_field_name('submit_weight') ) ?>" id="frm_submit_weight">
42
+        	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_weight' ) ) ?>" id="frm_submit_weight">
43 43
 				<?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?>
44 44
 				<option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['submit_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option>
45 45
 				<?php } ?>
@@ -48,48 +48,48 @@  discard block
 block discarded – undo
48 48
 
49 49
         <div class="field-group clearfix">
50 50
         	<label><?php _e( 'Corners', 'formidable' ) ?></label>
51
-        	<input type="text" value="<?php echo esc_attr( $style->post_content['submit_border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_radius') ) ?>" id="frm_submit_border_radius" size="4"/>
51
+        	<input type="text" value="<?php echo esc_attr( $style->post_content['submit_border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_radius' ) ) ?>" id="frm_submit_border_radius" size="4"/>
52 52
         </div>
53 53
 
54 54
         <div class="field-group field-group-border clearfix">
55 55
         	<label><?php _e( 'BG Color', 'formidable' ) ?></label>
56
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_bg_color') ) ?>" id="frm_submit_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_bg_color'] ) ?>" />
56
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_bg_color' ) ) ?>" id="frm_submit_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_bg_color'] ) ?>" />
57 57
         </div>
58 58
 
59 59
         <div class="field-group clearfix">
60 60
         	<label><?php _e( 'Text', 'formidable' ) ?></label>
61
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_text_color') ) ?>" id="frm_submit_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_text_color'] ) ?>" />
61
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_text_color' ) ) ?>" id="frm_submit_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_text_color'] ) ?>" />
62 62
         </div>
63 63
 
64 64
         <div class="field-group field-group-border clearfix">
65 65
         	<label><?php _e( 'Border', 'formidable' ) ?></label>
66
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_color') ) ?>" id="frm_submit_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_border_color'] ) ?>" />
66
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_color' ) ) ?>" id="frm_submit_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_border_color'] ) ?>" />
67 67
         </div>
68 68
 
69 69
         <div class="field-group clearfix">
70 70
         	<label><?php _e( 'Thickness', 'formidable' ) ?></label>
71
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_width') ) ?>" id="frm_submit_border_width" value="<?php echo esc_attr( $style->post_content['submit_border_width'] ) ?>" size="4" />
71
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_width' ) ) ?>" id="frm_submit_border_width" value="<?php echo esc_attr( $style->post_content['submit_border_width'] ) ?>" size="4" />
72 72
         </div>
73 73
 
74 74
         <div class="field-group clearfix">
75 75
         	<label><?php _e( 'Shadow', 'formidable' ) ?></label>
76
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_shadow_color') ) ?>" id="frm_submit_shadow_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_shadow_color'] ) ?>" />
76
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_shadow_color' ) ) ?>" id="frm_submit_shadow_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_shadow_color'] ) ?>" />
77 77
         </div>
78 78
 
79 79
         <div class="clear"></div>
80 80
         <div class="field-group field-group-border frm-full">
81 81
         	<label><?php _e( 'BG Image', 'formidable' ) ?></label>
82
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_bg_img') ) ?>" id="frm_submit_bg_img" value="<?php echo esc_attr( $style->post_content['submit_bg_img'] ) ?>"  />
82
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_bg_img' ) ) ?>" id="frm_submit_bg_img" value="<?php echo esc_attr( $style->post_content['submit_bg_img'] ) ?>"  />
83 83
         </div>
84 84
 
85 85
         <div class="field-group field-group-border clearfix">
86 86
         	<label><?php _e( 'Margin', 'formidable' ) ?></label>
87
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_margin') ) ?>" id="frm_submit_margin" value="<?php echo esc_attr( $style->post_content['submit_margin'] ) ?>" size="6" />
87
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_margin' ) ) ?>" id="frm_submit_margin" value="<?php echo esc_attr( $style->post_content['submit_margin'] ) ?>" size="6" />
88 88
         </div>
89 89
 
90 90
         <div class="field-group clearfix">
91 91
         	<label><?php _e( 'Padding', 'formidable' ) ?></label>
92
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_padding') ) ?>" id="frm_submit_padding" value="<?php echo esc_attr( $style->post_content['submit_padding'] ) ?>" size="6" />
92
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_padding' ) ) ?>" id="frm_submit_padding" value="<?php echo esc_attr( $style->post_content['submit_padding'] ) ?>" size="6" />
93 93
         </div>
94 94
         <div class="clear"></div>
95 95
 	</div><!-- /.tabs-panel -->
@@ -99,17 +99,17 @@  discard block
 block discarded – undo
99 99
 	?>">
100 100
 	    <div class="field-group clearfix">
101 101
         	<label><?php _e( 'BG Color', 'formidable' ) ?></label>
102
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_bg_color') ) ?>" id="frm_submit_hover_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_bg_color'] ) ?>" />
102
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_bg_color' ) ) ?>" id="frm_submit_hover_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_bg_color'] ) ?>" />
103 103
         </div>
104 104
 
105 105
         <div class="field-group clearfix">
106 106
     	    <label><?php _e( 'Text', 'formidable' ) ?></label>
107
-    	    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_color') ) ?>" id="frm_submit_hover_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_color'] ) ?>" />
107
+    	    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_color' ) ) ?>" id="frm_submit_hover_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_color'] ) ?>" />
108 108
         </div>
109 109
 
110 110
         <div class="field-group clearfix">
111 111
             <label><?php _e( 'Border', 'formidable' ) ?></label>
112
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_border_color') ) ?>" id="frm_submit_hover_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_border_color'] ) ?>" />
112
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_border_color' ) ) ?>" id="frm_submit_hover_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_border_color'] ) ?>" />
113 113
         </div>
114 114
 
115 115
 	    <div class="clear"></div>
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
 	?>">
121 121
 	    <div class="field-group clearfix">
122 122
         	<label><?php _e( 'BG Color', 'formidable' ) ?></label>
123
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_bg_color') ) ?>" id="frm_submit_active_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_bg_color'] ) ?>" />
123
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_bg_color' ) ) ?>" id="frm_submit_active_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_bg_color'] ) ?>" />
124 124
         </div>
125 125
 
126 126
         <div class="field-group clearfix">
127 127
     	    <label><?php _e( 'Text', 'formidable' ) ?></label>
128
-    	    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_color') ) ?>" id="frm_submit_active_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_color'] ) ?>" />
128
+    	    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_color' ) ) ?>" id="frm_submit_active_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_color'] ) ?>" />
129 129
         </div>
130 130
 
131 131
         <div class="field-group clearfix">
132 132
             <label><?php _e( 'Border', 'formidable' ) ?></label>
133
-        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_border_color') ) ?>" id="frm_submit_active_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_border_color'] ) ?>" />
133
+        	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_border_color' ) ) ?>" id="frm_submit_active_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_border_color'] ) ?>" />
134 134
         </div>
135 135
 
136 136
 	    <div class="clear"></div>
Please login to merge, or discard this patch.
classes/controllers/FrmSettingsController.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -2,26 +2,26 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmSettingsController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		// Make sure admins can see the menu items
7 7
 		FrmAppHelper::force_capability( 'frm_change_settings' );
8 8
 
9
-        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
10
-    }
9
+		add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
10
+	}
11 11
 
12
-    public static function license_box() {
12
+	public static function license_box() {
13 13
 		$a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
14
-        include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
15
-    }
14
+		include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
15
+	}
16 16
 
17
-    public static function display_form( $errors = array(), $message = '' ) {
18
-        global $frm_vars;
17
+	public static function display_form( $errors = array(), $message = '' ) {
18
+		global $frm_vars;
19 19
 
20
-        $frm_settings = FrmAppHelper::get_settings();
21
-        $frm_roles = FrmAppHelper::frm_capabilities();
20
+		$frm_settings = FrmAppHelper::get_settings();
21
+		$frm_roles = FrmAppHelper::frm_capabilities();
22 22
 
23
-        $uploads = wp_upload_dir();
24
-        $target_path = $uploads['basedir'] . '/formidable/css';
23
+		$uploads = wp_upload_dir();
24
+		$target_path = $uploads['basedir'] . '/formidable/css';
25 25
 
26 26
 		$sections = array();
27 27
 		if ( apply_filters( 'frm_include_addon_page', false ) ) {
@@ -30,53 +30,53 @@  discard block
 block discarded – undo
30 30
 				'name' => __( 'Plugin Licenses', 'formidable' ),
31 31
 			);
32 32
 		}
33
-        $sections = apply_filters( 'frm_add_settings_section', $sections );
33
+		$sections = apply_filters( 'frm_add_settings_section', $sections );
34 34
 
35
-        $captcha_lang = FrmAppHelper::locales( 'captcha' );
35
+		$captcha_lang = FrmAppHelper::locales( 'captcha' );
36 36
 
37
-        require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' );
38
-    }
37
+		require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' );
38
+	}
39 39
 
40
-    public static function process_form( $stop_load = false ) {
41
-        global $frm_vars;
40
+	public static function process_form( $stop_load = false ) {
41
+		global $frm_vars;
42 42
 
43
-        $frm_settings = FrmAppHelper::get_settings();
43
+		$frm_settings = FrmAppHelper::get_settings();
44 44
 
45 45
 		$process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
46 46
 		if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
47
-            wp_die( $frm_settings->admin_permission );
48
-        }
47
+			wp_die( $frm_settings->admin_permission );
48
+		}
49 49
 
50
-        $errors = array();
51
-        $message = '';
50
+		$errors = array();
51
+		$message = '';
52 52
 
53
-        if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) {
54
-            //$errors = $frm_settings->validate($_POST,array());
55
-            $frm_settings->update( stripslashes_deep( $_POST ) );
53
+		if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) {
54
+			//$errors = $frm_settings->validate($_POST,array());
55
+			$frm_settings->update( stripslashes_deep( $_POST ) );
56 56
 
57
-            if ( empty( $errors ) ) {
58
-                $frm_settings->store();
59
-                $message = __( 'Settings Saved', 'formidable' );
60
-            }
61
-        } else {
62
-            $message = __( 'Settings Saved', 'formidable' );
63
-        }
57
+			if ( empty( $errors ) ) {
58
+				$frm_settings->store();
59
+				$message = __( 'Settings Saved', 'formidable' );
60
+			}
61
+		} else {
62
+			$message = __( 'Settings Saved', 'formidable' );
63
+		}
64 64
 
65 65
 		if ( $stop_load == 'stop_load' ) {
66
-            $frm_vars['settings_routed'] = true;
67
-            return;
68
-        }
66
+			$frm_vars['settings_routed'] = true;
67
+			return;
68
+		}
69 69
 
70
-        self::display_form( $errors, $message );
71
-    }
70
+		self::display_form( $errors, $message );
71
+	}
72 72
 
73
-    public static function route( $stop_load = false ) {
74
-        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
73
+	public static function route( $stop_load = false ) {
74
+		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
75 75
 		$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
76
-        if ( $action == 'process-form' ) {
76
+		if ( $action == 'process-form' ) {
77 77
 			self::process_form( $stop_load );
78
-        } else if ( $stop_load != 'stop_load' ) {
78
+		} else if ( $stop_load != 'stop_load' ) {
79 79
 			self::display_form();
80
-        }
81
-    }
80
+		}
81
+	}
82 82
 }
Please login to merge, or discard this patch.
classes/views/styles/_field-description.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <div class="field-group field-group-background clearfix frm-first-row">
2 2
 	<label><?php _e( 'Color', 'formidable' ) ?></label>
3
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('description_color') ) ?>" id="frm_description_color" class="hex" value="<?php echo esc_attr( $style->post_content['description_color'] ) ?>" />
3
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'description_color' ) ) ?>" id="frm_description_color" class="hex" value="<?php echo esc_attr( $style->post_content['description_color'] ) ?>" />
4 4
 </div>
5 5
 <div class="field-group clearfix frm-first-row">
6 6
 	<label><?php _e( 'Weight', 'formidable' ) ?></label>
7
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('description_weight') ) ?>" id="frm_description_weight">
7
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'description_weight' ) ) ?>" id="frm_description_weight">
8 8
 		<?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?>
9 9
 		<option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['description_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option>
10 10
 		<?php } ?>
@@ -12,25 +12,25 @@  discard block
 block discarded – undo
12 12
 </div>
13 13
 <div class="field-group clearfix frm-first-row">
14 14
 	<label><?php _e( 'Style', 'formidable' ) ?></label>
15
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('description_style') ) ?>" id="frm_description_style">
16
-		<option value="normal" <?php selected($style->post_content['description_style'], 'normal') ?>><?php _e( 'normal', 'formidable' ) ?></option>
17
-		<option value="italic" <?php selected($style->post_content['description_style'], 'italic') ?>><?php _e( 'italic', 'formidable' ) ?></option>
15
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'description_style' ) ) ?>" id="frm_description_style">
16
+		<option value="normal" <?php selected( $style->post_content['description_style'], 'normal' ) ?>><?php _e( 'normal', 'formidable' ) ?></option>
17
+		<option value="italic" <?php selected( $style->post_content['description_style'], 'italic' ) ?>><?php _e( 'italic', 'formidable' ) ?></option>
18 18
 	</select>
19 19
 </div>
20 20
 
21 21
 <div class="field-group clearfix">
22 22
 	<label><?php _e( 'Size', 'formidable' ) ?></label>
23
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('description_font_size') ) ?>" id="frm_description_font_size" value="<?php echo esc_attr( $style->post_content['description_font_size'] ) ?>"  size="3" />
23
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'description_font_size' ) ) ?>" id="frm_description_font_size" value="<?php echo esc_attr( $style->post_content['description_font_size'] ) ?>"  size="3" />
24 24
 </div>
25 25
 <div class="field-group clearfix">
26 26
 	<label><?php _e( 'Align', 'formidable' ) ?></label>
27
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('description_align') ) ?>" id="frm_description_align">
28
-		<option value="left" <?php selected($style->post_content['description_align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option>
29
-		<option value="right" <?php selected($style->post_content['description_align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option>
27
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'description_align' ) ) ?>" id="frm_description_align">
28
+		<option value="left" <?php selected( $style->post_content['description_align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option>
29
+		<option value="right" <?php selected( $style->post_content['description_align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option>
30 30
 	</select>
31 31
 </div>
32 32
 <div class="field-group clearfix">
33 33
 	<label><?php _e( 'Margin', 'formidable' ) ?></label>
34
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('description_margin') ) ?>" id="frm_description_margin" value="<?php echo esc_attr( $style->post_content['description_margin'] ) ?>"  size="3" />
34
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'description_margin' ) ) ?>" id="frm_description_margin" value="<?php echo esc_attr( $style->post_content['description_margin'] ) ?>"  size="3" />
35 35
 </div>
36 36
 <div class="clear"></div>
Please login to merge, or discard this patch.
classes/models/FrmDb.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -308,7 +308,7 @@
 block discarded – undo
308 308
 	 *
309 309
 	 * @since 2.02.05
310 310
 	 * @param string $key
311
-	 * @param int|string $value
311
+	 * @param string $value
312 312
 	 * @param string $where
313 313
 	 */
314 314
     private static function add_query_placeholder( $key, $value, &$where ) {
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
     var $entry_metas;
8 8
 
9 9
     public function __construct() {
10
-        if ( ! defined('ABSPATH') ) {
11
-            die('You are not allowed to call this page directly.');
10
+        if ( ! defined( 'ABSPATH' ) ) {
11
+            die( 'You are not allowed to call this page directly.' );
12 12
         }
13 13
 
14 14
         global $wpdb;
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         $frm_db_version = FrmAppHelper::$db_version;
25 25
         $old_db_version = (float) $old_db_version;
26 26
         if ( ! $old_db_version ) {
27
-            $old_db_version = get_option('frm_db_version');
27
+            $old_db_version = get_option( 'frm_db_version' );
28 28
         }
29 29
 
30 30
         if ( $frm_db_version != $old_db_version ) {
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
 			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
35 35
 
36 36
             $this->create_tables();
37
-            $this->migrate_data($frm_db_version, $old_db_version);
37
+            $this->migrate_data( $frm_db_version, $old_db_version );
38 38
 
39 39
             /***** SAVE DB VERSION *****/
40
-            update_option('frm_db_version', $frm_db_version);
40
+            update_option( 'frm_db_version', $frm_db_version );
41 41
 
42 42
             /**** ADD/UPDATE DEFAULT TEMPLATES ****/
43 43
             FrmXMLController::add_default_templates();
44 44
         }
45 45
 
46
-        do_action('frm_after_install');
46
+        do_action( 'frm_after_install' );
47 47
 
48 48
         /**** update the styling settings ****/
49 49
 		if ( is_admin() && function_exists( 'get_filesystem_method' ) ) {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 				global $wpdb;
154 154
 				$wpdb->query( $q . $charset_collate );
155 155
 			}
156
-            unset($q);
156
+            unset( $q );
157 157
         }
158 158
     }
159 159
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 * @param string $starts_with
179 179
      */
180 180
     public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) {
181
-        if ( empty($args) ) {
181
+        if ( empty( $args ) ) {
182 182
 			// add an arg to prevent prepare from failing
183 183
 			$args = array( 'where' => $starts_with . '1=%d', 'values' => array( 1 ) );
184 184
 			return;
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
     private static function interpret_array_to_sql( $key, $value, &$where, &$values ) {
239 239
 		$key = trim( $key );
240 240
 
241
-        if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false  ) {
242
-            $k = explode(' ', $key);
241
+        if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) {
242
+            $k = explode( ' ', $key );
243 243
             $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key );
244 244
             $values[] = '%Y-%m-%d %H:%i:%s';
245 245
         } else {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         if ( is_array( $value ) ) {
253 253
             // translate array of values to "in"
254 254
 			if ( strpos( $lowercase_key, 'like' ) !== false ) {
255
-				$where = preg_replace('/' . $key . '$/', '', $where);
255
+				$where = preg_replace( '/' . $key . '$/', '', $where );
256 256
 				$where .= '(';
257 257
 				$start = true;
258 258
 				foreach ( $value as $v ) {
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
 		);
404 404
 
405 405
 		$where_is = strtolower( $where_is );
406
-		if ( isset( $switch_to[ $where_is ] ) ) {
407
-			return ' ' . $switch_to[ $where_is ];
406
+		if ( isset( $switch_to[$where_is] ) ) {
407
+			return ' ' . $switch_to[$where_is];
408 408
 		}
409 409
 
410 410
 		// > and < need a little more work since we don't want them switched to >= and <=
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
     private static function get_group_and_table_name( &$table, &$group ) {
427 427
 		global $wpdb, $wpmuBaseTablePrefix;
428 428
 
429
-        $table_parts = explode(' ', $table);
430
-        $group = reset($table_parts);
429
+        $table_parts = explode( ' ', $table );
430
+        $group = reset( $table_parts );
431 431
         $group = str_replace( $wpdb->prefix, '', $group );
432 432
 
433 433
 		$prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix : $wpdb->base_prefix;
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
     }
443 443
 
444 444
     private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) {
445
-        if ( ! is_array($args) ) {
445
+        if ( ! is_array( $args ) ) {
446 446
 			$args = array( 'order_by' => $args );
447 447
         }
448 448
 
@@ -457,16 +457,16 @@  discard block
 block discarded – undo
457 457
         $temp_args = $args;
458 458
         foreach ( $temp_args as $k => $v ) {
459 459
             if ( $v == '' ) {
460
-				unset( $args[ $k ] );
460
+				unset( $args[$k] );
461 461
                 continue;
462 462
             }
463 463
 
464 464
             if ( $k == 'limit' ) {
465
-				$args[ $k ] = FrmAppHelper::esc_limit( $v );
465
+				$args[$k] = FrmAppHelper::esc_limit( $v );
466 466
             }
467 467
             $db_name = strtoupper( str_replace( '_', ' ', $k ) );
468 468
             if ( strpos( $v, $db_name ) === false ) {
469
-				$args[ $k ] = $db_name . ' ' . $v;
469
+				$args[$k] = $db_name . ' ' . $v;
470 470
             }
471 471
         }
472 472
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 
494 494
 		$query = self::generate_query_string_from_pieces( $columns, $table, $where );
495 495
 
496
-		$cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . $columns . '_results_ARRAY_A' , ' WHERE' ) );
496
+		$cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . $columns . '_results_ARRAY_A', ' WHERE' ) );
497 497
 		$results = FrmAppHelper::check_cache( $cache_key, $group, $query, 'get_associative_results' );
498 498
 
499 499
 		return $results;
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
     public function uninstall() {
533 533
 		if ( ! current_user_can( 'administrator' ) ) {
534 534
             $frm_settings = FrmAppHelper::get_settings();
535
-            wp_die($frm_settings->admin_permission);
535
+            wp_die( $frm_settings->admin_permission );
536 536
         }
537 537
 
538 538
         global $wpdb, $wp_roles;
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries );
543 543
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas );
544 544
 
545
-        delete_option('frm_options');
546
-        delete_option('frm_db_version');
545
+        delete_option( 'frm_options' );
546
+        delete_option( 'frm_db_version' );
547 547
 
548 548
         //delete roles
549 549
         $frm_roles = FrmAppHelper::frm_capabilities();
@@ -551,11 +551,11 @@  discard block
 block discarded – undo
551 551
         foreach ( $frm_roles as $frm_role => $frm_role_description ) {
552 552
             foreach ( $roles as $role => $details ) {
553 553
                 $wp_roles->remove_cap( $role, $frm_role );
554
-                unset($role, $details);
554
+                unset( $role, $details );
555 555
     		}
556
-    		unset($frm_role, $frm_role_description);
556
+    		unset( $frm_role, $frm_role_description );
557 557
 		}
558
-		unset($roles, $frm_roles);
558
+		unset( $roles, $frm_roles );
559 559
 
560 560
 		// delete actions, views, and styles
561 561
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 
578 578
 		$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_%', '_transient_frm_form_fields_%' ) );
579 579
 
580
-        do_action('frm_after_uninstall');
580
+        do_action( 'frm_after_uninstall' );
581 581
         return true;
582 582
     }
583 583
 
@@ -634,8 +634,8 @@  discard block
 block discarded – undo
634 634
 
635 635
         $updated = 0;
636 636
         foreach ( $fields as $f ) {
637
-            $f->field_options = maybe_unserialize($f->field_options);
638
-            if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) {
637
+            $f->field_options = maybe_unserialize( $f->field_options );
638
+            if ( empty( $f->field_options['size'] ) || ! is_numeric( $f->field_options['size'] ) ) {
639 639
                 continue;
640 640
             }
641 641
 
@@ -643,27 +643,27 @@  discard block
 block discarded – undo
643 643
             $f->field_options['size'] .= 'px';
644 644
             $u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
645 645
             if ( $u ) {
646
-                $updated++;
646
+                $updated ++;
647 647
             }
648
-            unset($f);
648
+            unset( $f );
649 649
         }
650 650
 
651 651
         // Change the characters in widgets to pixels
652
-        $widgets = get_option('widget_frm_show_form');
653
-        if ( empty($widgets) ) {
652
+        $widgets = get_option( 'widget_frm_show_form' );
653
+        if ( empty( $widgets ) ) {
654 654
             return;
655 655
         }
656 656
 
657
-        $widgets = maybe_unserialize($widgets);
657
+        $widgets = maybe_unserialize( $widgets );
658 658
         foreach ( $widgets as $k => $widget ) {
659
-            if ( ! is_array($widget) || ! isset($widget['size']) ) {
659
+            if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) {
660 660
                 continue;
661 661
             }
662 662
 			$size = round( $pixel_conversion * (int) $widget['size'] );
663 663
             $size .= 'px';
664
-			$widgets[ $k ]['size'] = $size;
664
+			$widgets[$k]['size'] = $size;
665 665
         }
666
-        update_option('widget_frm_show_form', $widgets);
666
+        update_option( 'widget_frm_show_form', $widgets );
667 667
     }
668 668
 
669 669
     /**
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 			}
713 713
 
714 714
             // Format form options
715
-            $form_options = maybe_unserialize($form->options);
715
+            $form_options = maybe_unserialize( $form->options );
716 716
 
717 717
             // Migrate settings to actions
718 718
             FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
     private function migrate_to_11() {
723 723
         global $wpdb;
724 724
 
725
-        $forms = FrmDb::get_results( $this->forms, array(), 'id, options');
725
+        $forms = FrmDb::get_results( $this->forms, array(), 'id, options' );
726 726
 
727 727
         $sending = __( 'Sending', 'formidable' );
728 728
 		$img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
@@ -733,13 +733,13 @@  discard block
 block discarded – undo
733 733
 <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" />
734 734
 </div>
735 735
 DEFAULT_HTML;
736
-        unset($sending, $img);
736
+        unset( $sending, $img );
737 737
 
738
-        $new_default_html = FrmFormsHelper::get_default_html('submit');
738
+        $new_default_html = FrmFormsHelper::get_default_html( 'submit' );
739 739
         $draft_link = FrmFormsHelper::get_draft_link();
740 740
 		foreach ( $forms as $form ) {
741
-            $form->options = maybe_unserialize($form->options);
742
-            if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
741
+            $form->options = maybe_unserialize( $form->options );
742
+            if ( ! isset( $form->options['submit_html'] ) || empty( $form->options['submit_html'] ) ) {
743 743
                 continue;
744 744
             }
745 745
 
@@ -750,9 +750,9 @@  discard block
 block discarded – undo
750 750
 				$form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] );
751 751
 				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
752 752
             }
753
-            unset($form);
753
+            unset( $form );
754 754
         }
755
-        unset($forms);
755
+        unset( $forms );
756 756
     }
757 757
 
758 758
     private function migrate_to_6() {
@@ -781,16 +781,16 @@  discard block
 block discarded – undo
781 781
 </div>
782 782
 DEFAULT_HTML;
783 783
 
784
-        $new_default_html = FrmFieldsHelper::get_default_html('text');
784
+        $new_default_html = FrmFieldsHelper::get_default_html( 'text' );
785 785
         foreach ( $fields as $field ) {
786
-            $field->field_options = maybe_unserialize($field->field_options);
786
+            $field->field_options = maybe_unserialize( $field->field_options );
787 787
 			if ( ! FrmField::is_option_empty( $field, 'custom_html' ) || $field->field_options['custom_html'] == $default_html || $field->field_options['custom_html'] == $old_default_html ) {
788 788
                 $field->field_options['custom_html'] = $new_default_html;
789 789
 				$wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) );
790 790
             }
791
-            unset($field);
791
+            unset( $field );
792 792
         }
793
-        unset($default_html, $old_default_html, $fields);
793
+        unset( $default_html, $old_default_html, $fields );
794 794
     }
795 795
 
796 796
     private function migrate_to_4() {
@@ -808,6 +808,6 @@  discard block
 block discarded – undo
808 808
 
809 809
 	public static function get_records( $table, $args = array(), $order_by = '', $limit = '', $fields = '*' ) {
810 810
 		_deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_results' );
811
-		return self::get_results( $table, $args, $fields, compact('order_by', 'limit') );
811
+		return self::get_results( $table, $args, $fields, compact( 'order_by', 'limit' ) );
812 812
 	}
813 813
 }
Please login to merge, or discard this patch.
Indentation   +340 added lines, -340 removed lines patch added patch discarded remove patch
@@ -1,66 +1,66 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmDb {
4
-    var $fields;
5
-    var $forms;
6
-    var $entries;
7
-    var $entry_metas;
8
-
9
-    public function __construct() {
10
-        if ( ! defined('ABSPATH') ) {
11
-            die('You are not allowed to call this page directly.');
12
-        }
13
-
14
-        global $wpdb;
15
-        $this->fields         = $wpdb->prefix . 'frm_fields';
16
-        $this->forms          = $wpdb->prefix . 'frm_forms';
17
-        $this->entries        = $wpdb->prefix . 'frm_items';
18
-        $this->entry_metas    = $wpdb->prefix . 'frm_item_metas';
19
-    }
20
-
21
-    public function upgrade( $old_db_version = false ) {
22
-	    do_action( 'frm_before_install' );
23
-
24
-        global $wpdb;
25
-        //$frm_db_version is the version of the database we're moving to
26
-        $frm_db_version = FrmAppHelper::$db_version;
27
-        $old_db_version = (float) $old_db_version;
28
-        if ( ! $old_db_version ) {
29
-            $old_db_version = get_option('frm_db_version');
30
-        }
31
-
32
-        if ( $frm_db_version != $old_db_version ) {
4
+	var $fields;
5
+	var $forms;
6
+	var $entries;
7
+	var $entry_metas;
8
+
9
+	public function __construct() {
10
+		if ( ! defined('ABSPATH') ) {
11
+			die('You are not allowed to call this page directly.');
12
+		}
13
+
14
+		global $wpdb;
15
+		$this->fields         = $wpdb->prefix . 'frm_fields';
16
+		$this->forms          = $wpdb->prefix . 'frm_forms';
17
+		$this->entries        = $wpdb->prefix . 'frm_items';
18
+		$this->entry_metas    = $wpdb->prefix . 'frm_item_metas';
19
+	}
20
+
21
+	public function upgrade( $old_db_version = false ) {
22
+		do_action( 'frm_before_install' );
23
+
24
+		global $wpdb;
25
+		//$frm_db_version is the version of the database we're moving to
26
+		$frm_db_version = FrmAppHelper::$db_version;
27
+		$old_db_version = (float) $old_db_version;
28
+		if ( ! $old_db_version ) {
29
+			$old_db_version = get_option('frm_db_version');
30
+		}
31
+
32
+		if ( $frm_db_version != $old_db_version ) {
33 33
 			// update rewrite rules for views and other custom post types
34 34
 			flush_rewrite_rules();
35 35
 
36 36
 			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
37 37
 
38
-            $this->create_tables();
39
-            $this->migrate_data($frm_db_version, $old_db_version);
38
+			$this->create_tables();
39
+			$this->migrate_data($frm_db_version, $old_db_version);
40 40
 
41
-            /***** SAVE DB VERSION *****/
42
-            update_option('frm_db_version', $frm_db_version);
41
+			/***** SAVE DB VERSION *****/
42
+			update_option('frm_db_version', $frm_db_version);
43 43
 
44
-            /**** ADD/UPDATE DEFAULT TEMPLATES ****/
45
-            FrmXMLController::add_default_templates();
46
-        }
44
+			/**** ADD/UPDATE DEFAULT TEMPLATES ****/
45
+			FrmXMLController::add_default_templates();
46
+		}
47 47
 
48
-        do_action('frm_after_install');
48
+		do_action('frm_after_install');
49 49
 
50
-        /**** update the styling settings ****/
50
+		/**** update the styling settings ****/
51 51
 		if ( is_admin() && function_exists( 'get_filesystem_method' ) ) {
52 52
 			$frm_style = new FrmStyle();
53 53
 			$frm_style->update( 'default' );
54 54
 		}
55
-    }
55
+	}
56 56
 
57
-    public function collation() {
58
-        global $wpdb;
59
-        if ( ! $wpdb->has_cap( 'collation' ) ) {
60
-            return '';
61
-        }
57
+	public function collation() {
58
+		global $wpdb;
59
+		if ( ! $wpdb->has_cap( 'collation' ) ) {
60
+			return '';
61
+		}
62 62
 
63
-        $charset_collate = '';
63
+		$charset_collate = '';
64 64
 		if ( ! empty( $wpdb->charset ) ) {
65 65
 			$charset_collate .= ' DEFAULT CHARACTER SET ' . $wpdb->charset;
66 66
 		}
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 			$charset_collate .= ' COLLATE ' . $wpdb->collate;
70 70
 		}
71 71
 
72
-        return $charset_collate;
73
-    }
72
+		return $charset_collate;
73
+	}
74 74
 
75
-    private function create_tables() {
76
-        $charset_collate = $this->collation();
77
-        $sql = array();
75
+	private function create_tables() {
76
+		$charset_collate = $this->collation();
77
+		$sql = array();
78 78
 
79
-        /* Create/Upgrade Fields Table */
79
+		/* Create/Upgrade Fields Table */
80 80
 		$sql[] = 'CREATE TABLE ' . $this->fields . ' (
81 81
                 id int(11) NOT NULL auto_increment,
82 82
 				field_key varchar(100) default NULL,
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                 UNIQUE KEY field_key (field_key)
96 96
         )';
97 97
 
98
-        /* Create/Upgrade Forms Table */
98
+		/* Create/Upgrade Forms Table */
99 99
 		$sql[] = 'CREATE TABLE ' . $this->forms . ' (
100 100
                 id int(11) NOT NULL auto_increment,
101 101
 				form_key varchar(100) default NULL,
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                 UNIQUE KEY form_key (form_key)
114 114
         )';
115 115
 
116
-        /* Create/Upgrade Items Table */
116
+		/* Create/Upgrade Items Table */
117 117
 		$sql[] = 'CREATE TABLE ' . $this->entries . ' (
118 118
                 id int(11) NOT NULL auto_increment,
119 119
 				item_key varchar(100) default NULL,
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
                 UNIQUE KEY item_key (item_key)
137 137
         )';
138 138
 
139
-        /* Create/Upgrade Meta Table */
139
+		/* Create/Upgrade Meta Table */
140 140
 		$sql[] = 'CREATE TABLE ' . $this->entry_metas . ' (
141 141
                 id int(11) NOT NULL auto_increment,
142 142
                 meta_value longtext default NULL,
@@ -148,43 +148,43 @@  discard block
 block discarded – undo
148 148
                 KEY item_id (item_id)
149 149
         )';
150 150
 
151
-        foreach ( $sql as $q ) {
151
+		foreach ( $sql as $q ) {
152 152
 			if ( function_exists( 'dbDelta' ) ) {
153 153
 				dbDelta( $q . $charset_collate . ';' );
154 154
 			} else {
155 155
 				global $wpdb;
156 156
 				$wpdb->query( $q . $charset_collate );
157 157
 			}
158
-            unset($q);
159
-        }
160
-    }
158
+			unset($q);
159
+		}
160
+	}
161 161
 
162
-    /**
163
-     * @param integer $frm_db_version
162
+	/**
163
+	 * @param integer $frm_db_version
164 164
 	 * @param int $old_db_version
165
-     */
165
+	 */
166 166
 	private function migrate_data( $frm_db_version, $old_db_version ) {
167 167
 		$migrations = array( 4, 6, 11, 16, 17, 23, 25 );
168
-        foreach ( $migrations as $migration ) {
169
-            if ( $frm_db_version >= $migration && $old_db_version < $migration ) {
168
+		foreach ( $migrations as $migration ) {
169
+			if ( $frm_db_version >= $migration && $old_db_version < $migration ) {
170 170
 				$function_name = 'migrate_to_' . $migration;
171
-                $this->$function_name();
172
-            }
173
-        }
174
-    }
171
+				$this->$function_name();
172
+			}
173
+		}
174
+	}
175 175
 
176
-    /**
177
-     * Change array into format $wpdb->prepare can use
176
+	/**
177
+	 * Change array into format $wpdb->prepare can use
178 178
 	 *
179 179
 	 * @param array $args
180 180
 	 * @param string $starts_with
181
-     */
182
-    public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) {
183
-        if ( empty($args) ) {
181
+	 */
182
+	public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) {
183
+		if ( empty($args) ) {
184 184
 			// add an arg to prevent prepare from failing
185 185
 			$args = array( 'where' => $starts_with . '1=%d', 'values' => array( 1 ) );
186 186
 			return;
187
-        }
187
+		}
188 188
 
189 189
 		$where = '';
190 190
 		$values = array();
@@ -195,64 +195,64 @@  discard block
 block discarded – undo
195 195
 		}
196 196
 
197 197
 		$args = compact( 'where', 'values' );
198
-    }
198
+	}
199 199
 
200
-    /**
200
+	/**
201 201
 	 * @param array $args
202
-     * @param string $base_where
203
-     * @param string $where
202
+	 * @param string $base_where
203
+	 * @param string $where
204 204
 	 * @param array $values
205
-     */
206
-    public static function parse_where_from_array( $args, $base_where, &$where, &$values ) {
207
-        $condition = ' AND';
208
-        if ( isset( $args['or'] ) ) {
209
-            $condition = ' OR';
210
-            unset( $args['or'] );
211
-        }
212
-
213
-        foreach ( $args as $key => $value ) {
214
-            $where .= empty( $where ) ? $base_where : $condition;
215
-            $array_inc_null = ( ! is_numeric( $key ) && is_array( $value ) && in_array( null, $value ) );
216
-            if ( is_numeric( $key ) || $array_inc_null ) {
217
-                $where .= ' ( ';
218
-                $nested_where = '';
219
-                if ( $array_inc_null ) {
220
-                    foreach ( $value as $val ) {
221
-                        self::parse_where_from_array( array( $key => $val, 'or' => 1 ), '', $nested_where, $values );
222
-                    }
223
-                } else {
224
-                    self::parse_where_from_array( $value, '', $nested_where, $values );
225
-                }
226
-                $where .= $nested_where;
227
-                $where .= ' ) ';
228
-            } else {
229
-                self::interpret_array_to_sql( $key, $value, $where, $values );
230
-            }
231
-        }
232
-    }
233
-
234
-    /**
235
-     * @param string $key
205
+	 */
206
+	public static function parse_where_from_array( $args, $base_where, &$where, &$values ) {
207
+		$condition = ' AND';
208
+		if ( isset( $args['or'] ) ) {
209
+			$condition = ' OR';
210
+			unset( $args['or'] );
211
+		}
212
+
213
+		foreach ( $args as $key => $value ) {
214
+			$where .= empty( $where ) ? $base_where : $condition;
215
+			$array_inc_null = ( ! is_numeric( $key ) && is_array( $value ) && in_array( null, $value ) );
216
+			if ( is_numeric( $key ) || $array_inc_null ) {
217
+				$where .= ' ( ';
218
+				$nested_where = '';
219
+				if ( $array_inc_null ) {
220
+					foreach ( $value as $val ) {
221
+						self::parse_where_from_array( array( $key => $val, 'or' => 1 ), '', $nested_where, $values );
222
+					}
223
+				} else {
224
+					self::parse_where_from_array( $value, '', $nested_where, $values );
225
+				}
226
+				$where .= $nested_where;
227
+				$where .= ' ) ';
228
+			} else {
229
+				self::interpret_array_to_sql( $key, $value, $where, $values );
230
+			}
231
+		}
232
+	}
233
+
234
+	/**
235
+	 * @param string $key
236 236
 	 * @param string|array $value
237
-     * @param string $where
237
+	 * @param string $where
238 238
 	 * @param array $values
239
-     */
240
-    private static function interpret_array_to_sql( $key, $value, &$where, &$values ) {
239
+	 */
240
+	private static function interpret_array_to_sql( $key, $value, &$where, &$values ) {
241 241
 		$key = trim( $key );
242 242
 
243
-        if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false  ) {
244
-            $k = explode(' ', $key);
245
-            $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key );
246
-            $values[] = '%Y-%m-%d %H:%i:%s';
247
-        } else {
243
+		if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false  ) {
244
+			$k = explode(' ', $key);
245
+			$where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key );
246
+			$values[] = '%Y-%m-%d %H:%i:%s';
247
+		} else {
248 248
 			$where .= ' ' . $key;
249
-        }
249
+		}
250 250
 
251 251
 		$lowercase_key = explode( ' ', strtolower( $key ) );
252 252
 		$lowercase_key = end( $lowercase_key );
253 253
 
254
-        if ( is_array( $value ) ) {
255
-            // translate array of values to "in"
254
+		if ( is_array( $value ) ) {
255
+			// translate array of values to "in"
256 256
 			if ( strpos( $lowercase_key, 'like' ) !== false ) {
257 257
 				$where = preg_replace('/' . $key . '$/', '', $where);
258 258
 				$where .= '(';
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 				$where .= ' in (' . FrmAppHelper::prepare_array_values( $value, '%s' ) . ')';
271 271
 				$values = array_merge( $values, $value );
272 272
 			}
273
-        } else if ( strpos( $lowercase_key, 'like' ) !== false ) {
273
+		} else if ( strpos( $lowercase_key, 'like' ) !== false ) {
274 274
 			/**
275 275
 			 * Allow string to start or end with the value
276 276
 			 * If the key is like% then skip the first % for starts with
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
 			$where .= ' %s';
290 290
 			$values[] = $start . FrmAppHelper::esc_like( $value ) . $end;
291 291
 
292
-        } else if ( $value === null ) {
293
-            $where .= ' IS NULL';
294
-        } else {
292
+		} else if ( $value === null ) {
293
+			$where .= ' IS NULL';
294
+		} else {
295 295
 			// allow a - to prevent = from being added
296 296
 			if ( substr( $key, -1 ) == '-' ) {
297 297
 				$where = rtrim( $where, '-' );
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 
302 302
 			self::add_query_placeholder( $key, $value, $where );
303 303
 
304
-            $values[] = $value;
305
-        }
306
-    }
304
+			$values[] = $value;
305
+		}
306
+	}
307 307
 
308 308
 	/**
309 309
 	 * Add %d, or %s to query
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 * @param int|string $value
314 314
 	 * @param string $where
315 315
 	 */
316
-    private static function add_query_placeholder( $key, $value, &$where ) {
316
+	private static function add_query_placeholder( $key, $value, &$where ) {
317 317
 		if ( is_numeric( $value ) && strpos( $key, 'meta_value' ) === false ) {
318 318
 			$where .= '%d';
319 319
 		} else {
@@ -321,16 +321,16 @@  discard block
 block discarded – undo
321 321
 		}
322 322
 	}
323 323
 
324
-    /**
325
-     * @param string $table
324
+	/**
325
+	 * @param string $table
326 326
 	 * @param array $where
327 327
 	 * @param array $args
328 328
 	 * @return int
329
-     */
330
-    public static function get_count( $table, $where = array(), $args = array() ) {
331
-        $count = self::get_var( $table, $where, 'COUNT(*)', $args );
332
-        return $count;
333
-    }
329
+	 */
330
+	public static function get_count( $table, $where = array(), $args = array() ) {
331
+		$count = self::get_var( $table, $where, 'COUNT(*)', $args );
332
+		return $count;
333
+	}
334 334
 
335 335
 	/**
336 336
 	 * @param string $table
@@ -341,56 +341,56 @@  discard block
 block discarded – undo
341 341
 	 * @param string $type
342 342
 	 * @return array|null|string|object
343 343
 	 */
344
-    public static function get_var( $table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var' ) {
345
-        $group = '';
346
-        self::get_group_and_table_name( $table, $group );
344
+	public static function get_var( $table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var' ) {
345
+		$group = '';
346
+		self::get_group_and_table_name( $table, $group );
347 347
 		self::convert_options_to_array( $args, '', $limit );
348 348
 
349 349
 		$query = self::generate_query_string_from_pieces( $field, $table, $where, $args );
350 350
 
351 351
 		$cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . implode( '_', $args ) . $field . '_' . $type, ' WHERE' ) );
352 352
 		$results = FrmAppHelper::check_cache( $cache_key, $group, $query, 'get_' . $type );
353
-        return $results;
354
-    }
353
+		return $results;
354
+	}
355 355
 
356
-    /**
357
-     * @param string $table
358
-     * @param array $where
356
+	/**
357
+	 * @param string $table
358
+	 * @param array $where
359 359
 	 * @param string $field
360 360
 	 * @param array $args
361 361
 	 * @param string $limit
362 362
 	 * @return mixed
363
-     */
364
-    public static function get_col( $table, $where = array(), $field = 'id', $args = array(), $limit = '' ) {
365
-        return self::get_var( $table, $where, $field, $args, $limit, 'col' );
366
-    }
367
-
368
-    /**
369
-     * @since 2.0
370
-     * @param string $table
363
+	 */
364
+	public static function get_col( $table, $where = array(), $field = 'id', $args = array(), $limit = '' ) {
365
+		return self::get_var( $table, $where, $field, $args, $limit, 'col' );
366
+	}
367
+
368
+	/**
369
+	 * @since 2.0
370
+	 * @param string $table
371 371
 	 * @param array $where
372 372
 	 * @param string $fields
373 373
 	 * @param array $args
374 374
 	 * @return mixed
375
-     */
376
-    public static function get_row( $table, $where = array(), $fields = '*', $args = array() ) {
377
-        $args['limit'] = 1;
378
-        return self::get_var( $table, $where, $fields, $args, '', 'row' );
379
-    }
380
-
381
-    /**
382
-     * Prepare a key/value array before DB call
375
+	 */
376
+	public static function get_row( $table, $where = array(), $fields = '*', $args = array() ) {
377
+		$args['limit'] = 1;
378
+		return self::get_var( $table, $where, $fields, $args, '', 'row' );
379
+	}
380
+
381
+	/**
382
+	 * Prepare a key/value array before DB call
383 383
 	 *
384
-     * @since 2.0
385
-     * @param string $table
384
+	 * @since 2.0
385
+	 * @param string $table
386 386
 	 * @param array $where
387 387
 	 * @param string $fields
388 388
 	 * @param array $args
389 389
 	 * @return mixed
390
-     */
391
-    public static function get_results( $table, $where = array(), $fields = '*', $args = array() ) {
392
-        return self::get_var( $table, $where, $fields, $args, '', 'results' );
393
-    }
390
+	 */
391
+	public static function get_results( $table, $where = array(), $fields = '*', $args = array() ) {
392
+		return self::get_var( $table, $where, $fields, $args, '', 'results' );
393
+	}
394 394
 
395 395
 	/**
396 396
 	 * Check for like, not like, in, not in, =, !=, >, <, <=, >=
@@ -427,59 +427,59 @@  discard block
 block discarded – undo
427 427
 		return '';
428 428
 	}
429 429
 
430
-    /**
431
-     * Get 'frm_forms' from wp_frm_forms or a longer table param that includes a join
432
-     * Also add the wpdb->prefix to the table if it's missing
433
-     *
434
-     * @param string $table
435
-     * @param string $group
436
-     */
437
-    private static function get_group_and_table_name( &$table, &$group ) {
430
+	/**
431
+	 * Get 'frm_forms' from wp_frm_forms or a longer table param that includes a join
432
+	 * Also add the wpdb->prefix to the table if it's missing
433
+	 *
434
+	 * @param string $table
435
+	 * @param string $group
436
+	 */
437
+	private static function get_group_and_table_name( &$table, &$group ) {
438 438
 		global $wpdb, $wpmuBaseTablePrefix;
439 439
 
440
-        $table_parts = explode(' ', $table);
441
-        $group = reset($table_parts);
442
-        $group = str_replace( $wpdb->prefix, '', $group );
440
+		$table_parts = explode(' ', $table);
441
+		$group = reset($table_parts);
442
+		$group = str_replace( $wpdb->prefix, '', $group );
443 443
 
444 444
 		$prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix : $wpdb->base_prefix;
445 445
 		$group = str_replace( $prefix, '', $group );
446 446
 
447
-        if ( $group == $table ) {
448
-            $table = $wpdb->prefix . $table;
449
-        }
447
+		if ( $group == $table ) {
448
+			$table = $wpdb->prefix . $table;
449
+		}
450 450
 
451 451
 		// switch to singular group name
452 452
 		$group = rtrim( $group, 's' );
453
-    }
453
+	}
454 454
 
455
-    private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) {
456
-        if ( ! is_array($args) ) {
455
+	private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) {
456
+		if ( ! is_array($args) ) {
457 457
 			$args = array( 'order_by' => $args );
458
-        }
458
+		}
459 459
 
460
-        if ( ! empty( $order_by ) ) {
461
-            $args['order_by'] = $order_by;
462
-        }
460
+		if ( ! empty( $order_by ) ) {
461
+			$args['order_by'] = $order_by;
462
+		}
463 463
 
464
-        if ( ! empty( $limit ) ) {
465
-            $args['limit'] = $limit;
466
-        }
464
+		if ( ! empty( $limit ) ) {
465
+			$args['limit'] = $limit;
466
+		}
467 467
 
468
-        $temp_args = $args;
469
-        foreach ( $temp_args as $k => $v ) {
470
-            if ( $v == '' ) {
468
+		$temp_args = $args;
469
+		foreach ( $temp_args as $k => $v ) {
470
+			if ( $v == '' ) {
471 471
 				unset( $args[ $k ] );
472
-                continue;
473
-            }
472
+				continue;
473
+			}
474 474
 
475
-            if ( $k == 'limit' ) {
475
+			if ( $k == 'limit' ) {
476 476
 				$args[ $k ] = FrmAppHelper::esc_limit( $v );
477
-            }
478
-            $db_name = strtoupper( str_replace( '_', ' ', $k ) );
479
-            if ( strpos( $v, $db_name ) === false ) {
477
+			}
478
+			$db_name = strtoupper( str_replace( '_', ' ', $k ) );
479
+			if ( strpos( $v, $db_name ) === false ) {
480 480
 				$args[ $k ] = $db_name . ' ' . $v;
481
-            }
482
-        }
481
+			}
482
+		}
483 483
 
484 484
 		// Make sure LIMIT is the last argument
485 485
 		if ( isset( $args['order_by'] ) && isset( $args['limit'] ) ) {
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 			unset( $args['limit'] );
488 488
 			$args['limit'] = $temp_limit;
489 489
 		}
490
-    }
490
+	}
491 491
 
492 492
 	/**
493 493
 	 * Get the associative array results for the given columns, table, and where query
@@ -540,31 +540,31 @@  discard block
 block discarded – undo
540 540
 		return $query;
541 541
 	}
542 542
 
543
-    public function uninstall() {
543
+	public function uninstall() {
544 544
 		if ( ! current_user_can( 'administrator' ) ) {
545
-            $frm_settings = FrmAppHelper::get_settings();
546
-            wp_die($frm_settings->admin_permission);
547
-        }
545
+			$frm_settings = FrmAppHelper::get_settings();
546
+			wp_die($frm_settings->admin_permission);
547
+		}
548 548
 
549
-        global $wpdb, $wp_roles;
549
+		global $wpdb, $wp_roles;
550 550
 
551 551
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->fields );
552 552
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->forms );
553 553
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries );
554 554
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas );
555 555
 
556
-        delete_option('frm_options');
557
-        delete_option('frm_db_version');
556
+		delete_option('frm_options');
557
+		delete_option('frm_db_version');
558 558
 
559
-        //delete roles
560
-        $frm_roles = FrmAppHelper::frm_capabilities();
561
-        $roles = get_editable_roles();
562
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
563
-            foreach ( $roles as $role => $details ) {
564
-                $wp_roles->remove_cap( $role, $frm_role );
565
-                unset($role, $details);
566
-    		}
567
-    		unset($frm_role, $frm_role_description);
559
+		//delete roles
560
+		$frm_roles = FrmAppHelper::frm_capabilities();
561
+		$roles = get_editable_roles();
562
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
563
+			foreach ( $roles as $role => $details ) {
564
+				$wp_roles->remove_cap( $role, $frm_role );
565
+				unset($role, $details);
566
+			}
567
+			unset($frm_role, $frm_role_description);
568 568
 		}
569 569
 		unset($roles, $frm_roles);
570 570
 
@@ -588,9 +588,9 @@  discard block
 block discarded – undo
588 588
 
589 589
 		$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_%', '_transient_frm_form_fields_%' ) );
590 590
 
591
-        do_action('frm_after_uninstall');
592
-        return true;
593
-    }
591
+		do_action('frm_after_uninstall');
592
+		return true;
593
+	}
594 594
 
595 595
 	/**
596 596
 	 * Migrate old styling settings. If sites are using the old
@@ -629,150 +629,150 @@  discard block
 block discarded – undo
629 629
 		}
630 630
 	}
631 631
 
632
-    /**
633
-     * Change field size from character to pixel -- Multiply by 9
634
-     */
635
-    private function migrate_to_17() {
636
-        global $wpdb;
632
+	/**
633
+	 * Change field size from character to pixel -- Multiply by 9
634
+	 */
635
+	private function migrate_to_17() {
636
+		global $wpdb;
637 637
 		$pixel_conversion = 9;
638 638
 
639
-        // Get query arguments
639
+		// Get query arguments
640 640
 		$field_types = array( 'textarea', 'text', 'number', 'email', 'url', 'rte', 'date', 'phone', 'password', 'image', 'tag', 'file' );
641 641
 		$query = array( 'type' => $field_types, 'field_options like' => 's:4:"size";', 'field_options not like' => 's:4:"size";s:0:' );
642 642
 
643
-        // Get results
643
+		// Get results
644 644
 		$fields = FrmDb::get_results( $this->fields, $query, 'id, field_options' );
645 645
 
646
-        $updated = 0;
647
-        foreach ( $fields as $f ) {
648
-            $f->field_options = maybe_unserialize($f->field_options);
649
-            if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) {
650
-                continue;
651
-            }
646
+		$updated = 0;
647
+		foreach ( $fields as $f ) {
648
+			$f->field_options = maybe_unserialize($f->field_options);
649
+			if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) {
650
+				continue;
651
+			}
652 652
 
653 653
 			$f->field_options['size'] = round( $pixel_conversion * (int) $f->field_options['size'] );
654
-            $f->field_options['size'] .= 'px';
655
-            $u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
656
-            if ( $u ) {
657
-                $updated++;
658
-            }
659
-            unset($f);
660
-        }
661
-
662
-        // Change the characters in widgets to pixels
663
-        $widgets = get_option('widget_frm_show_form');
664
-        if ( empty($widgets) ) {
665
-            return;
666
-        }
667
-
668
-        $widgets = maybe_unserialize($widgets);
669
-        foreach ( $widgets as $k => $widget ) {
670
-            if ( ! is_array($widget) || ! isset($widget['size']) ) {
671
-                continue;
672
-            }
654
+			$f->field_options['size'] .= 'px';
655
+			$u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
656
+			if ( $u ) {
657
+				$updated++;
658
+			}
659
+			unset($f);
660
+		}
661
+
662
+		// Change the characters in widgets to pixels
663
+		$widgets = get_option('widget_frm_show_form');
664
+		if ( empty($widgets) ) {
665
+			return;
666
+		}
667
+
668
+		$widgets = maybe_unserialize($widgets);
669
+		foreach ( $widgets as $k => $widget ) {
670
+			if ( ! is_array($widget) || ! isset($widget['size']) ) {
671
+				continue;
672
+			}
673 673
 			$size = round( $pixel_conversion * (int) $widget['size'] );
674
-            $size .= 'px';
674
+			$size .= 'px';
675 675
 			$widgets[ $k ]['size'] = $size;
676
-        }
677
-        update_option('widget_frm_show_form', $widgets);
678
-    }
679
-
680
-    /**
681
-     * Migrate post and email notification settings into actions
682
-     */
683
-    private function migrate_to_16() {
684
-        global $wpdb;
685
-
686
-        $forms = FrmDb::get_results( $this->forms, array(), 'id, options, is_template, default_template' );
687
-
688
-        /**
689
-        * Old email settings format:
690
-        * email_to: Email or field id
691
-        * also_email_to: array of fields ids
692
-        * reply_to: Email, field id, 'custom'
693
-        * cust_reply_to: string
694
-        * reply_to_name: field id, 'custom'
695
-        * cust_reply_to_name: string
696
-        * plain_text: 0|1
697
-        * email_message: string or ''
698
-        * email_subject: string or ''
699
-        * inc_user_info: 0|1
700
-        * update_email: 0, 1, 2
701
-        *
702
-        * Old autoresponder settings format:
703
-        * auto_responder: 0|1
704
-        * ar_email_message: string or ''
705
-        * ar_email_to: field id
706
-        * ar_plain_text: 0|1
707
-        * ar_reply_to_name: string
708
-        * ar_reply_to: string
709
-        * ar_email_subject: string
710
-        * ar_update_email: 0, 1, 2
711
-        *
712
-        * New email settings:
713
-        * post_content: json settings
714
-        * post_title: form id
715
-        * post_excerpt: message
716
-        *
717
-        */
718
-
719
-        foreach ( $forms as $form ) {
676
+		}
677
+		update_option('widget_frm_show_form', $widgets);
678
+	}
679
+
680
+	/**
681
+	 * Migrate post and email notification settings into actions
682
+	 */
683
+	private function migrate_to_16() {
684
+		global $wpdb;
685
+
686
+		$forms = FrmDb::get_results( $this->forms, array(), 'id, options, is_template, default_template' );
687
+
688
+		/**
689
+		 * Old email settings format:
690
+		 * email_to: Email or field id
691
+		 * also_email_to: array of fields ids
692
+		 * reply_to: Email, field id, 'custom'
693
+		 * cust_reply_to: string
694
+		 * reply_to_name: field id, 'custom'
695
+		 * cust_reply_to_name: string
696
+		 * plain_text: 0|1
697
+		 * email_message: string or ''
698
+		 * email_subject: string or ''
699
+		 * inc_user_info: 0|1
700
+		 * update_email: 0, 1, 2
701
+		 *
702
+		 * Old autoresponder settings format:
703
+		 * auto_responder: 0|1
704
+		 * ar_email_message: string or ''
705
+		 * ar_email_to: field id
706
+		 * ar_plain_text: 0|1
707
+		 * ar_reply_to_name: string
708
+		 * ar_reply_to: string
709
+		 * ar_email_subject: string
710
+		 * ar_update_email: 0, 1, 2
711
+		 *
712
+		 * New email settings:
713
+		 * post_content: json settings
714
+		 * post_title: form id
715
+		 * post_excerpt: message
716
+		 *
717
+		 */
718
+
719
+		foreach ( $forms as $form ) {
720 720
 			if ( $form->is_template && $form->default_template ) {
721 721
 				// don't migrate the default templates since the email will be added anyway
722 722
 				continue;
723 723
 			}
724 724
 
725
-            // Format form options
726
-            $form_options = maybe_unserialize($form->options);
725
+			// Format form options
726
+			$form_options = maybe_unserialize($form->options);
727 727
 
728
-            // Migrate settings to actions
729
-            FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
730
-        }
731
-    }
728
+			// Migrate settings to actions
729
+			FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
730
+		}
731
+	}
732 732
 
733
-    private function migrate_to_11() {
734
-        global $wpdb;
733
+	private function migrate_to_11() {
734
+		global $wpdb;
735 735
 
736
-        $forms = FrmDb::get_results( $this->forms, array(), 'id, options');
736
+		$forms = FrmDb::get_results( $this->forms, array(), 'id, options');
737 737
 
738
-        $sending = __( 'Sending', 'formidable' );
738
+		$sending = __( 'Sending', 'formidable' );
739 739
 		$img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
740
-        $old_default_html = <<<DEFAULT_HTML
740
+		$old_default_html = <<<DEFAULT_HTML
741 741
 <div class="frm_submit">
742 742
 [if back_button]<input type="submit" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" [back_hook] />[/if back_button]
743 743
 <input type="submit" value="[button_label]" [button_action] />
744 744
 <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" />
745 745
 </div>
746 746
 DEFAULT_HTML;
747
-        unset($sending, $img);
747
+		unset($sending, $img);
748 748
 
749
-        $new_default_html = FrmFormsHelper::get_default_html('submit');
750
-        $draft_link = FrmFormsHelper::get_draft_link();
749
+		$new_default_html = FrmFormsHelper::get_default_html('submit');
750
+		$draft_link = FrmFormsHelper::get_draft_link();
751 751
 		foreach ( $forms as $form ) {
752
-            $form->options = maybe_unserialize($form->options);
753
-            if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
754
-                continue;
755
-            }
752
+			$form->options = maybe_unserialize($form->options);
753
+			if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
754
+				continue;
755
+			}
756 756
 
757
-            if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) {
758
-                $form->options['submit_html'] = $new_default_html;
757
+			if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) {
758
+				$form->options['submit_html'] = $new_default_html;
759 759
 				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
760 760
 			} else if ( ! strpos( $form->options['submit_html'], 'save_draft' ) ) {
761 761
 				$form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] );
762 762
 				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
763
-            }
764
-            unset($form);
765
-        }
766
-        unset($forms);
767
-    }
763
+			}
764
+			unset($form);
765
+		}
766
+		unset($forms);
767
+	}
768 768
 
769
-    private function migrate_to_6() {
770
-        global $wpdb;
769
+	private function migrate_to_6() {
770
+		global $wpdb;
771 771
 
772 772
 		$no_save = array_merge( FrmField::no_save_fields(), array( 'form', 'hidden', 'user_id' ) );
773 773
 		$fields = FrmDb::get_results( $this->fields, array( 'type NOT' => $no_save ), 'id, field_options' );
774 774
 
775
-        $default_html = <<<DEFAULT_HTML
775
+		$default_html = <<<DEFAULT_HTML
776 776
 <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
777 777
     <label class="frm_pos_[label_position]">[field_name]
778 778
         <span class="frm_required">[required_label]</span>
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 </div>
783 783
 DEFAULT_HTML;
784 784
 
785
-        $old_default_html = <<<DEFAULT_HTML
785
+		$old_default_html = <<<DEFAULT_HTML
786 786
 <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
787 787
     <label class="frm_pos_[label_position]">[field_name]
788 788
         <span class="frm_required">[required_label]</span>
@@ -792,25 +792,25 @@  discard block
 block discarded – undo
792 792
 </div>
793 793
 DEFAULT_HTML;
794 794
 
795
-        $new_default_html = FrmFieldsHelper::get_default_html('text');
796
-        foreach ( $fields as $field ) {
797
-            $field->field_options = maybe_unserialize($field->field_options);
795
+		$new_default_html = FrmFieldsHelper::get_default_html('text');
796
+		foreach ( $fields as $field ) {
797
+			$field->field_options = maybe_unserialize($field->field_options);
798 798
 			if ( ! FrmField::is_option_empty( $field, 'custom_html' ) || $field->field_options['custom_html'] == $default_html || $field->field_options['custom_html'] == $old_default_html ) {
799
-                $field->field_options['custom_html'] = $new_default_html;
799
+				$field->field_options['custom_html'] = $new_default_html;
800 800
 				$wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) );
801
-            }
802
-            unset($field);
803
-        }
804
-        unset($default_html, $old_default_html, $fields);
805
-    }
806
-
807
-    private function migrate_to_4() {
808
-        global $wpdb;
801
+			}
802
+			unset($field);
803
+		}
804
+		unset($default_html, $old_default_html, $fields);
805
+	}
806
+
807
+	private function migrate_to_4() {
808
+		global $wpdb;
809 809
 		$user_ids = FrmEntryMeta::getAll( array( 'fi.type' => 'user_id' ) );
810
-        foreach ( $user_ids as $user_id ) {
810
+		foreach ( $user_ids as $user_id ) {
811 811
 			$wpdb->update( $this->entries, array( 'user_id' => $user_id->meta_value ), array( 'id' => $user_id->item_id ) );
812
-        }
813
-    }
812
+		}
813
+	}
814 814
 
815 815
 	public static function get_one_record( $table, $args = array(), $fields = '*', $order_by = '' ) {
816 816
 		_deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_row' );
Please login to merge, or discard this patch.