Completed
Push — master ( deee05...5e65f0 )
by Jamie
03:26
created
classes/helpers/FrmFieldsHelper.php 2 patches
Indentation   +780 added lines, -780 removed lines patch added patch discarded remove patch
@@ -7,71 +7,71 @@  discard block
 block discarded – undo
7 7
 
8 8
 	public static function setup_new_vars( $type = '', $form_id = '' ) {
9 9
 
10
-        if ( strpos($type, '|') ) {
11
-            list($type, $setting) = explode('|', $type);
12
-        }
13
-
14
-        $defaults = self::get_default_field_opts($type, $form_id);
15
-        $defaults['field_options']['custom_html'] = self::get_default_html($type);
16
-
17
-        $values = array();
18
-
19
-        foreach ( $defaults as $var => $default ) {
20
-            if ( $var == 'field_options' ) {
21
-                $values['field_options'] = array();
22
-                foreach ( $default as $opt_var => $opt_default ) {
23
-                    $values['field_options'][ $opt_var ] = $opt_default;
24
-                    unset($opt_var, $opt_default);
25
-                }
26
-            } else {
27
-                $values[ $var ] = $default;
28
-            }
29
-            unset($var, $default);
30
-        }
31
-
32
-        if ( isset( $setting ) && ! empty( $setting ) ) {
33
-            if ( 'data' == $type ) {
34
-                $values['field_options']['data_type'] = $setting;
35
-            } else {
36
-                $values['field_options'][ $setting ] = 1;
37
-            }
38
-        }
39
-
40
-        if ( $type == 'radio' || $type == 'checkbox' ) {
41
-            $values['options'] = serialize( array(
42
-                __( 'Option 1', 'formidable' ),
43
-                __( 'Option 2', 'formidable' ),
44
-            ) );
45
-        } else if ( $type == 'select' ) {
46
-            $values['options'] = serialize( array(
47
-                '', __( 'Option 1', 'formidable' ),
48
-            ) );
49
-        } else if ( $type == 'textarea' ) {
50
-            $values['field_options']['max'] = '5';
51
-        } else if ( $type == 'captcha' ) {
52
-            $frm_settings = FrmAppHelper::get_settings();
53
-            $values['invalid'] = $frm_settings->re_msg;
54
-        } else if ( 'url' == $type ) {
55
-            $values['name'] = __( 'Website', 'formidable' );
56
-        }
10
+		if ( strpos($type, '|') ) {
11
+			list($type, $setting) = explode('|', $type);
12
+		}
13
+
14
+		$defaults = self::get_default_field_opts($type, $form_id);
15
+		$defaults['field_options']['custom_html'] = self::get_default_html($type);
16
+
17
+		$values = array();
18
+
19
+		foreach ( $defaults as $var => $default ) {
20
+			if ( $var == 'field_options' ) {
21
+				$values['field_options'] = array();
22
+				foreach ( $default as $opt_var => $opt_default ) {
23
+					$values['field_options'][ $opt_var ] = $opt_default;
24
+					unset($opt_var, $opt_default);
25
+				}
26
+			} else {
27
+				$values[ $var ] = $default;
28
+			}
29
+			unset($var, $default);
30
+		}
31
+
32
+		if ( isset( $setting ) && ! empty( $setting ) ) {
33
+			if ( 'data' == $type ) {
34
+				$values['field_options']['data_type'] = $setting;
35
+			} else {
36
+				$values['field_options'][ $setting ] = 1;
37
+			}
38
+		}
39
+
40
+		if ( $type == 'radio' || $type == 'checkbox' ) {
41
+			$values['options'] = serialize( array(
42
+				__( 'Option 1', 'formidable' ),
43
+				__( 'Option 2', 'formidable' ),
44
+			) );
45
+		} else if ( $type == 'select' ) {
46
+			$values['options'] = serialize( array(
47
+				'', __( 'Option 1', 'formidable' ),
48
+			) );
49
+		} else if ( $type == 'textarea' ) {
50
+			$values['field_options']['max'] = '5';
51
+		} else if ( $type == 'captcha' ) {
52
+			$frm_settings = FrmAppHelper::get_settings();
53
+			$values['invalid'] = $frm_settings->re_msg;
54
+		} else if ( 'url' == $type ) {
55
+			$values['name'] = __( 'Website', 'formidable' );
56
+		}
57 57
 
58 58
 		$fields = FrmField::field_selection();
59
-        $fields = array_merge($fields, FrmField::pro_field_selection());
59
+		$fields = array_merge($fields, FrmField::pro_field_selection());
60 60
 
61
-        if ( isset( $fields[ $type ] ) ) {
62
-            $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ];
63
-        }
61
+		if ( isset( $fields[ $type ] ) ) {
62
+			$values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ];
63
+		}
64 64
 
65
-        unset($fields);
65
+		unset($fields);
66 66
 
67
-        return $values;
68
-    }
67
+		return $values;
68
+	}
69 69
 
70 70
 	public static function get_html_id( $field, $plus = '' ) {
71 71
 		return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field );
72
-    }
72
+	}
73 73
 
74
-    public static function setup_edit_vars( $record, $doing_ajax = false ) {
74
+	public static function setup_edit_vars( $record, $doing_ajax = false ) {
75 75
 		$values = array( 'id' => $record->id, 'form_id' => $record->form_id );
76 76
 		$defaults = array(
77 77
 			'name'          => $record->name,
@@ -84,86 +84,86 @@  discard block
 block discarded – undo
84 84
 		);
85 85
 
86 86
 		if ( $doing_ajax ) {
87
-            $values = $values + $defaults;
88
-            $values['form_name'] = '';
87
+			$values = $values + $defaults;
88
+			$values['form_name'] = '';
89 89
 		} else {
90 90
 			foreach ( $defaults as $var => $default ) {
91
-                $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
92
-                unset($var, $default);
93
-            }
91
+				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
92
+				unset($var, $default);
93
+			}
94 94
 
95 95
 			$values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : '';
96
-        }
96
+		}
97 97
 
98 98
 		unset( $defaults );
99 99
 
100
-        $values['options'] = $record->options;
101
-        $values['field_options'] = $record->field_options;
100
+		$values['options'] = $record->options;
101
+		$values['field_options'] = $record->field_options;
102 102
 
103
-        $defaults = self::get_default_field_opts($values['type'], $record, true);
103
+		$defaults = self::get_default_field_opts($values['type'], $record, true);
104 104
 
105 105
 		if ( $values['type'] == 'captcha' ) {
106
-            $frm_settings = FrmAppHelper::get_settings();
107
-            $defaults['invalid'] = $frm_settings->re_msg;
108
-        }
106
+			$frm_settings = FrmAppHelper::get_settings();
107
+			$defaults['invalid'] = $frm_settings->re_msg;
108
+		}
109 109
 
110 110
 		foreach ( $defaults as $opt => $default ) {
111
-            $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
112
-            unset($opt, $default);
113
-        }
111
+			$values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
112
+			unset($opt, $default);
113
+		}
114 114
 
115
-        $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type);
115
+		$values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type);
116 116
 
117 117
 		return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) );
118
-    }
118
+	}
119 119
 
120
-    public static function get_default_field_opts( $type, $field, $limit = false ) {
121
-        $field_options = array(
122
-            'size' => '', 'max' => '', 'label' => '', 'blank' => '',
123
-            'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0,
124
-            'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '',
120
+	public static function get_default_field_opts( $type, $field, $limit = false ) {
121
+		$field_options = array(
122
+			'size' => '', 'max' => '', 'label' => '', 'blank' => '',
123
+			'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0,
124
+			'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '',
125 125
 			'custom_html' => '', 'captcha_size' => 'default',
126
-        );
126
+		);
127 127
 
128 128
 		if ( $limit ) {
129
-            return $field_options;
129
+			return $field_options;
130 130
 		}
131 131
 
132
-        global $wpdb;
132
+		global $wpdb;
133 133
 
134
-        $form_id = (is_numeric($field)) ? $field : $field->form_id;
134
+		$form_id = (is_numeric($field)) ? $field : $field->form_id;
135 135
 
136 136
 		$key = is_numeric( $field ) ? FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_fields', 'field_key' ) : $field->field_key;
137 137
 
138
-        $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) );
138
+		$field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) );
139 139
 
140
-        $frm_settings = FrmAppHelper::get_settings();
141
-        return array(
142
-            'name' => __( 'Untitled', 'formidable' ), 'description' => '',
140
+		$frm_settings = FrmAppHelper::get_settings();
141
+		return array(
142
+			'name' => __( 'Untitled', 'formidable' ), 'description' => '',
143 143
 			'field_key' => $key, 'type' => $type, 'options' => '', 'default_value' => '',
144 144
 			'field_order' => $field_count + 1, 'required' => false,
145
-            'blank' => $frm_settings->blank_msg, 'unique_msg' => $frm_settings->unique_msg,
146
-            'invalid' => __( 'This field is invalid', 'formidable' ), 'form_id' => $form_id,
145
+			'blank' => $frm_settings->blank_msg, 'unique_msg' => $frm_settings->unique_msg,
146
+			'invalid' => __( 'This field is invalid', 'formidable' ), 'form_id' => $form_id,
147 147
 			'field_options' => $field_options,
148
-        );
149
-    }
148
+		);
149
+	}
150 150
 
151
-    public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
152
-        global $wpdb;
151
+	public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
152
+		global $wpdb;
153 153
 
154 154
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
155
-        $values['form_id'] = $form_id;
156
-        $values['options'] = maybe_serialize($field->options);
157
-        $values['default_value'] = maybe_serialize($field->default_value);
158
-
159
-        foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
160
-            $values[ $col ] = $field->{$col};
161
-        }
162
-    }
163
-
164
-    /**
165
-     * @since 2.0
166
-     */
155
+		$values['form_id'] = $form_id;
156
+		$values['options'] = maybe_serialize($field->options);
157
+		$values['default_value'] = maybe_serialize($field->default_value);
158
+
159
+		foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
160
+			$values[ $col ] = $field->{$col};
161
+		}
162
+	}
163
+
164
+	/**
165
+	 * @since 2.0
166
+	 */
167 167
 	public static function get_error_msg( $field, $error ) {
168 168
 		$frm_settings = FrmAppHelper::get_settings();
169 169
 		$default_settings = $frm_settings->default_options();
@@ -180,21 +180,21 @@  discard block
 block discarded – undo
180 180
 		return $msg;
181 181
 	}
182 182
 
183
-    public static function get_form_fields( $form_id, $error = false ) {
184
-        $fields = FrmField::get_all_for_form($form_id);
185
-        $fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error);
186
-        return $fields;
187
-    }
183
+	public static function get_form_fields( $form_id, $error = false ) {
184
+		$fields = FrmField::get_all_for_form($form_id);
185
+		$fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error);
186
+		return $fields;
187
+	}
188 188
 
189 189
 	public static function get_default_html( $type = 'text' ) {
190 190
 		if ( apply_filters( 'frm_normal_field_type_html', true, $type ) ) {
191 191
 			$input = ( in_array( $type, array( 'radio', 'checkbox', 'data' ) ) ) ? '<div class="frm_opt_container">[input]</div>' : '[input]';
192
-            $for = '';
192
+			$for = '';
193 193
 			if ( ! in_array( $type, array( 'radio', 'checkbox', 'data', 'scale' ) ) ) {
194
-                $for = 'for="field_[key]"';
195
-            }
194
+				$for = 'for="field_[key]"';
195
+			}
196 196
 
197
-            $default_html = <<<DEFAULT_HTML
197
+			$default_html = <<<DEFAULT_HTML
198 198
 <div id="frm_field_[id]_container" class="frm_form_field form-field [required_class][error_class]">
199 199
     <label $for class="frm_primary_label">[field_name]
200 200
         <span class="frm_required">[required_label]</span>
@@ -204,145 +204,145 @@  discard block
 block discarded – undo
204 204
     [if error]<div class="frm_error">[error]</div>[/if error]
205 205
 </div>
206 206
 DEFAULT_HTML;
207
-        } else {
207
+		} else {
208 208
 			$default_html = apply_filters('frm_other_custom_html', '', $type);
209
-        }
209
+		}
210 210
 
211
-        return apply_filters('frm_custom_html', $default_html, $type);
212
-    }
211
+		return apply_filters('frm_custom_html', $default_html, $type);
212
+	}
213 213
 
214 214
 	public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) {
215
-        $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
215
+		$html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
216 216
 
217
-        $defaults = array(
217
+		$defaults = array(
218 218
 			'field_name'    => 'item_meta[' . $field['id'] . ']',
219 219
 			'field_id'      => $field['id'],
220
-            'field_plus_id' => '',
221
-            'section_id'    => '',
222
-        );
223
-        $args = wp_parse_args($args, $defaults);
224
-        $field_name = $args['field_name'];
225
-        $field_id = $args['field_id'];
226
-        $html_id = self::get_html_id($field, $args['field_plus_id']);
220
+			'field_plus_id' => '',
221
+			'section_id'    => '',
222
+		);
223
+		$args = wp_parse_args($args, $defaults);
224
+		$field_name = $args['field_name'];
225
+		$field_id = $args['field_id'];
226
+		$html_id = self::get_html_id($field, $args['field_plus_id']);
227 227
 
228
-        if ( FrmField::is_multiple_select($field) ) {
229
-            $field_name .= '[]';
230
-        }
228
+		if ( FrmField::is_multiple_select($field) ) {
229
+			$field_name .= '[]';
230
+		}
231 231
 
232
-        //replace [id]
233
-        $html = str_replace('[id]', $field_id, $html);
232
+		//replace [id]
233
+		$html = str_replace('[id]', $field_id, $html);
234 234
 
235
-        // Remove the for attribute for captcha
236
-        if ( $field['type'] == 'captcha' ) {
237
-            $html = str_replace(' for="field_[key]"', '', $html);
238
-        }
235
+		// Remove the for attribute for captcha
236
+		if ( $field['type'] == 'captcha' ) {
237
+			$html = str_replace(' for="field_[key]"', '', $html);
238
+		}
239 239
 
240
-        // set the label for
241
-        $html = str_replace('field_[key]', $html_id, $html);
240
+		// set the label for
241
+		$html = str_replace('field_[key]', $html_id, $html);
242 242
 
243
-        //replace [key]
244
-        $html = str_replace('[key]', $field['field_key'], $html);
243
+		//replace [key]
244
+		$html = str_replace('[key]', $field['field_key'], $html);
245 245
 
246
-        //replace [description] and [required_label] and [error]
246
+		//replace [description] and [required_label] and [error]
247 247
 		$required = FrmField::is_required( $field ) ? $field['required_indicator'] : '';
248
-        if ( ! is_array( $errors ) ) {
249
-            $errors = array();
250
-        }
248
+		if ( ! is_array( $errors ) ) {
249
+			$errors = array();
250
+		}
251 251
 		$error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false;
252 252
 
253
-        //If field type is section heading, add class so a bottom margin can be added to either the h3 or description
254
-        if ( $field['type'] == 'divider' ) {
255
-            if ( FrmField::is_option_true( $field, 'description' ) ) {
256
-                $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
257
-            } else {
258
-                $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
259
-            }
260
-        }
253
+		//If field type is section heading, add class so a bottom margin can be added to either the h3 or description
254
+		if ( $field['type'] == 'divider' ) {
255
+			if ( FrmField::is_option_true( $field, 'description' ) ) {
256
+				$html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
257
+			} else {
258
+				$html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
259
+			}
260
+		}
261 261
 
262 262
 		foreach ( array( 'description' => $field['description'], 'required_label' => $required, 'error' => $error ) as $code => $value ) {
263
-            self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html );
264
-        }
263
+			self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html );
264
+		}
265 265
 
266
-        //replace [required_class]
266
+		//replace [required_class]
267 267
 		$required_class = FrmField::is_required( $field ) ? ' frm_required_field' : '';
268
-        $html = str_replace('[required_class]', $required_class, $html);
268
+		$html = str_replace('[required_class]', $required_class, $html);
269 269
 
270
-        //replace [label_position]
271
-        $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
272
-        $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
270
+		//replace [label_position]
271
+		$field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
272
+		$field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
273 273
 		$html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html );
274 274
 
275
-        //replace [field_name]
276
-        $html = str_replace('[field_name]', $field['name'], $html);
275
+		//replace [field_name]
276
+		$html = str_replace('[field_name]', $field['name'], $html);
277 277
 
278
-        //replace [error_class]
278
+		//replace [error_class]
279 279
 		$error_class = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : '';
280 280
 		self::get_more_field_classes( $error_class, $field, $field_id, $html );
281 281
 		if ( $field['type'] == 'html' && strpos( $html, '[error_class]' ) === false ) {
282 282
 			// there is no error_class shortcode to use for addign fields
283 283
 			$html = str_replace( 'class="frm_form_field', 'class="frm_form_field ' . $error_class, $html );
284 284
 		}
285
-        $html = str_replace('[error_class]', $error_class, $html);
285
+		$html = str_replace('[error_class]', $error_class, $html);
286 286
 
287
-        //replace [entry_key]
288
-        $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
289
-        $html = str_replace('[entry_key]', $entry_key, $html);
287
+		//replace [entry_key]
288
+		$entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
289
+		$html = str_replace('[entry_key]', $entry_key, $html);
290 290
 
291
-        //replace [input]
292
-        preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
293
-        global $frm_vars;
294
-        $frm_settings = FrmAppHelper::get_settings();
291
+		//replace [input]
292
+		preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
293
+		global $frm_vars;
294
+		$frm_settings = FrmAppHelper::get_settings();
295 295
 
296
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
297
-            $atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
296
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
297
+			$atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
298 298
 			$tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) );
299 299
 
300
-            $replace_with = '';
300
+			$replace_with = '';
301 301
 
302
-            if ( $tag == 'input' ) {
303
-                if ( isset($atts['opt']) ) {
304
-                    $atts['opt']--;
305
-                }
302
+			if ( $tag == 'input' ) {
303
+				if ( isset($atts['opt']) ) {
304
+					$atts['opt']--;
305
+				}
306 306
 
307
-                $field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
308
-                if ( isset($atts['class']) ) {
309
-                    unset($atts['class']);
310
-                }
307
+				$field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
308
+				if ( isset($atts['class']) ) {
309
+					unset($atts['class']);
310
+				}
311 311
 
312
-                $field['shortcodes'] = $atts;
313
-                ob_start();
312
+				$field['shortcodes'] = $atts;
313
+				ob_start();
314 314
 				include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/input.php' );
315
-                $replace_with = ob_get_contents();
316
-                ob_end_clean();
317
-            } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
318
-                $replace_with = FrmProEntriesController::entry_delete_link($atts);
319
-            }
315
+				$replace_with = ob_get_contents();
316
+				ob_end_clean();
317
+			} else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
318
+				$replace_with = FrmProEntriesController::entry_delete_link($atts);
319
+			}
320 320
 
321
-            $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
322
-        }
321
+			$html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
322
+		}
323 323
 
324 324
 		if ( $form ) {
325
-            $form = (array) $form;
325
+			$form = (array) $form;
326 326
 
327
-            //replace [form_key]
328
-            $html = str_replace('[form_key]', $form['form_key'], $html);
327
+			//replace [form_key]
328
+			$html = str_replace('[form_key]', $form['form_key'], $html);
329 329
 
330
-            //replace [form_name]
331
-            $html = str_replace('[form_name]', $form['name'], $html);
332
-        }
333
-        $html .= "\n";
330
+			//replace [form_name]
331
+			$html = str_replace('[form_name]', $form['name'], $html);
332
+		}
333
+		$html .= "\n";
334 334
 
335
-        //Return html if conf_field to prevent loop
336
-        if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
337
-            return $html;
338
-        }
335
+		//Return html if conf_field to prevent loop
336
+		if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
337
+			return $html;
338
+		}
339 339
 
340
-        //If field is in repeating section
341
-        if ( $args['section_id'] ) {
342
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ));
343
-        } else {
344
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
345
-        }
340
+		//If field is in repeating section
341
+		if ( $args['section_id'] ) {
342
+			$html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ));
343
+		} else {
344
+			$html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
345
+		}
346 346
 
347 347
 		self::remove_collapse_shortcode( $html );
348 348
 
@@ -350,18 +350,18 @@  discard block
 block discarded – undo
350 350
 			$html = do_shortcode( $html );
351 351
 		}
352 352
 
353
-        return $html;
354
-    }
353
+		return $html;
354
+	}
355 355
 
356 356
 	/**
357
-	* Add more classes to certain fields (like confirmation fields, other fields, repeating fields, etc.)
358
-	*
359
-	* @since 2.0
360
-	* @param $error_class string, pass by reference
361
-	* @param $field array
362
-	* @param $field_id int
363
-	* @param $html string
364
-	*/
357
+	 * Add more classes to certain fields (like confirmation fields, other fields, repeating fields, etc.)
358
+	 *
359
+	 * @since 2.0
360
+	 * @param $error_class string, pass by reference
361
+	 * @param $field array
362
+	 * @param $field_id int
363
+	 * @param $html string
364
+	 */
365 365
 	private static function get_more_field_classes( &$error_class, $field, $field_id, $html ) {
366 366
 		$error_class .= ' frm_' . $field['label'] . '_container';
367 367
 		if ( $field['id'] != $field_id ) {
@@ -425,46 +425,46 @@  discard block
 block discarded – undo
425 425
 		}
426 426
 	}
427 427
 
428
-    public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
429
-        if ( $no_vars ) {
428
+	public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
429
+		if ( $no_vars ) {
430 430
 			$html = str_replace( '[if ' . $code . ']', '', $html );
431 431
 			$html = str_replace( '[/if ' . $code . ']', '', $html );
432
-        } else {
432
+		} else {
433 433
 			$html = preg_replace( '/(\[if\s+' . $code . '\])(.*?)(\[\/if\s+' . $code . '\])/mis', '', $html );
434
-        }
434
+		}
435 435
 
436 436
 		$html = str_replace( '[' . $code . ']', $replace_with, $html );
437
-    }
437
+	}
438 438
 
439 439
 	public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
440 440
 		$args = wp_parse_args( $args, array( 'conditional' => false, 'conditional_check' => false, 'foreach' => false ) );
441
-        if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
442
-            $args['conditional_check'] = true;
443
-        }
444
-
445
-        $prefix = '';
446
-        if ( $args['conditional_check'] ) {
447
-            if ( $args['conditional'] ) {
448
-                $prefix = 'if ';
449
-            } else if ( $args['foreach'] ) {
450
-                $prefix = 'foreach ';
451
-            }
452
-        }
453
-
454
-        $with_tags = $args['conditional_check'] ? 3 : 2;
455
-        if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
456
-            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
457
-            $tag = str_replace(']', '', $tag);
458
-            $tags = explode(' ', $tag);
459
-            if ( is_array($tags) ) {
460
-                $tag = $tags[0];
461
-            }
462
-        } else {
463
-            $tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
464
-        }
465
-
466
-        return $tag;
467
-    }
441
+		if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
442
+			$args['conditional_check'] = true;
443
+		}
444
+
445
+		$prefix = '';
446
+		if ( $args['conditional_check'] ) {
447
+			if ( $args['conditional'] ) {
448
+				$prefix = 'if ';
449
+			} else if ( $args['foreach'] ) {
450
+				$prefix = 'foreach ';
451
+			}
452
+		}
453
+
454
+		$with_tags = $args['conditional_check'] ? 3 : 2;
455
+		if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
456
+			$tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
457
+			$tag = str_replace(']', '', $tag);
458
+			$tags = explode(' ', $tag);
459
+			if ( is_array($tags) ) {
460
+				$tag = $tags[0];
461
+			}
462
+		} else {
463
+			$tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
464
+		}
465
+
466
+		return $tag;
467
+	}
468 468
 
469 469
 	/**
470 470
 	 * Remove [collapse_this] if it's still included after all processing
@@ -477,128 +477,128 @@  discard block
 block discarded – undo
477 477
 	}
478 478
 
479 479
 	public static function display_recaptcha( $field ) {
480
-        $frm_settings = FrmAppHelper::get_settings();
481
-        $lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field);
480
+		$frm_settings = FrmAppHelper::get_settings();
481
+		$lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field);
482 482
 
483
-        $api_js_url = 'https://www.google.com/recaptcha/api.js?onload=frmRecaptcha&render=explicit';
484
-        if ( $lang != 'en' ) {
483
+		$api_js_url = 'https://www.google.com/recaptcha/api.js?onload=frmRecaptcha&render=explicit';
484
+		if ( $lang != 'en' ) {
485 485
 			$api_js_url .= '&hl=' . $lang;
486
-        }
487
-        $api_js_url = apply_filters('frm_recpatcha_js_url', $api_js_url);
486
+		}
487
+		$api_js_url = apply_filters('frm_recpatcha_js_url', $api_js_url);
488 488
 
489
-        wp_register_script('recaptcha-api', $api_js_url, '', true);
490
-        wp_enqueue_script('recaptcha-api');
489
+		wp_register_script('recaptcha-api', $api_js_url, '', true);
490
+		wp_enqueue_script('recaptcha-api');
491 491
 
492 492
 ?>
493 493
 <div id="field_<?php echo esc_attr( $field['field_key'] ) ?>" class="frm-g-recaptcha" data-sitekey="<?php echo esc_attr( $frm_settings->pubkey ) ?>" data-size="<?php echo esc_attr( $field['captcha_size'] ) ?>"></div>
494 494
 <?php
495
-    }
495
+	}
496 496
 
497 497
 	public static function show_single_option( $field ) {
498
-        $field_name = $field['name'];
499
-        $html_id = self::get_html_id($field);
500
-        foreach ( $field['options'] as $opt_key => $opt ) {
501
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
502
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
498
+		$field_name = $field['name'];
499
+		$html_id = self::get_html_id($field);
500
+		foreach ( $field['options'] as $opt_key => $opt ) {
501
+			$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
502
+			$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
503 503
 
504
-            // If this is an "Other" option, get the HTML for it
504
+			// If this is an "Other" option, get the HTML for it
505 505
 			if ( self::is_other_opt( $opt_key ) ) {
506
-                // Get string for Other text field, if needed
506
+				// Get string for Other text field, if needed
507 507
 				$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
508 508
 				require( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' );
509
-            } else {
509
+			} else {
510 510
 				require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
511
-            }
512
-        }
513
-    }
511
+			}
512
+		}
513
+	}
514 514
 
515 515
 	public static function dropdown_categories( $args ) {
516 516
 		$defaults = array( 'field' => false, 'name' => false, 'show_option_all' => ' ' );
517
-        $args = wp_parse_args($args, $defaults);
517
+		$args = wp_parse_args($args, $defaults);
518 518
 
519
-        if ( ! $args['field'] ) {
520
-            return;
521
-        }
519
+		if ( ! $args['field'] ) {
520
+			return;
521
+		}
522 522
 
523
-        if ( ! $args['name'] ) {
523
+		if ( ! $args['name'] ) {
524 524
 			$args['name'] = 'item_meta[' . $args['field']['id'] . ']';
525
-        }
525
+		}
526 526
 
527
-        $id = self::get_html_id($args['field']);
528
-        $class = $args['field']['type'];
527
+		$id = self::get_html_id($args['field']);
528
+		$class = $args['field']['type'];
529 529
 
530
-        $exclude = (is_array($args['field']['exclude_cat'])) ? implode(',', $args['field']['exclude_cat']) : $args['field']['exclude_cat'];
531
-        $exclude = apply_filters('frm_exclude_cats', $exclude, $args['field']);
530
+		$exclude = (is_array($args['field']['exclude_cat'])) ? implode(',', $args['field']['exclude_cat']) : $args['field']['exclude_cat'];
531
+		$exclude = apply_filters('frm_exclude_cats', $exclude, $args['field']);
532 532
 
533
-        if ( is_array($args['field']['value']) ) {
534
-            if ( ! empty($exclude) ) {
535
-                $args['field']['value'] = array_diff($args['field']['value'], explode(',', $exclude));
536
-            }
537
-            $selected = reset($args['field']['value']);
538
-        } else {
539
-            $selected = $args['field']['value'];
540
-        }
533
+		if ( is_array($args['field']['value']) ) {
534
+			if ( ! empty($exclude) ) {
535
+				$args['field']['value'] = array_diff($args['field']['value'], explode(',', $exclude));
536
+			}
537
+			$selected = reset($args['field']['value']);
538
+		} else {
539
+			$selected = $args['field']['value'];
540
+		}
541 541
 
542
-        $tax_atts = array(
543
-            'show_option_all' => $args['show_option_all'], 'hierarchical' => 1, 'name' => $args['name'],
544
-            'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected,
545
-            'hide_empty' => false, 'echo' => 0, 'orderby' => 'name',
546
-        );
542
+		$tax_atts = array(
543
+			'show_option_all' => $args['show_option_all'], 'hierarchical' => 1, 'name' => $args['name'],
544
+			'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected,
545
+			'hide_empty' => false, 'echo' => 0, 'orderby' => 'name',
546
+		);
547 547
 
548
-        $tax_atts = apply_filters('frm_dropdown_cat', $tax_atts, $args['field']);
548
+		$tax_atts = apply_filters('frm_dropdown_cat', $tax_atts, $args['field']);
549 549
 
550
-        if ( FrmAppHelper::pro_is_installed() ) {
551
-            $post_type = FrmProFormsHelper::post_type($args['field']['form_id']);
552
-            $tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $args['field']);
553
-            if ( ! $tax_atts['taxonomy'] ) {
554
-                return;
555
-            }
550
+		if ( FrmAppHelper::pro_is_installed() ) {
551
+			$post_type = FrmProFormsHelper::post_type($args['field']['form_id']);
552
+			$tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $args['field']);
553
+			if ( ! $tax_atts['taxonomy'] ) {
554
+				return;
555
+			}
556 556
 
557
-            // If field type is dropdown (not Dynamic), exclude children when parent is excluded
558
-            if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical($tax_atts['taxonomy']) ) {
559
-                $tax_atts['exclude_tree'] = $exclude;
560
-            }
561
-        }
557
+			// If field type is dropdown (not Dynamic), exclude children when parent is excluded
558
+			if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical($tax_atts['taxonomy']) ) {
559
+				$tax_atts['exclude_tree'] = $exclude;
560
+			}
561
+		}
562 562
 
563
-        $dropdown = wp_dropdown_categories($tax_atts);
563
+		$dropdown = wp_dropdown_categories($tax_atts);
564 564
 
565
-        $add_html = FrmFieldsController::input_html($args['field'], false);
565
+		$add_html = FrmFieldsController::input_html($args['field'], false);
566 566
 
567
-        if ( FrmAppHelper::pro_is_installed() ) {
568
-            $add_html .= FrmProFieldsController::input_html($args['field'], false);
569
-        }
567
+		if ( FrmAppHelper::pro_is_installed() ) {
568
+			$add_html .= FrmProFieldsController::input_html($args['field'], false);
569
+		}
570 570
 
571 571
 		$dropdown = str_replace( "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' class='" . esc_attr( $class ) . "'", "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' " . $add_html, $dropdown );
572 572
 
573
-        if ( is_array($args['field']['value']) ) {
574
-            $skip = true;
575
-            foreach ( $args['field']['value'] as $v ) {
573
+		if ( is_array($args['field']['value']) ) {
574
+			$skip = true;
575
+			foreach ( $args['field']['value'] as $v ) {
576 576
 				if ( $skip ) {
577
-                    $skip = false;
578
-                    continue;
579
-                }
577
+					$skip = false;
578
+					continue;
579
+				}
580 580
 				$dropdown = str_replace(' value="' . esc_attr( $v ) . '"', ' value="' . esc_attr( $v ) . '" selected="selected"', $dropdown );
581
-                unset($v);
582
-            }
583
-        }
581
+				unset($v);
582
+			}
583
+		}
584 584
 
585
-        return $dropdown;
586
-    }
585
+		return $dropdown;
586
+	}
587 587
 
588 588
 	public static function get_term_link( $tax_id ) {
589
-        $tax = get_taxonomy($tax_id);
590
-        if ( ! $tax ) {
591
-            return;
592
-        }
589
+		$tax = get_taxonomy($tax_id);
590
+		if ( ! $tax ) {
591
+			return;
592
+		}
593 593
 
594
-        $link = sprintf(
595
-            __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
594
+		$link = sprintf(
595
+			__( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
596 596
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
597
-        );
598
-        unset($tax);
597
+		);
598
+		unset($tax);
599 599
 
600
-        return $link;
601
-    }
600
+		return $link;
601
+	}
602 602
 
603 603
 	public static function value_meets_condition( $observed_value, $cond, $hide_opt ) {
604 604
 		// Remove white space from hide_opt
@@ -606,195 +606,195 @@  discard block
 block discarded – undo
606 606
 			$hide_opt = rtrim( $hide_opt );
607 607
 		}
608 608
 
609
-        if ( is_array($observed_value) ) {
610
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
611
-        }
612
-
613
-        $m = false;
614
-        if ( $cond == '==' ) {
615
-            $m = $observed_value == $hide_opt;
616
-        } else if ( $cond == '!=' ) {
617
-            $m = $observed_value != $hide_opt;
618
-        } else if ( $cond == '>' ) {
619
-            $m = $observed_value > $hide_opt;
620
-        } else if ( $cond == '<' ) {
621
-            $m = $observed_value < $hide_opt;
622
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
623
-            $m = stripos($observed_value, $hide_opt);
624
-            if ( $cond == 'not LIKE' ) {
625
-                $m = ( $m === false ) ? true : false;
626
-            } else {
627
-                $m = ( $m === false ) ? false : true;
628
-            }
629
-        }
630
-        return $m;
631
-    }
609
+		if ( is_array($observed_value) ) {
610
+			return self::array_value_condition($observed_value, $cond, $hide_opt);
611
+		}
612
+
613
+		$m = false;
614
+		if ( $cond == '==' ) {
615
+			$m = $observed_value == $hide_opt;
616
+		} else if ( $cond == '!=' ) {
617
+			$m = $observed_value != $hide_opt;
618
+		} else if ( $cond == '>' ) {
619
+			$m = $observed_value > $hide_opt;
620
+		} else if ( $cond == '<' ) {
621
+			$m = $observed_value < $hide_opt;
622
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
623
+			$m = stripos($observed_value, $hide_opt);
624
+			if ( $cond == 'not LIKE' ) {
625
+				$m = ( $m === false ) ? true : false;
626
+			} else {
627
+				$m = ( $m === false ) ? false : true;
628
+			}
629
+		}
630
+		return $m;
631
+	}
632 632
 
633 633
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
634
-        $m = false;
635
-        if ( $cond == '==' ) {
636
-            if ( is_array($hide_opt) ) {
637
-                $m = array_intersect($hide_opt, $observed_value);
638
-                $m = empty($m) ? false : true;
639
-            } else {
640
-                $m = in_array($hide_opt, $observed_value);
641
-            }
642
-        } else if ( $cond == '!=' ) {
643
-            $m = ! in_array($hide_opt, $observed_value);
644
-        } else if ( $cond == '>' ) {
645
-            $min = min($observed_value);
646
-            $m = $min > $hide_opt;
647
-        } else if ( $cond == '<' ) {
648
-            $max = max($observed_value);
649
-            $m = $max < $hide_opt;
650
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
651
-            foreach ( $observed_value as $ob ) {
652
-                $m = strpos($ob, $hide_opt);
653
-                if ( $m !== false ) {
654
-                    $m = true;
655
-                    break;
656
-                }
657
-            }
658
-
659
-            if ( $cond == 'not LIKE' ) {
660
-                $m = ( $m === false ) ? true : false;
661
-            }
662
-        }
663
-
664
-        return $m;
665
-    }
666
-
667
-    /**
668
-     * Replace a few basic shortcodes and field ids
669
-     * @since 2.0
670
-     * @return string
671
-     */
634
+		$m = false;
635
+		if ( $cond == '==' ) {
636
+			if ( is_array($hide_opt) ) {
637
+				$m = array_intersect($hide_opt, $observed_value);
638
+				$m = empty($m) ? false : true;
639
+			} else {
640
+				$m = in_array($hide_opt, $observed_value);
641
+			}
642
+		} else if ( $cond == '!=' ) {
643
+			$m = ! in_array($hide_opt, $observed_value);
644
+		} else if ( $cond == '>' ) {
645
+			$min = min($observed_value);
646
+			$m = $min > $hide_opt;
647
+		} else if ( $cond == '<' ) {
648
+			$max = max($observed_value);
649
+			$m = $max < $hide_opt;
650
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
651
+			foreach ( $observed_value as $ob ) {
652
+				$m = strpos($ob, $hide_opt);
653
+				if ( $m !== false ) {
654
+					$m = true;
655
+					break;
656
+				}
657
+			}
658
+
659
+			if ( $cond == 'not LIKE' ) {
660
+				$m = ( $m === false ) ? true : false;
661
+			}
662
+		}
663
+
664
+		return $m;
665
+	}
666
+
667
+	/**
668
+	 * Replace a few basic shortcodes and field ids
669
+	 * @since 2.0
670
+	 * @return string
671
+	 */
672 672
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
673
-        if ( strpos($value, '[sitename]') !== false ) {
674
-            $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
675
-            $value = str_replace('[sitename]', $new_value, $value);
676
-        }
673
+		if ( strpos($value, '[sitename]') !== false ) {
674
+			$new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
675
+			$value = str_replace('[sitename]', $new_value, $value);
676
+		}
677 677
 
678
-        $value = apply_filters('frm_content', $value, $form, $entry);
679
-        $value = do_shortcode($value);
678
+		$value = apply_filters('frm_content', $value, $form, $entry);
679
+		$value = do_shortcode($value);
680 680
 
681
-        return $value;
682
-    }
681
+		return $value;
682
+	}
683 683
 
684 684
 	public static function get_shortcodes( $content, $form_id ) {
685
-        if ( FrmAppHelper::pro_is_installed() ) {
686
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
687
-        }
685
+		if ( FrmAppHelper::pro_is_installed() ) {
686
+			return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
687
+		}
688 688
 
689
-        $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
689
+		$fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
690 690
 
691
-        $tagregexp = self::allowed_shortcodes($fields);
691
+		$tagregexp = self::allowed_shortcodes($fields);
692 692
 
693
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
693
+		preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
694 694
 
695
-        return $matches;
696
-    }
695
+		return $matches;
696
+	}
697 697
 
698 698
 	public static function allowed_shortcodes( $fields = array() ) {
699
-        $tagregexp = array(
700
-            'editlink', 'id', 'key', 'ip',
701
-            'siteurl', 'sitename', 'admin_email',
702
-            'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
699
+		$tagregexp = array(
700
+			'editlink', 'id', 'key', 'ip',
701
+			'siteurl', 'sitename', 'admin_email',
702
+			'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
703 703
 			'parent[-|_]id',
704
-        );
704
+		);
705 705
 
706
-        foreach ( $fields as $field ) {
707
-            $tagregexp[] = $field->id;
708
-            $tagregexp[] = $field->field_key;
709
-        }
706
+		foreach ( $fields as $field ) {
707
+			$tagregexp[] = $field->id;
708
+			$tagregexp[] = $field->field_key;
709
+		}
710 710
 
711
-        $tagregexp = implode('|', $tagregexp);
712
-        return $tagregexp;
713
-    }
711
+		$tagregexp = implode('|', $tagregexp);
712
+		return $tagregexp;
713
+	}
714 714
 
715 715
 	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
716
-        $shortcode_values = array(
717
-           'id'     => $entry->id,
718
-           'key'    => $entry->item_key,
719
-           'ip'     => $entry->ip,
720
-        );
716
+		$shortcode_values = array(
717
+		   'id'     => $entry->id,
718
+		   'key'    => $entry->item_key,
719
+		   'ip'     => $entry->ip,
720
+		);
721 721
 
722
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
723
-            $atts = shortcode_parse_atts( $shortcodes[3][ $short_key ] );
722
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
723
+			$atts = shortcode_parse_atts( $shortcodes[3][ $short_key ] );
724 724
 
725
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
725
+			if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
726 726
 				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
727
-                $tags = explode(' ', $tag);
728
-                if ( is_array($tags) ) {
729
-                    $tag = $tags[0];
730
-                }
731
-            } else {
732
-                $tag = $shortcodes[2][ $short_key ];
733
-            }
734
-
735
-            switch ( $tag ) {
736
-                case 'id':
737
-                case 'key':
738
-                case 'ip':
739
-                    $replace_with = $shortcode_values[ $tag ];
740
-                break;
741
-
742
-                case 'user_agent':
743
-                case 'user-agent':
744
-                    $entry->description = maybe_unserialize($entry->description);
727
+				$tags = explode(' ', $tag);
728
+				if ( is_array($tags) ) {
729
+					$tag = $tags[0];
730
+				}
731
+			} else {
732
+				$tag = $shortcodes[2][ $short_key ];
733
+			}
734
+
735
+			switch ( $tag ) {
736
+				case 'id':
737
+				case 'key':
738
+				case 'ip':
739
+					$replace_with = $shortcode_values[ $tag ];
740
+				break;
741
+
742
+				case 'user_agent':
743
+				case 'user-agent':
744
+					$entry->description = maybe_unserialize($entry->description);
745 745
 					$replace_with = FrmEntryFormat::get_browser( $entry->description['browser'] );
746
-                break;
747
-
748
-                case 'created_at':
749
-                case 'created-at':
750
-                case 'updated_at':
751
-                case 'updated-at':
752
-                    if ( isset($atts['format']) ) {
753
-                        $time_format = ' ';
754
-                    } else {
755
-                        $atts['format'] = get_option('date_format');
756
-                        $time_format = '';
757
-                    }
758
-
759
-                    $this_tag = str_replace('-', '_', $tag);
760
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
761
-                    unset($this_tag);
762
-                break;
763
-
764
-                case 'created_by':
765
-                case 'created-by':
766
-                case 'updated_by':
767
-                case 'updated-by':
768
-                    $this_tag = str_replace('-', '_', $tag);
746
+				break;
747
+
748
+				case 'created_at':
749
+				case 'created-at':
750
+				case 'updated_at':
751
+				case 'updated-at':
752
+					if ( isset($atts['format']) ) {
753
+						$time_format = ' ';
754
+					} else {
755
+						$atts['format'] = get_option('date_format');
756
+						$time_format = '';
757
+					}
758
+
759
+					$this_tag = str_replace('-', '_', $tag);
760
+					$replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
761
+					unset($this_tag);
762
+				break;
763
+
764
+				case 'created_by':
765
+				case 'created-by':
766
+				case 'updated_by':
767
+				case 'updated-by':
768
+					$this_tag = str_replace('-', '_', $tag);
769 769
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
770
-                    unset($this_tag);
771
-                break;
772
-
773
-                case 'admin_email':
774
-                case 'siteurl':
775
-                case 'frmurl':
776
-                case 'sitename':
777
-                case 'get':
778
-                    $replace_with = self::dynamic_default_values( $tag, $atts );
779
-                break;
780
-
781
-                default:
782
-                    $field = FrmField::getOne( $tag );
783
-                    if ( ! $field ) {
784
-                        break;
785
-                    }
786
-
787
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
788
-
789
-                    $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
790
-
791
-                    $atts['entry_id'] = $entry->id;
792
-                    $atts['entry_key'] = $entry->item_key;
793
-
794
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
795
-                        $replace_with = $field->name;
796
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
797
-                        $replace_with = $field->description;
770
+					unset($this_tag);
771
+				break;
772
+
773
+				case 'admin_email':
774
+				case 'siteurl':
775
+				case 'frmurl':
776
+				case 'sitename':
777
+				case 'get':
778
+					$replace_with = self::dynamic_default_values( $tag, $atts );
779
+				break;
780
+
781
+				default:
782
+					$field = FrmField::getOne( $tag );
783
+					if ( ! $field ) {
784
+						break;
785
+					}
786
+
787
+					$sep = isset($atts['sep']) ? $atts['sep'] : ', ';
788
+
789
+					$replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
790
+
791
+					$atts['entry_id'] = $entry->id;
792
+					$atts['entry_key'] = $entry->item_key;
793
+
794
+					if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
795
+						$replace_with = $field->name;
796
+					} else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
797
+						$replace_with = $field->description;
798 798
 					} else {
799 799
 						$string_value = $replace_with;
800 800
 						if ( is_array( $replace_with ) ) {
@@ -808,82 +808,82 @@  discard block
 block discarded – undo
808 808
 						}
809 809
 					}
810 810
 
811
-                    unset($field);
812
-                break;
813
-            }
811
+					unset($field);
812
+				break;
813
+			}
814 814
 
815
-            if ( isset($replace_with) ) {
816
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
817
-            }
815
+			if ( isset($replace_with) ) {
816
+				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
817
+			}
818 818
 
819
-            unset($atts, $conditional, $replace_with);
819
+			unset($atts, $conditional, $replace_with);
820 820
 		}
821 821
 
822 822
 		return $content;
823
-    }
824
-
825
-    /**
826
-     * Get the value to replace a few standard shortcodes
827
-     *
828
-     * @since 2.0
829
-     * @return string
830
-     */
831
-    public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
832
-        $new_value = '';
833
-        switch ( $tag ) {
834
-            case 'admin_email':
835
-                $new_value = get_option('admin_email');
836
-                break;
837
-            case 'siteurl':
838
-                $new_value = FrmAppHelper::site_url();
839
-                break;
840
-            case 'frmurl':
841
-                $new_value = FrmAppHelper::plugin_url();
842
-                break;
843
-            case 'sitename':
844
-                $new_value = FrmAppHelper::site_name();
845
-                break;
846
-            case 'get':
847
-                $new_value = self::process_get_shortcode( $atts, $return_array );
848
-                break;
849
-        }
850
-
851
-        return $new_value;
852
-    }
853
-
854
-    /**
855
-     * Process the [get] shortcode
856
-     *
857
-     * @since 2.0
858
-     * @return string|array
859
-     */
860
-    public static function process_get_shortcode( $atts, $return_array = false ) {
861
-        if ( ! isset($atts['param']) ) {
862
-            return '';
863
-        }
864
-
865
-        if ( strpos($atts['param'], '&#91;') ) {
866
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
867
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
868
-        }
869
-
870
-        $new_value = FrmAppHelper::get_param($atts['param'], '');
871
-        $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
872
-
873
-        if ( $new_value == '' ) {
874
-            if ( ! isset($atts['prev_val']) ) {
875
-                $atts['prev_val'] = '';
876
-            }
877
-
878
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
879
-        }
880
-
881
-        if ( is_array($new_value) && ! $return_array ) {
882
-            $new_value = implode(', ', $new_value);
883
-        }
884
-
885
-        return $new_value;
886
-    }
823
+	}
824
+
825
+	/**
826
+	 * Get the value to replace a few standard shortcodes
827
+	 *
828
+	 * @since 2.0
829
+	 * @return string
830
+	 */
831
+	public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
832
+		$new_value = '';
833
+		switch ( $tag ) {
834
+			case 'admin_email':
835
+				$new_value = get_option('admin_email');
836
+				break;
837
+			case 'siteurl':
838
+				$new_value = FrmAppHelper::site_url();
839
+				break;
840
+			case 'frmurl':
841
+				$new_value = FrmAppHelper::plugin_url();
842
+				break;
843
+			case 'sitename':
844
+				$new_value = FrmAppHelper::site_name();
845
+				break;
846
+			case 'get':
847
+				$new_value = self::process_get_shortcode( $atts, $return_array );
848
+				break;
849
+		}
850
+
851
+		return $new_value;
852
+	}
853
+
854
+	/**
855
+	 * Process the [get] shortcode
856
+	 *
857
+	 * @since 2.0
858
+	 * @return string|array
859
+	 */
860
+	public static function process_get_shortcode( $atts, $return_array = false ) {
861
+		if ( ! isset($atts['param']) ) {
862
+			return '';
863
+		}
864
+
865
+		if ( strpos($atts['param'], '&#91;') ) {
866
+			$atts['param'] = str_replace('&#91;', '[', $atts['param']);
867
+			$atts['param'] = str_replace('&#93;', ']', $atts['param']);
868
+		}
869
+
870
+		$new_value = FrmAppHelper::get_param($atts['param'], '');
871
+		$new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
872
+
873
+		if ( $new_value == '' ) {
874
+			if ( ! isset($atts['prev_val']) ) {
875
+				$atts['prev_val'] = '';
876
+			}
877
+
878
+			$new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
879
+		}
880
+
881
+		if ( is_array($new_value) && ! $return_array ) {
882
+			$new_value = implode(', ', $new_value);
883
+		}
884
+
885
+		return $new_value;
886
+	}
887 887
 
888 888
 	public static function get_display_value( $replace_with, $field, $atts = array() ) {
889 889
 		$atts['sep'] = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
@@ -891,14 +891,14 @@  discard block
 block discarded – undo
891 891
 		$replace_with = apply_filters( 'frm_get_' . $field->type . '_display_value', $replace_with, $field, $atts );
892 892
 		$replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts );
893 893
 
894
-        if ( $field->type == 'textarea' || $field->type == 'rte' ) {
895
-            $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
896
-            if ( apply_filters('frm_use_wpautop', $autop) ) {
897
-                if ( is_array($replace_with) ) {
898
-                    $replace_with = implode("\n", $replace_with);
899
-                }
900
-                $replace_with = wpautop($replace_with);
901
-            }
894
+		if ( $field->type == 'textarea' || $field->type == 'rte' ) {
895
+			$autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
896
+			if ( apply_filters('frm_use_wpautop', $autop) ) {
897
+				if ( is_array($replace_with) ) {
898
+					$replace_with = implode("\n", $replace_with);
899
+				}
900
+				$replace_with = wpautop($replace_with);
901
+			}
902 902
 			unset( $autop );
903 903
 		} else if ( is_array( $replace_with ) ) {
904 904
 			$replace_with = implode( $atts['sep'], $replace_with );
@@ -908,57 +908,57 @@  discard block
 block discarded – undo
908 908
 	}
909 909
 
910 910
 	public static function get_field_types( $type ) {
911
-        $single_input = array(
912
-            'text', 'textarea', 'rte', 'number', 'email', 'url',
913
-            'image', 'file', 'date', 'phone', 'hidden', 'time',
914
-            'user_id', 'tag', 'password',
915
-        );
911
+		$single_input = array(
912
+			'text', 'textarea', 'rte', 'number', 'email', 'url',
913
+			'image', 'file', 'date', 'phone', 'hidden', 'time',
914
+			'user_id', 'tag', 'password',
915
+		);
916 916
 		$multiple_input = array( 'radio', 'checkbox', 'select', 'scale' );
917 917
 		$other_type = array( 'divider', 'html', 'break' );
918 918
 
919 919
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
920 920
 
921
-        $field_types = array();
922
-        if ( in_array($type, $single_input) ) {
923
-            self::field_types_for_input( $single_input, $field_selection, $field_types );
924
-        } else if ( in_array($type, $multiple_input) ) {
925
-            self::field_types_for_input( $multiple_input, $field_selection, $field_types );
926
-        } else if ( in_array($type, $other_type) ) {
927
-            self::field_types_for_input( $other_type, $field_selection, $field_types );
921
+		$field_types = array();
922
+		if ( in_array($type, $single_input) ) {
923
+			self::field_types_for_input( $single_input, $field_selection, $field_types );
924
+		} else if ( in_array($type, $multiple_input) ) {
925
+			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
926
+		} else if ( in_array($type, $other_type) ) {
927
+			self::field_types_for_input( $other_type, $field_selection, $field_types );
928 928
 		} else if ( isset( $field_selection[ $type ] ) ) {
929
-            $field_types[ $type ] = $field_selection[ $type ];
930
-        }
931
-
932
-        return $field_types;
933
-    }
934
-
935
-    private static function field_types_for_input( $inputs, $fields, &$field_types ) {
936
-        foreach ( $inputs as $input ) {
937
-            $field_types[ $input ] = $fields[ $input ];
938
-            unset($input);
939
-        }
940
-    }
941
-
942
-    /**
943
-    * Check if current field option is an "other" option
944
-    *
945
-    * @since 2.0.6
946
-    *
947
-    * @param string $opt_key
948
-    * @return boolean Returns true if current field option is an "Other" option
949
-    */
950
-    public static function is_other_opt( $opt_key ) {
951
-        return $opt_key && strpos( $opt_key, 'other' ) !== false;
952
-    }
953
-
954
-    /**
955
-    * Get value that belongs in "Other" text box
956
-    *
957
-    * @since 2.0.6
958
-    *
959
-    * @param array $args
960
-    */
961
-    public static function get_other_val( $args ) {
929
+			$field_types[ $type ] = $field_selection[ $type ];
930
+		}
931
+
932
+		return $field_types;
933
+	}
934
+
935
+	private static function field_types_for_input( $inputs, $fields, &$field_types ) {
936
+		foreach ( $inputs as $input ) {
937
+			$field_types[ $input ] = $fields[ $input ];
938
+			unset($input);
939
+		}
940
+	}
941
+
942
+	/**
943
+	 * Check if current field option is an "other" option
944
+	 *
945
+	 * @since 2.0.6
946
+	 *
947
+	 * @param string $opt_key
948
+	 * @return boolean Returns true if current field option is an "Other" option
949
+	 */
950
+	public static function is_other_opt( $opt_key ) {
951
+		return $opt_key && strpos( $opt_key, 'other' ) !== false;
952
+	}
953
+
954
+	/**
955
+	 * Get value that belongs in "Other" text box
956
+	 *
957
+	 * @since 2.0.6
958
+	 *
959
+	 * @param array $args
960
+	 */
961
+	public static function get_other_val( $args ) {
962 962
 		$defaults = array(
963 963
 			'opt_key' => 0, 'field' => array(),
964 964
 			'parent' => false, 'pointer' => false,
@@ -1034,20 +1034,20 @@  discard block
 block discarded – undo
1034 1034
 		}
1035 1035
 
1036 1036
 		return $other_val;
1037
-    }
1038
-
1039
-    /**
1040
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
1041
-    * Intended for front-end use
1042
-    *
1043
-    * @since 2.0.6
1044
-    *
1045
-    * @param array $args should include field, opt_key and field name
1046
-    * @param boolean $other_opt
1047
-    * @param string $checked
1048
-    * @return string $other_val
1049
-    */
1050
-    public static function prepare_other_input( $args, &$other_opt, &$checked ) {
1037
+	}
1038
+
1039
+	/**
1040
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
1041
+	 * Intended for front-end use
1042
+	 *
1043
+	 * @since 2.0.6
1044
+	 *
1045
+	 * @param array $args should include field, opt_key and field name
1046
+	 * @param boolean $other_opt
1047
+	 * @param string $checked
1048
+	 * @return string $other_val
1049
+	 */
1050
+	public static function prepare_other_input( $args, &$other_opt, &$checked ) {
1051 1051
 		//Check if this is an "Other" option
1052 1052
 		if ( ! self::is_other_opt( $args['opt_key'] ) ) {
1053 1053
 			return;
@@ -1063,8 +1063,8 @@  discard block
 block discarded – undo
1063 1063
 			$checked = 'checked="checked" ';
1064 1064
 		}
1065 1065
 
1066
-        return $other_args;
1067
-    }
1066
+		return $other_args;
1067
+	}
1068 1068
 
1069 1069
 	/**
1070 1070
 	 * @param array $args
@@ -1113,8 +1113,8 @@  discard block
 block discarded – undo
1113 1113
 	 * @since 2.0.6
1114 1114
 	 */
1115 1115
 	public static function include_other_input( $args ) {
1116
-        if ( ! $args['other_opt'] ) {
1117
-        	return;
1116
+		if ( ! $args['other_opt'] ) {
1117
+			return;
1118 1118
 		}
1119 1119
 
1120 1120
 		$classes = array( 'frm_other_input' );
@@ -1135,15 +1135,15 @@  discard block
 block discarded – undo
1135 1135
 	}
1136 1136
 
1137 1137
 	/**
1138
-	* Get the HTML id for an "Other" text field
1139
-	* Note: This does not affect fields in repeating sections
1140
-	*
1141
-	* @since 2.0.08
1142
-	* @param string $type - field type
1143
-	* @param string $html_id
1144
-	* @param string|boolean $opt_key
1145
-	* @return string $other_id
1146
-	*/
1138
+	 * Get the HTML id for an "Other" text field
1139
+	 * Note: This does not affect fields in repeating sections
1140
+	 *
1141
+	 * @since 2.0.08
1142
+	 * @param string $type - field type
1143
+	 * @param string $html_id
1144
+	 * @param string|boolean $opt_key
1145
+	 * @return string $other_id
1146
+	 */
1147 1147
 	public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) {
1148 1148
 		$other_id = $html_id;
1149 1149
 
@@ -1201,10 +1201,10 @@  discard block
 block discarded – undo
1201 1201
 	}
1202 1202
 
1203 1203
 	public static function switch_field_ids( $val ) {
1204
-        global $frm_duplicate_ids;
1205
-        $replace = array();
1206
-        $replace_with = array();
1207
-        foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1204
+		global $frm_duplicate_ids;
1205
+		$replace = array();
1206
+		$replace_with = array();
1207
+		foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1208 1208
 			$replace[] = '[if ' . $old . ']';
1209 1209
 			$replace_with[] = '[if ' . $new . ']';
1210 1210
 			$replace[] = '[if ' . $old . ' ';
@@ -1219,153 +1219,153 @@  discard block
 block discarded – undo
1219 1219
 			$replace_with[] = '[' . $new . ']';
1220 1220
 			$replace[] = '[' . $old . ' ';
1221 1221
 			$replace_with[] = '[' . $new . ' ';
1222
-            unset($old, $new);
1223
-        }
1222
+			unset($old, $new);
1223
+		}
1224 1224
 		if ( is_array( $val ) ) {
1225 1225
 			foreach ( $val as $k => $v ) {
1226
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
1227
-                unset($k, $v);
1228
-            }
1229
-        } else {
1230
-            $val = str_replace($replace, $replace_with, $val);
1231
-        }
1232
-
1233
-        return $val;
1234
-    }
1235
-
1236
-    public static function get_us_states() {
1237
-        return apply_filters( 'frm_us_states', array(
1238
-            'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1239
-            'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1240
-            'DC' => 'District of Columbia',
1241
-            'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1242
-            'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1243
-            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1244
-            'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1245
-            'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1246
-            'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1247
-            'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1248
-            'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1249
-            'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1250
-            'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1251
-            'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1252
-        ) );
1253
-    }
1254
-
1255
-    public static function get_countries() {
1256
-        return apply_filters( 'frm_countries', array(
1257
-            __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1258
-            __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1259
-            __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1260
-            __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1261
-            __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1262
-            __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1263
-            __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1264
-            __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1265
-            __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1266
-            __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1267
-            __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1268
-            __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1269
-            __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1270
-            __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1271
-            __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1272
-            __( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1273
-            __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1274
-            __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1275
-            __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1276
-            __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1277
-            __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1278
-            __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1279
-            __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1280
-            __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1281
-            __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1282
-            __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1283
-            __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1284
-            __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1285
-            __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1286
-            __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1287
-            __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1288
-            __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1289
-            __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1290
-            __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1291
-            __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1292
-            __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1293
-            __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1294
-            __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1295
-            __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1296
-            __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1297
-            __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1298
-            __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1299
-            __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1300
-            __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1301
-            __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1302
-            __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1303
-            __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1304
-            __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1305
-            __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1306
-            __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1307
-            __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1308
-            __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1309
-            __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1310
-            __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1311
-            __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1312
-            __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1313
-            __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1314
-            __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1315
-            __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1316
-            __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1317
-            __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1318
-            __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1319
-            __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1320
-            __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1321
-            __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1322
-            __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1323
-            __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1324
-            __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1325
-            __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1326
-            __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1327
-            __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1328
-            __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1329
-            __( 'Zimbabwe', 'formidable' ),
1330
-        ) );
1331
-    }
1226
+				$val[ $k ] = str_replace( $replace, $replace_with, $v );
1227
+				unset($k, $v);
1228
+			}
1229
+		} else {
1230
+			$val = str_replace($replace, $replace_with, $val);
1231
+		}
1232
+
1233
+		return $val;
1234
+	}
1235
+
1236
+	public static function get_us_states() {
1237
+		return apply_filters( 'frm_us_states', array(
1238
+			'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1239
+			'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1240
+			'DC' => 'District of Columbia',
1241
+			'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1242
+			'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1243
+			'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1244
+			'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1245
+			'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1246
+			'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1247
+			'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1248
+			'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1249
+			'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1250
+			'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1251
+			'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1252
+		) );
1253
+	}
1254
+
1255
+	public static function get_countries() {
1256
+		return apply_filters( 'frm_countries', array(
1257
+			__( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1258
+			__( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1259
+			__( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1260
+			__( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1261
+			__( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1262
+			__( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1263
+			__( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1264
+			__( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1265
+			__( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1266
+			__( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1267
+			__( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1268
+			__( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1269
+			__( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1270
+			__( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1271
+			__( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1272
+			__( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1273
+			__( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1274
+			__( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1275
+			__( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1276
+			__( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1277
+			__( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1278
+			__( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1279
+			__( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1280
+			__( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1281
+			__( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1282
+			__( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1283
+			__( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1284
+			__( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1285
+			__( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1286
+			__( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1287
+			__( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1288
+			__( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1289
+			__( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1290
+			__( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1291
+			__( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1292
+			__( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1293
+			__( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1294
+			__( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1295
+			__( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1296
+			__( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1297
+			__( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1298
+			__( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1299
+			__( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1300
+			__( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1301
+			__( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1302
+			__( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1303
+			__( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1304
+			__( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1305
+			__( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1306
+			__( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1307
+			__( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1308
+			__( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1309
+			__( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1310
+			__( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1311
+			__( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1312
+			__( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1313
+			__( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1314
+			__( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1315
+			__( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1316
+			__( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1317
+			__( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1318
+			__( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1319
+			__( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1320
+			__( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1321
+			__( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1322
+			__( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1323
+			__( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1324
+			__( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1325
+			__( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1326
+			__( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1327
+			__( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1328
+			__( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1329
+			__( 'Zimbabwe', 'formidable' ),
1330
+		) );
1331
+	}
1332 1332
 
1333 1333
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1334 1334
 		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1335 1335
 
1336
-        $states = FrmFieldsHelper::get_us_states();
1337
-        $state_abv = array_keys($states);
1338
-        sort($state_abv);
1336
+		$states = FrmFieldsHelper::get_us_states();
1337
+		$state_abv = array_keys($states);
1338
+		sort($state_abv);
1339 1339
 		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1340 1340
 
1341
-        $states = array_values($states);
1342
-        sort($states);
1341
+		$states = array_values($states);
1342
+		sort($states);
1343 1343
 		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1344
-        unset($state_abv, $states);
1344
+		unset($state_abv, $states);
1345 1345
 
1346 1346
 		$prepop[ __( 'Age', 'formidable' ) ] = array(
1347
-            __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1348
-            __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1349
-            __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1350
-        );
1347
+			__( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1348
+			__( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1349
+			__( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1350
+		);
1351 1351
 
1352 1352
 		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1353
-            __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1354
-            __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1355
-        );
1353
+			__( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1354
+			__( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1355
+		);
1356 1356
 
1357 1357
 		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1358
-            __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1359
-            __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1360
-        );
1358
+			__( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1359
+			__( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1360
+		);
1361 1361
 
1362 1362
 		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1363
-            __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1364
-            __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1365
-        );
1363
+			__( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1364
+			__( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1365
+		);
1366 1366
 
1367 1367
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1368
-    }
1368
+	}
1369 1369
 
1370 1370
 	public static function field_selection() {
1371 1371
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::field_selection' );
@@ -1402,8 +1402,8 @@  discard block
 block discarded – undo
1402 1402
 		return FrmField::is_required( $field );
1403 1403
 	}
1404 1404
 
1405
-    public static function maybe_get_field( &$field ) {
1405
+	public static function maybe_get_field( &$field ) {
1406 1406
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::maybe_get_field' );
1407 1407
 		FrmField::maybe_get_field( $field );
1408
-    }
1408
+	}
1409 1409
 }
Please login to merge, or discard this patch.
Spacing   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined('ABSPATH') ) {
2
+if ( ! defined( 'ABSPATH' ) ) {
3 3
 	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 
8 8
 	public static function setup_new_vars( $type = '', $form_id = '' ) {
9 9
 
10
-        if ( strpos($type, '|') ) {
11
-            list($type, $setting) = explode('|', $type);
10
+        if ( strpos( $type, '|' ) ) {
11
+            list( $type, $setting ) = explode( '|', $type );
12 12
         }
13 13
 
14
-        $defaults = self::get_default_field_opts($type, $form_id);
15
-        $defaults['field_options']['custom_html'] = self::get_default_html($type);
14
+        $defaults = self::get_default_field_opts( $type, $form_id );
15
+        $defaults['field_options']['custom_html'] = self::get_default_html( $type );
16 16
 
17 17
         $values = array();
18 18
 
@@ -20,20 +20,20 @@  discard block
 block discarded – undo
20 20
             if ( $var == 'field_options' ) {
21 21
                 $values['field_options'] = array();
22 22
                 foreach ( $default as $opt_var => $opt_default ) {
23
-                    $values['field_options'][ $opt_var ] = $opt_default;
24
-                    unset($opt_var, $opt_default);
23
+                    $values['field_options'][$opt_var] = $opt_default;
24
+                    unset( $opt_var, $opt_default );
25 25
                 }
26 26
             } else {
27
-                $values[ $var ] = $default;
27
+                $values[$var] = $default;
28 28
             }
29
-            unset($var, $default);
29
+            unset( $var, $default );
30 30
         }
31 31
 
32 32
         if ( isset( $setting ) && ! empty( $setting ) ) {
33 33
             if ( 'data' == $type ) {
34 34
                 $values['field_options']['data_type'] = $setting;
35 35
             } else {
36
-                $values['field_options'][ $setting ] = 1;
36
+                $values['field_options'][$setting] = 1;
37 37
             }
38 38
         }
39 39
 
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
         }
57 57
 
58 58
 		$fields = FrmField::field_selection();
59
-        $fields = array_merge($fields, FrmField::pro_field_selection());
59
+        $fields = array_merge( $fields, FrmField::pro_field_selection() );
60 60
 
61
-        if ( isset( $fields[ $type ] ) ) {
62
-            $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ];
61
+        if ( isset( $fields[$type] ) ) {
62
+            $values['name'] = is_array( $fields[$type] ) ? $fields[$type]['name'] : $fields[$type];
63 63
         }
64 64
 
65
-        unset($fields);
65
+        unset( $fields );
66 66
 
67 67
         return $values;
68 68
     }
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
             $values['form_name'] = '';
89 89
 		} else {
90 90
 			foreach ( $defaults as $var => $default ) {
91
-                $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
92
-                unset($var, $default);
91
+                $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
92
+                unset( $var, $default );
93 93
             }
94 94
 
95 95
 			$values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : '';
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $values['options'] = $record->options;
101 101
         $values['field_options'] = $record->field_options;
102 102
 
103
-        $defaults = self::get_default_field_opts($values['type'], $record, true);
103
+        $defaults = self::get_default_field_opts( $values['type'], $record, true );
104 104
 
105 105
 		if ( $values['type'] == 'captcha' ) {
106 106
             $frm_settings = FrmAppHelper::get_settings();
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
 		foreach ( $defaults as $opt => $default ) {
111
-            $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
112
-            unset($opt, $default);
111
+            $values[$opt] = isset( $record->field_options[$opt] ) ? $record->field_options[$opt] : $default;
112
+            unset( $opt, $default );
113 113
         }
114 114
 
115
-        $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type);
115
+        $values['custom_html'] = ( isset( $record->field_options['custom_html'] ) ) ? $record->field_options['custom_html'] : self::get_default_html( $record->type );
116 116
 
117 117
 		return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) );
118 118
     }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
         global $wpdb;
133 133
 
134
-        $form_id = (is_numeric($field)) ? $field : $field->form_id;
134
+        $form_id = ( is_numeric( $field ) ) ? $field : $field->form_id;
135 135
 
136 136
 		$key = is_numeric( $field ) ? FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_fields', 'field_key' ) : $field->field_key;
137 137
 
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
 
154 154
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
155 155
         $values['form_id'] = $form_id;
156
-        $values['options'] = maybe_serialize($field->options);
157
-        $values['default_value'] = maybe_serialize($field->default_value);
156
+        $values['options'] = maybe_serialize( $field->options );
157
+        $values['default_value'] = maybe_serialize( $field->default_value );
158 158
 
159 159
         foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
160
-            $values[ $col ] = $field->{$col};
160
+            $values[$col] = $field->{$col};
161 161
         }
162 162
     }
163 163
 
@@ -170,19 +170,19 @@  discard block
 block discarded – undo
170 170
 		$field_name = is_array( $field ) ? $field['name'] : $field->name;
171 171
 
172 172
 		$defaults = array(
173
-			'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ) ),
174
-			'invalid'   => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ) ),
173
+			'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ) ),
174
+			'invalid'   => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ) ),
175 175
 			'blank'     => array( 'full' => $frm_settings->blank_msg, 'part' => $frm_settings->blank_msg ),
176 176
 		);
177 177
 
178 178
 		$msg = FrmField::get_option( $field, $error );
179
-		$msg = ( $msg == $defaults[ $error ]['full'] || empty( $msg ) ) ? $defaults[ $error ]['part'] : $msg;
179
+		$msg = ( $msg == $defaults[$error]['full'] || empty( $msg ) ) ? $defaults[$error]['part'] : $msg;
180 180
 		return $msg;
181 181
 	}
182 182
 
183 183
     public static function get_form_fields( $form_id, $error = false ) {
184
-        $fields = FrmField::get_all_for_form($form_id);
185
-        $fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error);
184
+        $fields = FrmField::get_all_for_form( $form_id );
185
+        $fields = apply_filters( 'frm_get_paged_fields', $fields, $form_id, $error );
186 186
         return $fields;
187 187
     }
188 188
 
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
 </div>
206 206
 DEFAULT_HTML;
207 207
         } else {
208
-			$default_html = apply_filters('frm_other_custom_html', '', $type);
208
+			$default_html = apply_filters( 'frm_other_custom_html', '', $type );
209 209
         }
210 210
 
211
-        return apply_filters('frm_custom_html', $default_html, $type);
211
+        return apply_filters( 'frm_custom_html', $default_html, $type );
212 212
     }
213 213
 
214 214
 	public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) {
215
-        $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
215
+        $html = apply_filters( 'frm_before_replace_shortcodes', $html, $field, $errors, $form );
216 216
 
217 217
         $defaults = array(
218 218
 			'field_name'    => 'item_meta[' . $field['id'] . ']',
@@ -220,42 +220,42 @@  discard block
 block discarded – undo
220 220
             'field_plus_id' => '',
221 221
             'section_id'    => '',
222 222
         );
223
-        $args = wp_parse_args($args, $defaults);
223
+        $args = wp_parse_args( $args, $defaults );
224 224
         $field_name = $args['field_name'];
225 225
         $field_id = $args['field_id'];
226
-        $html_id = self::get_html_id($field, $args['field_plus_id']);
226
+        $html_id = self::get_html_id( $field, $args['field_plus_id'] );
227 227
 
228
-        if ( FrmField::is_multiple_select($field) ) {
228
+        if ( FrmField::is_multiple_select( $field ) ) {
229 229
             $field_name .= '[]';
230 230
         }
231 231
 
232 232
         //replace [id]
233
-        $html = str_replace('[id]', $field_id, $html);
233
+        $html = str_replace( '[id]', $field_id, $html );
234 234
 
235 235
         // Remove the for attribute for captcha
236 236
         if ( $field['type'] == 'captcha' ) {
237
-            $html = str_replace(' for="field_[key]"', '', $html);
237
+            $html = str_replace( ' for="field_[key]"', '', $html );
238 238
         }
239 239
 
240 240
         // set the label for
241
-        $html = str_replace('field_[key]', $html_id, $html);
241
+        $html = str_replace( 'field_[key]', $html_id, $html );
242 242
 
243 243
         //replace [key]
244
-        $html = str_replace('[key]', $field['field_key'], $html);
244
+        $html = str_replace( '[key]', $field['field_key'], $html );
245 245
 
246 246
         //replace [description] and [required_label] and [error]
247 247
 		$required = FrmField::is_required( $field ) ? $field['required_indicator'] : '';
248 248
         if ( ! is_array( $errors ) ) {
249 249
             $errors = array();
250 250
         }
251
-		$error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false;
251
+		$error = isset( $errors['field' . $field_id] ) ? $errors['field' . $field_id] : false;
252 252
 
253 253
         //If field type is section heading, add class so a bottom margin can be added to either the h3 or description
254 254
         if ( $field['type'] == 'divider' ) {
255 255
             if ( FrmField::is_option_true( $field, 'description' ) ) {
256 256
                 $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
257 257
             } else {
258
-                $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
258
+                $html = str_replace( '[label_position]', '[label_position] frm_section_spacing', $html );
259 259
             }
260 260
         }
261 261
 
@@ -265,48 +265,48 @@  discard block
 block discarded – undo
265 265
 
266 266
         //replace [required_class]
267 267
 		$required_class = FrmField::is_required( $field ) ? ' frm_required_field' : '';
268
-        $html = str_replace('[required_class]', $required_class, $html);
268
+        $html = str_replace( '[required_class]', $required_class, $html );
269 269
 
270 270
         //replace [label_position]
271
-        $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
271
+        $field['label'] = apply_filters( 'frm_html_label_position', $field['label'], $field, $form );
272 272
         $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
273 273
 		$html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html );
274 274
 
275 275
         //replace [field_name]
276
-        $html = str_replace('[field_name]', $field['name'], $html);
276
+        $html = str_replace( '[field_name]', $field['name'], $html );
277 277
 
278 278
         //replace [error_class]
279
-		$error_class = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : '';
279
+		$error_class = isset( $errors['field' . $field_id] ) ? ' frm_blank_field' : '';
280 280
 		self::get_more_field_classes( $error_class, $field, $field_id, $html );
281 281
 		if ( $field['type'] == 'html' && strpos( $html, '[error_class]' ) === false ) {
282 282
 			// there is no error_class shortcode to use for addign fields
283 283
 			$html = str_replace( 'class="frm_form_field', 'class="frm_form_field ' . $error_class, $html );
284 284
 		}
285
-        $html = str_replace('[error_class]', $error_class, $html);
285
+        $html = str_replace( '[error_class]', $error_class, $html );
286 286
 
287 287
         //replace [entry_key]
288 288
         $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
289
-        $html = str_replace('[entry_key]', $entry_key, $html);
289
+        $html = str_replace( '[entry_key]', $entry_key, $html );
290 290
 
291 291
         //replace [input]
292
-        preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
292
+        preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER );
293 293
         global $frm_vars;
294 294
         $frm_settings = FrmAppHelper::get_settings();
295 295
 
296 296
         foreach ( $shortcodes[0] as $short_key => $tag ) {
297
-            $atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
297
+            $atts = shortcode_parse_atts( $shortcodes[2][$short_key] );
298 298
 			$tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) );
299 299
 
300 300
             $replace_with = '';
301 301
 
302 302
             if ( $tag == 'input' ) {
303
-                if ( isset($atts['opt']) ) {
304
-                    $atts['opt']--;
303
+                if ( isset( $atts['opt'] ) ) {
304
+                    $atts['opt'] --;
305 305
                 }
306 306
 
307
-                $field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
308
-                if ( isset($atts['class']) ) {
309
-                    unset($atts['class']);
307
+                $field['input_class'] = isset( $atts['class'] ) ? $atts['class'] : '';
308
+                if ( isset( $atts['class'] ) ) {
309
+                    unset( $atts['class'] );
310 310
                 }
311 311
 
312 312
                 $field['shortcodes'] = $atts;
@@ -315,33 +315,33 @@  discard block
 block discarded – undo
315 315
                 $replace_with = ob_get_contents();
316 316
                 ob_end_clean();
317 317
             } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
318
-                $replace_with = FrmProEntriesController::entry_delete_link($atts);
318
+                $replace_with = FrmProEntriesController::entry_delete_link( $atts );
319 319
             }
320 320
 
321
-            $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
321
+            $html = str_replace( $shortcodes[0][$short_key], $replace_with, $html );
322 322
         }
323 323
 
324 324
 		if ( $form ) {
325 325
             $form = (array) $form;
326 326
 
327 327
             //replace [form_key]
328
-            $html = str_replace('[form_key]', $form['form_key'], $html);
328
+            $html = str_replace( '[form_key]', $form['form_key'], $html );
329 329
 
330 330
             //replace [form_name]
331
-            $html = str_replace('[form_name]', $form['name'], $html);
331
+            $html = str_replace( '[form_name]', $form['name'], $html );
332 332
         }
333 333
         $html .= "\n";
334 334
 
335 335
         //Return html if conf_field to prevent loop
336
-        if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
336
+        if ( isset( $field['conf_field'] ) && $field['conf_field'] == 'stop' ) {
337 337
             return $html;
338 338
         }
339 339
 
340 340
         //If field is in repeating section
341 341
         if ( $args['section_id'] ) {
342
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ));
342
+            $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ) );
343 343
         } else {
344
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
344
+            $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ) );
345 345
         }
346 346
 
347 347
 		self::remove_collapse_shortcode( $html );
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 
419 419
 		//insert custom CSS classes
420 420
 		if ( ! empty( $field['classes'] ) ) {
421
-			if ( ! strpos( $html, 'frm_form_field ') ) {
421
+			if ( ! strpos( $html, 'frm_form_field ' ) ) {
422 422
 				$error_class .= ' frm_form_field';
423 423
 			}
424 424
 			$error_class .= ' ' . $field['classes'];
@@ -452,15 +452,15 @@  discard block
 block discarded – undo
452 452
         }
453 453
 
454 454
         $with_tags = $args['conditional_check'] ? 3 : 2;
455
-        if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
456
-            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
457
-            $tag = str_replace(']', '', $tag);
458
-            $tags = explode(' ', $tag);
459
-            if ( is_array($tags) ) {
455
+        if ( ! empty( $shortcodes[$with_tags][$short_key] ) ) {
456
+            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][$short_key] );
457
+            $tag = str_replace( ']', '', $tag );
458
+            $tags = explode( ' ', $tag );
459
+            if ( is_array( $tags ) ) {
460 460
                 $tag = $tags[0];
461 461
             }
462 462
         } else {
463
-            $tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
463
+            $tag = $shortcodes[$with_tags - 1][$short_key];
464 464
         }
465 465
 
466 466
         return $tag;
@@ -478,16 +478,16 @@  discard block
 block discarded – undo
478 478
 
479 479
 	public static function display_recaptcha( $field ) {
480 480
         $frm_settings = FrmAppHelper::get_settings();
481
-        $lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field);
481
+        $lang = apply_filters( 'frm_recaptcha_lang', $frm_settings->re_lang, $field );
482 482
 
483 483
         $api_js_url = 'https://www.google.com/recaptcha/api.js?onload=frmRecaptcha&render=explicit';
484 484
         if ( $lang != 'en' ) {
485 485
 			$api_js_url .= '&hl=' . $lang;
486 486
         }
487
-        $api_js_url = apply_filters('frm_recpatcha_js_url', $api_js_url);
487
+        $api_js_url = apply_filters( 'frm_recpatcha_js_url', $api_js_url );
488 488
 
489
-        wp_register_script('recaptcha-api', $api_js_url, '', true);
490
-        wp_enqueue_script('recaptcha-api');
489
+        wp_register_script( 'recaptcha-api', $api_js_url, '', true );
490
+        wp_enqueue_script( 'recaptcha-api' );
491 491
 
492 492
 ?>
493 493
 <div id="field_<?php echo esc_attr( $field['field_key'] ) ?>" class="frm-g-recaptcha" data-sitekey="<?php echo esc_attr( $frm_settings->pubkey ) ?>" data-size="<?php echo esc_attr( $field['captcha_size'] ) ?>"></div>
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 
497 497
 	public static function show_single_option( $field ) {
498 498
         $field_name = $field['name'];
499
-        $html_id = self::get_html_id($field);
499
+        $html_id = self::get_html_id( $field );
500 500
         foreach ( $field['options'] as $opt_key => $opt ) {
501
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
502
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
501
+            $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
502
+            $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
503 503
 
504 504
             // If this is an "Other" option, get the HTML for it
505 505
 			if ( self::is_other_opt( $opt_key ) ) {
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 
515 515
 	public static function dropdown_categories( $args ) {
516 516
 		$defaults = array( 'field' => false, 'name' => false, 'show_option_all' => ' ' );
517
-        $args = wp_parse_args($args, $defaults);
517
+        $args = wp_parse_args( $args, $defaults );
518 518
 
519 519
         if ( ! $args['field'] ) {
520 520
             return;
@@ -524,17 +524,17 @@  discard block
 block discarded – undo
524 524
 			$args['name'] = 'item_meta[' . $args['field']['id'] . ']';
525 525
         }
526 526
 
527
-        $id = self::get_html_id($args['field']);
527
+        $id = self::get_html_id( $args['field'] );
528 528
         $class = $args['field']['type'];
529 529
 
530
-        $exclude = (is_array($args['field']['exclude_cat'])) ? implode(',', $args['field']['exclude_cat']) : $args['field']['exclude_cat'];
531
-        $exclude = apply_filters('frm_exclude_cats', $exclude, $args['field']);
530
+        $exclude = ( is_array( $args['field']['exclude_cat'] ) ) ? implode( ',', $args['field']['exclude_cat'] ) : $args['field']['exclude_cat'];
531
+        $exclude = apply_filters( 'frm_exclude_cats', $exclude, $args['field'] );
532 532
 
533
-        if ( is_array($args['field']['value']) ) {
534
-            if ( ! empty($exclude) ) {
535
-                $args['field']['value'] = array_diff($args['field']['value'], explode(',', $exclude));
533
+        if ( is_array( $args['field']['value'] ) ) {
534
+            if ( ! empty( $exclude ) ) {
535
+                $args['field']['value'] = array_diff( $args['field']['value'], explode( ',', $exclude ) );
536 536
             }
537
-            $selected = reset($args['field']['value']);
537
+            $selected = reset( $args['field']['value'] );
538 538
         } else {
539 539
             $selected = $args['field']['value'];
540 540
         }
@@ -545,40 +545,40 @@  discard block
 block discarded – undo
545 545
             'hide_empty' => false, 'echo' => 0, 'orderby' => 'name',
546 546
         );
547 547
 
548
-        $tax_atts = apply_filters('frm_dropdown_cat', $tax_atts, $args['field']);
548
+        $tax_atts = apply_filters( 'frm_dropdown_cat', $tax_atts, $args['field'] );
549 549
 
550 550
         if ( FrmAppHelper::pro_is_installed() ) {
551
-            $post_type = FrmProFormsHelper::post_type($args['field']['form_id']);
552
-            $tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $args['field']);
551
+            $post_type = FrmProFormsHelper::post_type( $args['field']['form_id'] );
552
+            $tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy( $post_type, $args['field'] );
553 553
             if ( ! $tax_atts['taxonomy'] ) {
554 554
                 return;
555 555
             }
556 556
 
557 557
             // If field type is dropdown (not Dynamic), exclude children when parent is excluded
558
-            if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical($tax_atts['taxonomy']) ) {
558
+            if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical( $tax_atts['taxonomy'] ) ) {
559 559
                 $tax_atts['exclude_tree'] = $exclude;
560 560
             }
561 561
         }
562 562
 
563
-        $dropdown = wp_dropdown_categories($tax_atts);
563
+        $dropdown = wp_dropdown_categories( $tax_atts );
564 564
 
565
-        $add_html = FrmFieldsController::input_html($args['field'], false);
565
+        $add_html = FrmFieldsController::input_html( $args['field'], false );
566 566
 
567 567
         if ( FrmAppHelper::pro_is_installed() ) {
568
-            $add_html .= FrmProFieldsController::input_html($args['field'], false);
568
+            $add_html .= FrmProFieldsController::input_html( $args['field'], false );
569 569
         }
570 570
 
571 571
 		$dropdown = str_replace( "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' class='" . esc_attr( $class ) . "'", "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' " . $add_html, $dropdown );
572 572
 
573
-        if ( is_array($args['field']['value']) ) {
573
+        if ( is_array( $args['field']['value'] ) ) {
574 574
             $skip = true;
575 575
             foreach ( $args['field']['value'] as $v ) {
576 576
 				if ( $skip ) {
577 577
                     $skip = false;
578 578
                     continue;
579 579
                 }
580
-				$dropdown = str_replace(' value="' . esc_attr( $v ) . '"', ' value="' . esc_attr( $v ) . '" selected="selected"', $dropdown );
581
-                unset($v);
580
+				$dropdown = str_replace( ' value="' . esc_attr( $v ) . '"', ' value="' . esc_attr( $v ) . '" selected="selected"', $dropdown );
581
+                unset( $v );
582 582
             }
583 583
         }
584 584
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
     }
587 587
 
588 588
 	public static function get_term_link( $tax_id ) {
589
-        $tax = get_taxonomy($tax_id);
589
+        $tax = get_taxonomy( $tax_id );
590 590
         if ( ! $tax ) {
591 591
             return;
592 592
         }
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
             __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
596 596
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
597 597
         );
598
-        unset($tax);
598
+        unset( $tax );
599 599
 
600 600
         return $link;
601 601
     }
@@ -606,8 +606,8 @@  discard block
 block discarded – undo
606 606
 			$hide_opt = rtrim( $hide_opt );
607 607
 		}
608 608
 
609
-        if ( is_array($observed_value) ) {
610
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
609
+        if ( is_array( $observed_value ) ) {
610
+            return self::array_value_condition( $observed_value, $cond, $hide_opt );
611 611
         }
612 612
 
613 613
         $m = false;
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
         } else if ( $cond == '<' ) {
621 621
             $m = $observed_value < $hide_opt;
622 622
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
623
-            $m = stripos($observed_value, $hide_opt);
623
+            $m = stripos( $observed_value, $hide_opt );
624 624
             if ( $cond == 'not LIKE' ) {
625 625
                 $m = ( $m === false ) ? true : false;
626 626
             } else {
@@ -633,23 +633,23 @@  discard block
 block discarded – undo
633 633
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
634 634
         $m = false;
635 635
         if ( $cond == '==' ) {
636
-            if ( is_array($hide_opt) ) {
637
-                $m = array_intersect($hide_opt, $observed_value);
638
-                $m = empty($m) ? false : true;
636
+            if ( is_array( $hide_opt ) ) {
637
+                $m = array_intersect( $hide_opt, $observed_value );
638
+                $m = empty( $m ) ? false : true;
639 639
             } else {
640
-                $m = in_array($hide_opt, $observed_value);
640
+                $m = in_array( $hide_opt, $observed_value );
641 641
             }
642 642
         } else if ( $cond == '!=' ) {
643
-            $m = ! in_array($hide_opt, $observed_value);
643
+            $m = ! in_array( $hide_opt, $observed_value );
644 644
         } else if ( $cond == '>' ) {
645
-            $min = min($observed_value);
645
+            $min = min( $observed_value );
646 646
             $m = $min > $hide_opt;
647 647
         } else if ( $cond == '<' ) {
648
-            $max = max($observed_value);
648
+            $max = max( $observed_value );
649 649
             $m = $max < $hide_opt;
650 650
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
651 651
             foreach ( $observed_value as $ob ) {
652
-                $m = strpos($ob, $hide_opt);
652
+                $m = strpos( $ob, $hide_opt );
653 653
                 if ( $m !== false ) {
654 654
                     $m = true;
655 655
                     break;
@@ -670,27 +670,27 @@  discard block
 block discarded – undo
670 670
      * @return string
671 671
      */
672 672
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
673
-        if ( strpos($value, '[sitename]') !== false ) {
673
+        if ( strpos( $value, '[sitename]' ) !== false ) {
674 674
             $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
675
-            $value = str_replace('[sitename]', $new_value, $value);
675
+            $value = str_replace( '[sitename]', $new_value, $value );
676 676
         }
677 677
 
678
-        $value = apply_filters('frm_content', $value, $form, $entry);
679
-        $value = do_shortcode($value);
678
+        $value = apply_filters( 'frm_content', $value, $form, $entry );
679
+        $value = do_shortcode( $value );
680 680
 
681 681
         return $value;
682 682
     }
683 683
 
684 684
 	public static function get_shortcodes( $content, $form_id ) {
685 685
         if ( FrmAppHelper::pro_is_installed() ) {
686
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
686
+            return FrmProDisplaysHelper::get_shortcodes( $content, $form_id );
687 687
         }
688 688
 
689 689
         $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
690 690
 
691
-        $tagregexp = self::allowed_shortcodes($fields);
691
+        $tagregexp = self::allowed_shortcodes( $fields );
692 692
 
693
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
693
+        preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER );
694 694
 
695 695
         return $matches;
696 696
     }
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
             $tagregexp[] = $field->field_key;
709 709
         }
710 710
 
711
-        $tagregexp = implode('|', $tagregexp);
711
+        $tagregexp = implode( '|', $tagregexp );
712 712
         return $tagregexp;
713 713
     }
714 714
 
@@ -720,28 +720,28 @@  discard block
 block discarded – undo
720 720
         );
721 721
 
722 722
         foreach ( $shortcodes[0] as $short_key => $tag ) {
723
-            $atts = shortcode_parse_atts( $shortcodes[3][ $short_key ] );
723
+            $atts = shortcode_parse_atts( $shortcodes[3][$short_key] );
724 724
 
725
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
726
-				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
727
-                $tags = explode(' ', $tag);
728
-                if ( is_array($tags) ) {
725
+            if ( ! empty( $shortcodes[3][$short_key] ) ) {
726
+				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][$short_key] );
727
+                $tags = explode( ' ', $tag );
728
+                if ( is_array( $tags ) ) {
729 729
                     $tag = $tags[0];
730 730
                 }
731 731
             } else {
732
-                $tag = $shortcodes[2][ $short_key ];
732
+                $tag = $shortcodes[2][$short_key];
733 733
             }
734 734
 
735 735
             switch ( $tag ) {
736 736
                 case 'id':
737 737
                 case 'key':
738 738
                 case 'ip':
739
-                    $replace_with = $shortcode_values[ $tag ];
739
+                    $replace_with = $shortcode_values[$tag];
740 740
                 break;
741 741
 
742 742
                 case 'user_agent':
743 743
                 case 'user-agent':
744
-                    $entry->description = maybe_unserialize($entry->description);
744
+                    $entry->description = maybe_unserialize( $entry->description );
745 745
 					$replace_with = FrmEntryFormat::get_browser( $entry->description['browser'] );
746 746
                 break;
747 747
 
@@ -749,25 +749,25 @@  discard block
 block discarded – undo
749 749
                 case 'created-at':
750 750
                 case 'updated_at':
751 751
                 case 'updated-at':
752
-                    if ( isset($atts['format']) ) {
752
+                    if ( isset( $atts['format'] ) ) {
753 753
                         $time_format = ' ';
754 754
                     } else {
755
-                        $atts['format'] = get_option('date_format');
755
+                        $atts['format'] = get_option( 'date_format' );
756 756
                         $time_format = '';
757 757
                     }
758 758
 
759
-                    $this_tag = str_replace('-', '_', $tag);
760
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
761
-                    unset($this_tag);
759
+                    $this_tag = str_replace( '-', '_', $tag );
760
+                    $replace_with = FrmAppHelper::get_formatted_time( $entry->{$this_tag}, $atts['format'], $time_format );
761
+                    unset( $this_tag );
762 762
                 break;
763 763
 
764 764
                 case 'created_by':
765 765
                 case 'created-by':
766 766
                 case 'updated_by':
767 767
                 case 'updated-by':
768
-                    $this_tag = str_replace('-', '_', $tag);
768
+                    $this_tag = str_replace( '-', '_', $tag );
769 769
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
770
-                    unset($this_tag);
770
+                    unset( $this_tag );
771 771
                 break;
772 772
 
773 773
                 case 'admin_email':
@@ -784,16 +784,16 @@  discard block
 block discarded – undo
784 784
                         break;
785 785
                     }
786 786
 
787
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
787
+                    $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
788 788
 
789 789
                     $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
790 790
 
791 791
                     $atts['entry_id'] = $entry->id;
792 792
                     $atts['entry_key'] = $entry->item_key;
793 793
 
794
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
794
+                    if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) {
795 795
                         $replace_with = $field->name;
796
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
796
+                    } else if ( isset( $atts['show'] ) && $atts['show'] == 'description' ) {
797 797
                         $replace_with = $field->description;
798 798
 					} else {
799 799
 						$string_value = $replace_with;
@@ -808,15 +808,15 @@  discard block
 block discarded – undo
808 808
 						}
809 809
 					}
810 810
 
811
-                    unset($field);
811
+                    unset( $field );
812 812
                 break;
813 813
             }
814 814
 
815
-            if ( isset($replace_with) ) {
816
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
815
+            if ( isset( $replace_with ) ) {
816
+                $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content );
817 817
             }
818 818
 
819
-            unset($atts, $conditional, $replace_with);
819
+            unset( $atts, $conditional, $replace_with );
820 820
 		}
821 821
 
822 822
 		return $content;
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
         $new_value = '';
833 833
         switch ( $tag ) {
834 834
             case 'admin_email':
835
-                $new_value = get_option('admin_email');
835
+                $new_value = get_option( 'admin_email' );
836 836
                 break;
837 837
             case 'siteurl':
838 838
                 $new_value = FrmAppHelper::site_url();
@@ -858,28 +858,28 @@  discard block
 block discarded – undo
858 858
      * @return string|array
859 859
      */
860 860
     public static function process_get_shortcode( $atts, $return_array = false ) {
861
-        if ( ! isset($atts['param']) ) {
861
+        if ( ! isset( $atts['param'] ) ) {
862 862
             return '';
863 863
         }
864 864
 
865
-        if ( strpos($atts['param'], '&#91;') ) {
866
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
867
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
865
+        if ( strpos( $atts['param'], '&#91;' ) ) {
866
+            $atts['param'] = str_replace( '&#91;', '[', $atts['param'] );
867
+            $atts['param'] = str_replace( '&#93;', ']', $atts['param'] );
868 868
         }
869 869
 
870
-        $new_value = FrmAppHelper::get_param($atts['param'], '');
870
+        $new_value = FrmAppHelper::get_param( $atts['param'], '' );
871 871
         $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
872 872
 
873 873
         if ( $new_value == '' ) {
874
-            if ( ! isset($atts['prev_val']) ) {
874
+            if ( ! isset( $atts['prev_val'] ) ) {
875 875
                 $atts['prev_val'] = '';
876 876
             }
877 877
 
878
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
878
+            $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val'];
879 879
         }
880 880
 
881
-        if ( is_array($new_value) && ! $return_array ) {
882
-            $new_value = implode(', ', $new_value);
881
+        if ( is_array( $new_value ) && ! $return_array ) {
882
+            $new_value = implode( ', ', $new_value );
883 883
         }
884 884
 
885 885
         return $new_value;
@@ -892,12 +892,12 @@  discard block
 block discarded – undo
892 892
 		$replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts );
893 893
 
894 894
         if ( $field->type == 'textarea' || $field->type == 'rte' ) {
895
-            $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
896
-            if ( apply_filters('frm_use_wpautop', $autop) ) {
897
-                if ( is_array($replace_with) ) {
898
-                    $replace_with = implode("\n", $replace_with);
895
+            $autop = isset( $atts['wpautop'] ) ? $atts['wpautop'] : true;
896
+            if ( apply_filters( 'frm_use_wpautop', $autop ) ) {
897
+                if ( is_array( $replace_with ) ) {
898
+                    $replace_with = implode( "\n", $replace_with );
899 899
                 }
900
-                $replace_with = wpautop($replace_with);
900
+                $replace_with = wpautop( $replace_with );
901 901
             }
902 902
 			unset( $autop );
903 903
 		} else if ( is_array( $replace_with ) ) {
@@ -919,14 +919,14 @@  discard block
 block discarded – undo
919 919
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
920 920
 
921 921
         $field_types = array();
922
-        if ( in_array($type, $single_input) ) {
922
+        if ( in_array( $type, $single_input ) ) {
923 923
             self::field_types_for_input( $single_input, $field_selection, $field_types );
924
-        } else if ( in_array($type, $multiple_input) ) {
924
+        } else if ( in_array( $type, $multiple_input ) ) {
925 925
             self::field_types_for_input( $multiple_input, $field_selection, $field_types );
926
-        } else if ( in_array($type, $other_type) ) {
926
+        } else if ( in_array( $type, $other_type ) ) {
927 927
             self::field_types_for_input( $other_type, $field_selection, $field_types );
928
-		} else if ( isset( $field_selection[ $type ] ) ) {
929
-            $field_types[ $type ] = $field_selection[ $type ];
928
+		} else if ( isset( $field_selection[$type] ) ) {
929
+            $field_types[$type] = $field_selection[$type];
930 930
         }
931 931
 
932 932
         return $field_types;
@@ -934,8 +934,8 @@  discard block
 block discarded – undo
934 934
 
935 935
     private static function field_types_for_input( $inputs, $fields, &$field_types ) {
936 936
         foreach ( $inputs as $input ) {
937
-            $field_types[ $input ] = $fields[ $input ];
938
-            unset($input);
937
+            $field_types[$input] = $fields[$input];
938
+            unset( $input );
939 939
         }
940 940
     }
941 941
 
@@ -980,21 +980,21 @@  discard block
 block discarded – undo
980 980
 		// Check posted vals before checking saved values
981 981
 
982 982
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
983
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
983
+		if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) {
984 984
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
985
-				$other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) : '';
985
+				$other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) : '';
986 986
 			} else {
987
-				$other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] );
987
+				$other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] );
988 988
 			}
989 989
 			return $other_val;
990 990
 
991
-		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
991
+		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) {
992 992
 			// For normal fields
993 993
 
994 994
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
995
-				$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : '';
995
+				$other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : '';
996 996
 			} else {
997
-				$other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] );
997
+				$other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] );
998 998
 			}
999 999
 			return $other_val;
1000 1000
 		}
@@ -1003,8 +1003,8 @@  discard block
 block discarded – undo
1003 1003
 		if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) {
1004 1004
 			// Check if there is an "other" val in saved value and make sure the
1005 1005
 			// "other" val is not equal to the Other checkbox option
1006
-			if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
1007
-				$other_val = $field['value'][ $opt_key ];
1006
+			if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) {
1007
+				$other_val = $field['value'][$opt_key];
1008 1008
 			}
1009 1009
 		} else {
1010 1010
 			/**
@@ -1016,8 +1016,8 @@  discard block
 block discarded – undo
1016 1016
 				// Multi-select dropdowns - key is not preserved
1017 1017
 				if ( is_array( $field['value'] ) ) {
1018 1018
 					$o_key = array_search( $temp_val, $field['value'] );
1019
-					if ( isset( $field['value'][ $o_key ] ) ) {
1020
-						unset( $field['value'][ $o_key ], $o_key );
1019
+					if ( isset( $field['value'][$o_key] ) ) {
1020
+						unset( $field['value'][$o_key], $o_key );
1021 1021
 					}
1022 1022
 				} else if ( $temp_val == $field['value'] ) {
1023 1023
 					// For radio and regular dropdowns
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 	private static function set_other_name( $args, &$other_args ) {
1075 1075
 		//Set up name for other field
1076 1076
 		$other_args['name'] = str_replace( '[]', '', $args['field_name'] );
1077
-		$other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']);
1077
+		$other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] );
1078 1078
 		$other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']';
1079 1079
 
1080 1080
 		//Converts item_meta[field_id] => item_meta[other][field_id] and
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 		// Count should only be greater than 3 if inside of a repeating section
1101 1101
 		if ( count( $temp_array ) > 3 ) {
1102 1102
 			$parent = str_replace( ']', '', $temp_array[1] );
1103
-			$pointer = str_replace( ']', '', $temp_array[2]);
1103
+			$pointer = str_replace( ']', '', $temp_array[2] );
1104 1104
 		}
1105 1105
 
1106 1106
 		// Get text for "other" text field
@@ -1219,15 +1219,15 @@  discard block
 block discarded – undo
1219 1219
 			$replace_with[] = '[' . $new . ']';
1220 1220
 			$replace[] = '[' . $old . ' ';
1221 1221
 			$replace_with[] = '[' . $new . ' ';
1222
-            unset($old, $new);
1222
+            unset( $old, $new );
1223 1223
         }
1224 1224
 		if ( is_array( $val ) ) {
1225 1225
 			foreach ( $val as $k => $v ) {
1226
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
1227
-                unset($k, $v);
1226
+                $val[$k] = str_replace( $replace, $replace_with, $v );
1227
+                unset( $k, $v );
1228 1228
             }
1229 1229
         } else {
1230
-            $val = str_replace($replace, $replace_with, $val);
1230
+            $val = str_replace( $replace, $replace_with, $val );
1231 1231
         }
1232 1232
 
1233 1233
         return $val;
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
             'DC' => 'District of Columbia',
1241 1241
             'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1242 1242
             'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1243
-            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1243
+            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland',
1244 1244
             'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1245 1245
             'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1246 1246
             'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
@@ -1331,35 +1331,35 @@  discard block
 block discarded – undo
1331 1331
     }
1332 1332
 
1333 1333
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1334
-		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1334
+		$prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries();
1335 1335
 
1336 1336
         $states = FrmFieldsHelper::get_us_states();
1337
-        $state_abv = array_keys($states);
1338
-        sort($state_abv);
1339
-		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1337
+        $state_abv = array_keys( $states );
1338
+        sort( $state_abv );
1339
+		$prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv;
1340 1340
 
1341
-        $states = array_values($states);
1342
-        sort($states);
1343
-		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1344
-        unset($state_abv, $states);
1341
+        $states = array_values( $states );
1342
+        sort( $states );
1343
+		$prepop[__( 'U.S. States', 'formidable' )] = $states;
1344
+        unset( $state_abv, $states );
1345 1345
 
1346
-		$prepop[ __( 'Age', 'formidable' ) ] = array(
1346
+		$prepop[__( 'Age', 'formidable' )] = array(
1347 1347
             __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1348 1348
             __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1349 1349
             __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1350 1350
         );
1351 1351
 
1352
-		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1352
+		$prepop[__( 'Satisfaction', 'formidable' )] = array(
1353 1353
             __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1354 1354
             __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1355 1355
         );
1356 1356
 
1357
-		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1357
+		$prepop[__( 'Importance', 'formidable' )] = array(
1358 1358
             __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1359 1359
             __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1360 1360
         );
1361 1361
 
1362
-		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1362
+		$prepop[__( 'Agreement', 'formidable' )] = array(
1363 1363
             __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1364 1364
             __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1365 1365
         );
Please login to merge, or discard this patch.
classes/helpers/FrmXMLHelper.php 2 patches
Indentation   +584 added lines, -584 removed lines patch added patch discarded remove patch
@@ -23,30 +23,30 @@  discard block
 block discarded – undo
23 23
 	}
24 24
 
25 25
 	public static function import_xml( $file ) {
26
-        $defaults = array(
27
-            'forms' => 0, 'fields' => 0, 'terms' => 0,
28
-            'posts' => 0, 'views' => 0, 'actions' => 0,
29
-            'styles' => 0,
30
-        );
31
-
32
-        $imported = array(
33
-            'imported' => $defaults,
26
+		$defaults = array(
27
+			'forms' => 0, 'fields' => 0, 'terms' => 0,
28
+			'posts' => 0, 'views' => 0, 'actions' => 0,
29
+			'styles' => 0,
30
+		);
31
+
32
+		$imported = array(
33
+			'imported' => $defaults,
34 34
 			'updated'  => $defaults,
35 35
 			'forms'    => array(),
36 36
 			'terms'    => array(),
37
-        );
37
+		);
38 38
 
39
-        unset($defaults);
39
+		unset($defaults);
40 40
 
41 41
 		if ( ! defined( 'WP_IMPORTING' ) ) {
42
-            define('WP_IMPORTING', true);
43
-        }
42
+			define('WP_IMPORTING', true);
43
+		}
44 44
 
45 45
 		if ( ! class_exists( 'DOMDocument' ) ) {
46
-            return new WP_Error( 'SimpleXML_parse_error', __( 'Your server does not have XML enabled', 'formidable' ), libxml_get_errors() );
47
-        }
46
+			return new WP_Error( 'SimpleXML_parse_error', __( 'Your server does not have XML enabled', 'formidable' ), libxml_get_errors() );
47
+		}
48 48
 
49
-        $dom = new DOMDocument;
49
+		$dom = new DOMDocument;
50 50
 		$success = $dom->loadXML( file_get_contents( $file ) );
51 51
 		if ( ! $success ) {
52 52
 			return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this XML file', 'formidable' ), libxml_get_errors() );
@@ -64,45 +64,45 @@  discard block
 block discarded – undo
64 64
 			return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this XML file', 'formidable' ), libxml_get_errors() );
65 65
 		}
66 66
 
67
-        // add terms, forms (form and field ids), posts (post ids), and entries to db, in that order
67
+		// add terms, forms (form and field ids), posts (post ids), and entries to db, in that order
68 68
 		foreach ( array( 'term', 'form', 'view' ) as $item_type ) {
69
-            // grab cats, tags, and terms, or forms or posts
70
-            if ( isset($xml->{$item_type} ) ) {
69
+			// grab cats, tags, and terms, or forms or posts
70
+			if ( isset($xml->{$item_type} ) ) {
71 71
 				$function_name = 'import_xml_' . $item_type . 's';
72 72
 				$imported = self::$function_name( $xml->{$item_type}, $imported );
73 73
 				unset( $function_name, $xml->{$item_type} );
74
-            }
75
-        }
74
+			}
75
+		}
76 76
 
77
-	    $return = apply_filters('frm_importing_xml', $imported, $xml );
77
+		$return = apply_filters('frm_importing_xml', $imported, $xml );
78 78
 
79
-	    return $return;
80
-    }
79
+		return $return;
80
+	}
81 81
 
82 82
 	public static function import_xml_terms( $terms, $imported ) {
83
-        foreach ( $terms as $t ) {
83
+		foreach ( $terms as $t ) {
84 84
 			if ( term_exists((string) $t->term_slug, (string) $t->term_taxonomy) ) {
85
-			    continue;
85
+				continue;
86 86
 			}
87 87
 
88 88
 			$parent = self::get_term_parent_id( $t );
89 89
 
90 90
 			$term = wp_insert_term( (string) $t->term_name, (string) $t->term_taxonomy, array(
91
-                'slug'          => (string) $t->term_slug,
92
-                'description'   => (string) $t->term_description,
91
+				'slug'          => (string) $t->term_slug,
92
+				'description'   => (string) $t->term_description,
93 93
 				'parent'        => empty( $parent ) ? 0 : $parent,
94
-            ));
94
+			));
95 95
 
96 96
 			if ( $term && is_array( $term ) ) {
97
-                $imported['imported']['terms']++;
97
+				$imported['imported']['terms']++;
98 98
 				$imported['terms'][ (int) $t->term_id ] = $term['term_id'];
99
-            }
99
+			}
100 100
 
101 101
 			unset( $term, $t );
102 102
 		}
103 103
 
104 104
 		return $imported;
105
-    }
105
+	}
106 106
 
107 107
 	/**
108 108
 	 * @since 2.0.8
@@ -127,99 +127,99 @@  discard block
 block discarded – undo
127 127
 		self::put_child_forms_first( $forms );
128 128
 
129 129
 		foreach ( $forms as $item ) {
130
-            $form = array(
131
-                'id'            => (int) $item->id,
132
-                'form_key'      => (string) $item->form_key,
133
-                'name'          => (string) $item->name,
134
-                'description'   => (string) $item->description,
135
-                'options'       => (string) $item->options,
136
-                'logged_in'     => (int) $item->logged_in,
137
-                'is_template'   => (int) $item->is_template,
138
-                'default_template' => (int) $item->default_template,
139
-                'editable'      => (int) $item->editable,
140
-                'status'        => (string) $item->status,
141
-                'parent_form_id' => isset($item->parent_form_id) ? (int) $item->parent_form_id : 0,
142
-                'created_at'    => date('Y-m-d H:i:s', strtotime((string) $item->created_at)),
143
-            );
144
-
145
-            $form['options'] = FrmAppHelper::maybe_json_decode($form['options']);
130
+			$form = array(
131
+				'id'            => (int) $item->id,
132
+				'form_key'      => (string) $item->form_key,
133
+				'name'          => (string) $item->name,
134
+				'description'   => (string) $item->description,
135
+				'options'       => (string) $item->options,
136
+				'logged_in'     => (int) $item->logged_in,
137
+				'is_template'   => (int) $item->is_template,
138
+				'default_template' => (int) $item->default_template,
139
+				'editable'      => (int) $item->editable,
140
+				'status'        => (string) $item->status,
141
+				'parent_form_id' => isset($item->parent_form_id) ? (int) $item->parent_form_id : 0,
142
+				'created_at'    => date('Y-m-d H:i:s', strtotime((string) $item->created_at)),
143
+			);
144
+
145
+			$form['options'] = FrmAppHelper::maybe_json_decode($form['options']);
146 146
 
147 147
 			self::update_custom_style_setting_on_import( $form );
148 148
 
149
-            // if template, allow to edit if form keys match, otherwise, creation date must also match
149
+			// if template, allow to edit if form keys match, otherwise, creation date must also match
150 150
 			$edit_query = array( 'form_key' => $form['form_key'], 'is_template' => $form['is_template'] );
151
-            if ( ! $form['is_template'] ) {
152
-                $edit_query['created_at'] = $form['created_at'];
153
-            }
151
+			if ( ! $form['is_template'] ) {
152
+				$edit_query['created_at'] = $form['created_at'];
153
+			}
154 154
 
155
-            $edit_query = apply_filters('frm_match_xml_form', $edit_query, $form);
155
+			$edit_query = apply_filters('frm_match_xml_form', $edit_query, $form);
156 156
 
157
-            $this_form = FrmForm::getAll($edit_query, '', 1);
158
-            unset($edit_query);
157
+			$this_form = FrmForm::getAll($edit_query, '', 1);
158
+			unset($edit_query);
159 159
 
160
-            if ( ! empty( $this_form ) ) {
161
-                $old_id = $form_id = $this_form->id;
162
-                FrmForm::update($form_id, $form );
163
-                $imported['updated']['forms']++;
164
-                // Keep track of whether this specific form was updated or not
160
+			if ( ! empty( $this_form ) ) {
161
+				$old_id = $form_id = $this_form->id;
162
+				FrmForm::update($form_id, $form );
163
+				$imported['updated']['forms']++;
164
+				// Keep track of whether this specific form was updated or not
165 165
 				$imported['form_status'][ $form_id ] = 'updated';
166 166
 
167 167
 				$form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' );
168
-                $old_fields = array();
169
-                foreach ( $form_fields as $f ) {
168
+				$old_fields = array();
169
+				foreach ( $form_fields as $f ) {
170 170
 					$old_fields[ $f->id ] = $f;
171 171
 					$old_fields[ $f->field_key ] = $f->id;
172
-                    unset($f);
173
-                }
174
-                $form_fields = $old_fields;
175
-                unset($old_fields);
176
-            } else {
177
-                $old_id = false;
178
-                //form does not exist, so create it
172
+					unset($f);
173
+				}
174
+				$form_fields = $old_fields;
175
+				unset($old_fields);
176
+			} else {
177
+				$old_id = false;
178
+				//form does not exist, so create it
179 179
 				$form_id = FrmForm::create( $form );
180
-                if ( $form_id ) {
181
-                    $imported['imported']['forms']++;
182
-                    // Keep track of whether this specific form was updated or not
180
+				if ( $form_id ) {
181
+					$imported['imported']['forms']++;
182
+					// Keep track of whether this specific form was updated or not
183 183
 					$imported['form_status'][ $form_id ] = 'imported';
184 184
 					self::track_imported_child_forms( (int) $form_id, $form['parent_form_id'], $child_forms );
185
-                }
186
-            }
185
+				}
186
+			}
187 187
 
188
-    		self::import_xml_fields( $item->field, $form_id, $this_form, $form_fields, $imported );
188
+			self::import_xml_fields( $item->field, $form_id, $this_form, $form_fields, $imported );
189 189
 
190
-    		// Delete any fields attached to this form that were not included in the template
191
-    		if ( isset( $form_fields ) && ! empty( $form_fields ) ) {
190
+			// Delete any fields attached to this form that were not included in the template
191
+			if ( isset( $form_fields ) && ! empty( $form_fields ) ) {
192 192
 				foreach ( $form_fields as $field ) {
193
-                    if ( is_object($field) ) {
194
-                        FrmField::destroy($field->id);
195
-                    }
196
-                    unset($field);
197
-                }
198
-                unset($form_fields);
199
-            }
200
-
201
-		    // Update field ids/keys to new ones
193
+					if ( is_object($field) ) {
194
+						FrmField::destroy($field->id);
195
+					}
196
+					unset($field);
197
+				}
198
+				unset($form_fields);
199
+			}
200
+
201
+			// Update field ids/keys to new ones
202 202
 			do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) );
203 203
 
204 204
 			$imported['forms'][ (int) $item->id ] = $form_id;
205 205
 
206
-            // Send pre 2.0 form options through function that creates actions
207
-            self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, $switch = true );
206
+			// Send pre 2.0 form options through function that creates actions
207
+			self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, $switch = true );
208 208
 
209
-		    unset($form, $item);
209
+			unset($form, $item);
210 210
 		}
211 211
 
212 212
 		self::maybe_update_child_form_parent_id( $imported['forms'], $child_forms );
213 213
 
214 214
 		return $imported;
215
-    }
215
+	}
216 216
 
217 217
 	/**
218
-	* Put child forms first so they will be imported before parents
219
-	*
220
-	* @since 2.0.16
221
-	* @param array $forms
222
-	*/
218
+	 * Put child forms first so they will be imported before parents
219
+	 *
220
+	 * @since 2.0.16
221
+	 * @param array $forms
222
+	 */
223 223
 	private static function put_child_forms_first( &$forms ) {
224 224
 		$child_forms = array();
225 225
 		$regular_forms = array();
@@ -238,13 +238,13 @@  discard block
 block discarded – undo
238 238
 	}
239 239
 
240 240
 	/**
241
-	* Keep track of all imported child forms
242
-	*
243
-	* @since 2.0.16
244
-	* @param int $form_id
245
-	* @param int $parent_form_id
246
-	* @param array $child_forms
247
-	*/
241
+	 * Keep track of all imported child forms
242
+	 *
243
+	 * @since 2.0.16
244
+	 * @param int $form_id
245
+	 * @param int $parent_form_id
246
+	 * @param array $child_forms
247
+	 */
248 248
 	private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) {
249 249
 		if ( $parent_form_id ) {
250 250
 			$child_forms[ $form_id ] = $parent_form_id;
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
 	}
253 253
 
254 254
 	/**
255
-	* Update the parent_form_id on imported child forms
256
-	* Child forms are imported first so their parent_form_id will need to be updated after the parent is imported
257
-	*
258
-	* @since 2.0.6
259
-	* @param array $imported_forms
260
-	* @param array $child_forms
261
-	*/
255
+	 * Update the parent_form_id on imported child forms
256
+	 * Child forms are imported first so their parent_form_id will need to be updated after the parent is imported
257
+	 *
258
+	 * @since 2.0.6
259
+	 * @param array $imported_forms
260
+	 * @param array $child_forms
261
+	 */
262 262
 	private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) {
263 263
 		foreach ( $child_forms as $child_form_id => $old_parent_form_id ) {
264 264
 
@@ -272,61 +272,61 @@  discard block
 block discarded – undo
272 272
 	}
273 273
 
274 274
 	/**
275
-	* Import all fields for a form
276
-	* @since 2.0.13
277
-	*
278
-	* TODO: Cut down on params
279
-	*/
275
+	 * Import all fields for a form
276
+	 * @since 2.0.13
277
+	 *
278
+	 * TODO: Cut down on params
279
+	 */
280 280
 	private static function import_xml_fields( $xml_fields, $form_id, $this_form, &$form_fields, &$imported ) {
281 281
 		foreach ( $xml_fields as $field ) {
282
-		    $f = array(
283
-		        'id'            => (int) $field->id,
284
-		        'field_key'     => (string) $field->field_key,
285
-		        'name'          => (string) $field->name,
286
-		        'description'   => (string) $field->description,
287
-		        'type'          => (string) $field->type,
288
-		        'default_value' => FrmAppHelper::maybe_json_decode( (string) $field->default_value),
289
-		        'field_order'   => (int) $field->field_order,
290
-		        'form_id'       => (int) $form_id,
291
-		        'required'      => (int) $field->required,
292
-		        'options'       => FrmAppHelper::maybe_json_decode( (string) $field->options),
282
+			$f = array(
283
+				'id'            => (int) $field->id,
284
+				'field_key'     => (string) $field->field_key,
285
+				'name'          => (string) $field->name,
286
+				'description'   => (string) $field->description,
287
+				'type'          => (string) $field->type,
288
+				'default_value' => FrmAppHelper::maybe_json_decode( (string) $field->default_value),
289
+				'field_order'   => (int) $field->field_order,
290
+				'form_id'       => (int) $form_id,
291
+				'required'      => (int) $field->required,
292
+				'options'       => FrmAppHelper::maybe_json_decode( (string) $field->options),
293 293
 				'field_options' => FrmAppHelper::maybe_json_decode( (string) $field->field_options ),
294
-		    );
295
-
296
-		    if ( is_array($f['default_value']) && in_array($f['type'], array(
297
-		        'text', 'email', 'url', 'textarea',
298
-		        'number','phone', 'date', 'time',
299
-		        'hidden', 'password', 'tag', 'image',
300
-		    )) ) {
301
-		        if ( count($f['default_value']) === 1 ) {
294
+			);
295
+
296
+			if ( is_array($f['default_value']) && in_array($f['type'], array(
297
+				'text', 'email', 'url', 'textarea',
298
+				'number','phone', 'date', 'time',
299
+				'hidden', 'password', 'tag', 'image',
300
+			)) ) {
301
+				if ( count($f['default_value']) === 1 ) {
302 302
 					$f['default_value'] = '[' . reset( $f['default_value'] ) . ']';
303
-		        } else {
304
-		            $f['default_value'] = reset($f['default_value']);
305
-		        }
306
-		    }
303
+				} else {
304
+					$f['default_value'] = reset($f['default_value']);
305
+				}
306
+			}
307 307
 
308
-		    $f = apply_filters('frm_duplicated_field', $f);
308
+			$f = apply_filters('frm_duplicated_field', $f);
309 309
 
310 310
 			self::maybe_update_form_select( $f, $imported );
311 311
 
312
-		    if ( ! empty($this_form) ) {
313
-		        // check for field to edit by field id
312
+			if ( ! empty($this_form) ) {
313
+				// check for field to edit by field id
314 314
 				if ( isset( $form_fields[ $f['id'] ] ) ) {
315
-		            FrmField::update( $f['id'], $f );
316
-		            $imported['updated']['fields']++;
315
+					FrmField::update( $f['id'], $f );
316
+					$imported['updated']['fields']++;
317 317
 
318 318
 					unset( $form_fields[ $f['id'] ] );
319 319
 
320
-		            //unset old field key
320
+					//unset old field key
321 321
 					if ( isset( $form_fields[ $f['field_key'] ] ) ) {
322 322
 						unset( $form_fields[ $f['field_key'] ] );
323 323
 					}
324 324
 				} else if ( isset( $form_fields[ $f['field_key'] ] ) ) {
325
-		            // check for field to edit by field key
326
-		            unset($f['id']);
325
+					// check for field to edit by field key
326
+					unset($f['id']);
327 327
 
328 328
 					FrmField::update( $form_fields[ $f['field_key'] ], $f );
329
-		            $imported['updated']['fields']++;
329
+					$imported['updated']['fields']++;
330 330
 
331 331
 					unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id
332 332
 					unset( $form_fields[ $f['field_key'] ] ); //unset old field key
@@ -336,29 +336,29 @@  discard block
 block discarded – undo
336 336
 						continue;
337 337
 					}
338 338
 
339
-		            // if no matching field id or key in this form, create the field
340
-		            $imported['imported']['fields']++;
341
-		        }
339
+					// if no matching field id or key in this form, create the field
340
+					$imported['imported']['fields']++;
341
+				}
342 342
 			} else {
343 343
 				$new_id = FrmField::create( $f );
344 344
 				if ( $new_id == false ) {
345 345
 					continue;
346 346
 				}
347 347
 
348
-	            $imported['imported']['fields']++;
349
-		    }
348
+				$imported['imported']['fields']++;
349
+			}
350 350
 
351 351
 			unset($field, $new_id);
352 352
 		}
353 353
 	}
354 354
 
355 355
 	/**
356
-	* Switch the form_select on a repeating field or embedded form if it needs to be switched
357
-	*
358
-	* @since 2.0.16
359
-	* @param array $f
360
-	* @param array $imported
361
-	*/
356
+	 * Switch the form_select on a repeating field or embedded form if it needs to be switched
357
+	 *
358
+	 * @since 2.0.16
359
+	 * @param array $f
360
+	 * @param array $imported
361
+	 */
362 362
 	private static function maybe_update_form_select( &$f, $imported ) {
363 363
 		if ( ! isset( $imported['forms'] ) ) {
364 364
 			return;
@@ -375,12 +375,12 @@  discard block
 block discarded – undo
375 375
 	}
376 376
 
377 377
 	/**
378
-	* Updates the custom style setting on import
379
-	*
380
-	* @since 2.0.19
381
-	* @param array $form
382
-	*
383
-	*/
378
+	 * Updates the custom style setting on import
379
+	 *
380
+	 * @since 2.0.19
381
+	 * @param array $form
382
+	 *
383
+	 */
384 384
 	private static function update_custom_style_setting_on_import( &$form ) {
385 385
 		if ( ! isset( $form['options']['custom_style'] ) ) {
386 386
 			return;
@@ -410,16 +410,16 @@  discard block
 block discarded – undo
410 410
 	}
411 411
 
412 412
 	public static function import_xml_views( $views, $imported ) {
413
-        $imported['posts'] = array();
414
-        $form_action_type = FrmFormActionsController::$action_post_type;
413
+		$imported['posts'] = array();
414
+		$form_action_type = FrmFormActionsController::$action_post_type;
415 415
 
416
-        $post_types = array(
417
-            'frm_display' => 'views',
418
-            $form_action_type => 'actions',
419
-            'frm_styles'    => 'styles',
420
-        );
416
+		$post_types = array(
417
+			'frm_display' => 'views',
418
+			$form_action_type => 'actions',
419
+			'frm_styles'    => 'styles',
420
+		);
421 421
 
422
-        foreach ( $views as $item ) {
422
+		foreach ( $views as $item ) {
423 423
 			$post = array(
424 424
 				'post_title'    => (string) $item->title,
425 425
 				'post_name'     => (string) $item->post_name,
@@ -438,52 +438,52 @@  discard block
 block discarded – undo
438 438
 				'post_date'     => (string) $item->post_date,
439 439
 				'post_date_gmt' => (string) $item->post_date_gmt,
440 440
 				'ping_status'   => (string) $item->ping_status,
441
-                'postmeta'      => array(),
442
-                'tax_input'     => array(),
441
+				'postmeta'      => array(),
442
+				'tax_input'     => array(),
443 443
 			);
444 444
 
445
-            $old_id = $post['post_id'];
446
-            self::populate_post($post, $item, $imported);
445
+			$old_id = $post['post_id'];
446
+			self::populate_post($post, $item, $imported);
447 447
 
448 448
 			unset($item);
449 449
 
450 450
 			$post_id = false;
451
-            if ( $post['post_type'] == $form_action_type ) {
452
-                $action_control = FrmFormActionsController::get_form_actions( $post['post_excerpt'] );
451
+			if ( $post['post_type'] == $form_action_type ) {
452
+				$action_control = FrmFormActionsController::get_form_actions( $post['post_excerpt'] );
453 453
 				if ( $action_control ) {
454 454
 					$post_id = $action_control->maybe_create_action( $post, $imported['form_status'] );
455 455
 				}
456
-                unset($action_control);
457
-            } else if ( $post['post_type'] == 'frm_styles' ) {
458
-                // Properly encode post content before inserting the post
459
-                $post['post_content'] = FrmAppHelper::maybe_json_decode( $post['post_content'] );
460
-                $post['post_content'] = FrmAppHelper::prepare_and_encode( $post['post_content'] );
461
-
462
-                // Create/update post now
463
-                $post_id = wp_insert_post( $post );
464
-            } else {
465
-                // Create/update post now
466
-                $post_id = wp_insert_post( $post );
467
-            }
468
-
469
-            if ( ! is_numeric($post_id) ) {
470
-                continue;
471
-            }
472
-
473
-            self::update_postmeta($post, $post_id);
474
-
475
-            $this_type = 'posts';
456
+				unset($action_control);
457
+			} else if ( $post['post_type'] == 'frm_styles' ) {
458
+				// Properly encode post content before inserting the post
459
+				$post['post_content'] = FrmAppHelper::maybe_json_decode( $post['post_content'] );
460
+				$post['post_content'] = FrmAppHelper::prepare_and_encode( $post['post_content'] );
461
+
462
+				// Create/update post now
463
+				$post_id = wp_insert_post( $post );
464
+			} else {
465
+				// Create/update post now
466
+				$post_id = wp_insert_post( $post );
467
+			}
468
+
469
+			if ( ! is_numeric($post_id) ) {
470
+				continue;
471
+			}
472
+
473
+			self::update_postmeta($post, $post_id);
474
+
475
+			$this_type = 'posts';
476 476
 			if ( isset( $post_types[ $post['post_type'] ] ) ) {
477 477
 				$this_type = $post_types[ $post['post_type'] ];
478
-            }
478
+			}
479 479
 
480
-            if ( isset($post['ID']) && $post_id == $post['ID'] ) {
481
-                $imported['updated'][ $this_type ]++;
482
-            } else {
483
-                $imported['imported'][ $this_type ]++;
484
-            }
480
+			if ( isset($post['ID']) && $post_id == $post['ID'] ) {
481
+				$imported['updated'][ $this_type ]++;
482
+			} else {
483
+				$imported['imported'][ $this_type ]++;
484
+			}
485 485
 
486
-            unset($post);
486
+			unset($post);
487 487
 
488 488
 			$imported['posts'][ (int) $old_id ] = $post_id;
489 489
 		}
@@ -491,157 +491,157 @@  discard block
 block discarded – undo
491 491
 		self::maybe_update_stylesheet( $imported );
492 492
 
493 493
 		return $imported;
494
-    }
494
+	}
495 495
 
496
-    private static function populate_post( &$post, $item, $imported ) {
496
+	private static function populate_post( &$post, $item, $imported ) {
497 497
 		if ( isset($item->attachment_url) ) {
498 498
 			$post['attachment_url'] = (string) $item->attachment_url;
499 499
 		}
500 500
 
501 501
 		if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) {
502
-		    // update to new form id
503
-		    $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ];
502
+			// update to new form id
503
+			$post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ];
504 504
 		}
505 505
 
506 506
 		foreach ( $item->postmeta as $meta ) {
507
-		    self::populate_postmeta($post, $meta, $imported);
507
+			self::populate_postmeta($post, $meta, $imported);
508 508
 			unset($meta);
509 509
 		}
510 510
 
511
-        self::populate_taxonomies($post, $item);
511
+		self::populate_taxonomies($post, $item);
512 512
 
513
-        self::maybe_editing_post($post);
514
-    }
513
+		self::maybe_editing_post($post);
514
+	}
515 515
 
516
-    private static function populate_postmeta( &$post, $meta, $imported ) {
517
-        global $frm_duplicate_ids;
516
+	private static function populate_postmeta( &$post, $meta, $imported ) {
517
+		global $frm_duplicate_ids;
518 518
 
519
-	    $m = array(
519
+		$m = array(
520 520
 			'key'   => (string) $meta->meta_key,
521 521
 			'value' => (string) $meta->meta_value,
522 522
 		);
523 523
 
524 524
 		//switch old form and field ids to new ones
525 525
 		if ( $m['key'] == 'frm_form_id' && isset($imported['forms'][ (int) $m['value'] ]) ) {
526
-		    $m['value'] = $imported['forms'][ (int) $m['value'] ];
526
+			$m['value'] = $imported['forms'][ (int) $m['value'] ];
527 527
 		} else {
528
-		    $m['value'] = FrmAppHelper::maybe_json_decode($m['value']);
528
+			$m['value'] = FrmAppHelper::maybe_json_decode($m['value']);
529 529
 
530
-		    if ( ! empty($frm_duplicate_ids) ) {
530
+			if ( ! empty($frm_duplicate_ids) ) {
531 531
 
532
-		        if ( $m['key'] == 'frm_dyncontent' ) {
533
-		            $m['value'] = FrmFieldsHelper::switch_field_ids($m['value']);
534
-    		    } else if ( $m['key'] == 'frm_options' ) {
532
+				if ( $m['key'] == 'frm_dyncontent' ) {
533
+					$m['value'] = FrmFieldsHelper::switch_field_ids($m['value']);
534
+				} else if ( $m['key'] == 'frm_options' ) {
535 535
 
536 536
 					foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) {
537 537
 						if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) {
538 538
 							$m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ];
539
-    		            }
540
-    		        }
541
-
542
-                    $check_dup_array = array();
543
-    		        if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) {
544
-    		            if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) {
545
-    		                $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ];
546
-    		            } else if ( is_array( $m['value']['order_by'] ) ) {
547
-                            $check_dup_array[] = 'order_by';
548
-    		            }
549
-    		        }
550
-
551
-    		        if ( isset( $m['value']['where'] ) && ! empty( $m['value']['where'] ) ) {
552
-    		            $check_dup_array[] = 'where';
553
-    		        }
554
-
555
-                    foreach ( $check_dup_array as $check_k ) {
539
+						}
540
+					}
541
+
542
+					$check_dup_array = array();
543
+					if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) {
544
+						if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) {
545
+							$m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ];
546
+						} else if ( is_array( $m['value']['order_by'] ) ) {
547
+							$check_dup_array[] = 'order_by';
548
+						}
549
+					}
550
+
551
+					if ( isset( $m['value']['where'] ) && ! empty( $m['value']['where'] ) ) {
552
+						$check_dup_array[] = 'where';
553
+					}
554
+
555
+					foreach ( $check_dup_array as $check_k ) {
556 556
 						foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) {
557 557
 							if ( isset( $frm_duplicate_ids[ $mv ] ) ) {
558 558
 								$m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ];
559
-		                    }
560
-		                    unset($mk, $mv);
561
-		                }
562
-                    }
563
-    		    }
564
-		    }
559
+							}
560
+							unset($mk, $mv);
561
+						}
562
+					}
563
+				}
564
+			}
565 565
 		}
566 566
 
567 567
 		if ( ! is_array($m['value']) ) {
568
-		    $m['value'] = FrmAppHelper::maybe_json_decode($m['value']);
568
+			$m['value'] = FrmAppHelper::maybe_json_decode($m['value']);
569 569
 		}
570 570
 
571 571
 		$post['postmeta'][ (string) $meta->meta_key ] = $m['value'];
572
-    }
573
-
574
-    /**
575
-     * Add terms to post
576
-     * @param array $post by reference
577
-     * @param object $item The XML object data
578
-     */
579
-    private static function populate_taxonomies( &$post, $item ) {
572
+	}
573
+
574
+	/**
575
+	 * Add terms to post
576
+	 * @param array $post by reference
577
+	 * @param object $item The XML object data
578
+	 */
579
+	private static function populate_taxonomies( &$post, $item ) {
580 580
 		foreach ( $item->category as $c ) {
581 581
 			$att = $c->attributes();
582 582
 			if ( ! isset( $att['nicename'] ) ) {
583
-                continue;
584
-            }
585
-
586
-		    $taxonomy = (string) $att['domain'];
587
-		    if ( is_taxonomy_hierarchical($taxonomy) ) {
588
-		        $name = (string) $att['nicename'];
589
-		        $h_term = get_term_by('slug', $name, $taxonomy);
590
-		        if ( $h_term ) {
591
-		            $name = $h_term->term_id;
592
-		        }
593
-		        unset($h_term);
594
-		    } else {
595
-		        $name = (string) $c;
596
-		    }
583
+				continue;
584
+			}
585
+
586
+			$taxonomy = (string) $att['domain'];
587
+			if ( is_taxonomy_hierarchical($taxonomy) ) {
588
+				$name = (string) $att['nicename'];
589
+				$h_term = get_term_by('slug', $name, $taxonomy);
590
+				if ( $h_term ) {
591
+					$name = $h_term->term_id;
592
+				}
593
+				unset($h_term);
594
+			} else {
595
+				$name = (string) $c;
596
+			}
597 597
 
598 598
 			if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) {
599 599
 				$post['tax_input'][ $taxonomy ] = array();
600 600
 			}
601 601
 
602 602
 			$post['tax_input'][ $taxonomy ][] = $name;
603
-		    unset($name);
603
+			unset($name);
604 604
 		}
605
-    }
605
+	}
606 606
 
607
-    /**
608
-     * Edit post if the key and created time match
609
-     */
610
-    private static function maybe_editing_post( &$post ) {
607
+	/**
608
+	 * Edit post if the key and created time match
609
+	 */
610
+	private static function maybe_editing_post( &$post ) {
611 611
 		$match_by = array(
612
-		    'post_type'     => $post['post_type'],
613
-		    'name'          => $post['post_name'],
614
-		    'post_status'   => $post['post_status'],
615
-		    'posts_per_page' => 1,
612
+			'post_type'     => $post['post_type'],
613
+			'name'          => $post['post_name'],
614
+			'post_status'   => $post['post_status'],
615
+			'posts_per_page' => 1,
616 616
 		);
617 617
 
618 618
 		if ( in_array( $post['post_status'], array( 'trash', 'draft' ) ) ) {
619
-		    $match_by['include'] = $post['post_id'];
620
-		    unset($match_by['name']);
619
+			$match_by['include'] = $post['post_id'];
620
+			unset($match_by['name']);
621 621
 		}
622 622
 
623 623
 		$editing = get_posts($match_by);
624 624
 
625
-        if ( ! empty($editing) && current($editing)->post_date == $post['post_date'] ) {
626
-            // set the id of the post to edit
627
-            $post['ID'] = current($editing)->ID;
628
-        }
629
-    }
625
+		if ( ! empty($editing) && current($editing)->post_date == $post['post_date'] ) {
626
+			// set the id of the post to edit
627
+			$post['ID'] = current($editing)->ID;
628
+		}
629
+	}
630 630
 
631
-    private static function update_postmeta( &$post, $post_id ) {
632
-        foreach ( $post['postmeta'] as $k => $v ) {
633
-            if ( '_edit_last' == $k ) {
634
-                $v = FrmAppHelper::get_user_id_param($v);
635
-            } else if ( '_thumbnail_id' == $k && FrmAppHelper::pro_is_installed() ) {
636
-                //change the attachment ID
637
-                $v = FrmProXMLHelper::get_file_id($v);
638
-            }
631
+	private static function update_postmeta( &$post, $post_id ) {
632
+		foreach ( $post['postmeta'] as $k => $v ) {
633
+			if ( '_edit_last' == $k ) {
634
+				$v = FrmAppHelper::get_user_id_param($v);
635
+			} else if ( '_thumbnail_id' == $k && FrmAppHelper::pro_is_installed() ) {
636
+				//change the attachment ID
637
+				$v = FrmProXMLHelper::get_file_id($v);
638
+			}
639 639
 
640
-            update_post_meta($post_id, $k, $v);
640
+			update_post_meta($post_id, $k, $v);
641 641
 
642
-            unset($k, $v);
643
-        }
644
-    }
642
+			unset($k, $v);
643
+		}
644
+	}
645 645
 
646 646
 	private static function maybe_update_stylesheet( $imported ) {
647 647
 		if ( ( isset( $imported['imported']['styles'] ) && ! empty( $imported['imported']['styles'] ) ) || ( isset( $imported['updated']['styles'] ) && ! empty( $imported['updated']['styles'] ) ) ) {
@@ -652,72 +652,72 @@  discard block
 block discarded – undo
652 652
 		}
653 653
 	}
654 654
 
655
-    /**
656
-     * @param string $message
657
-     */
655
+	/**
656
+	 * @param string $message
657
+	 */
658 658
 	public static function parse_message( $result, &$message, &$errors ) {
659
-        if ( is_wp_error($result) ) {
660
-            $errors[] = $result->get_error_message();
661
-        } else if ( ! $result ) {
662
-            return;
663
-        }
664
-
665
-        if ( ! is_array($result) ) {
666
-            $message = is_string( $result ) ? $result : print_r( $result, 1 );
667
-            return;
668
-        }
669
-
670
-        $t_strings = array(
671
-            'imported'  => __( 'Imported', 'formidable' ),
672
-            'updated'   => __( 'Updated', 'formidable' ),
673
-        );
674
-
675
-        $message = '<ul>';
676
-        foreach ( $result as $type => $results ) {
659
+		if ( is_wp_error($result) ) {
660
+			$errors[] = $result->get_error_message();
661
+		} else if ( ! $result ) {
662
+			return;
663
+		}
664
+
665
+		if ( ! is_array($result) ) {
666
+			$message = is_string( $result ) ? $result : print_r( $result, 1 );
667
+			return;
668
+		}
669
+
670
+		$t_strings = array(
671
+			'imported'  => __( 'Imported', 'formidable' ),
672
+			'updated'   => __( 'Updated', 'formidable' ),
673
+		);
674
+
675
+		$message = '<ul>';
676
+		foreach ( $result as $type => $results ) {
677 677
 			if ( ! isset( $t_strings[ $type ] ) ) {
678
-                // only print imported and updated
679
-                continue;
680
-            }
678
+				// only print imported and updated
679
+				continue;
680
+			}
681 681
 
682
-            $s_message = array();
683
-            foreach ( $results as $k => $m ) {
684
-                self::item_count_message($m, $k, $s_message);
685
-                unset($k, $m);
686
-            }
682
+			$s_message = array();
683
+			foreach ( $results as $k => $m ) {
684
+				self::item_count_message($m, $k, $s_message);
685
+				unset($k, $m);
686
+			}
687 687
 
688
-            if ( ! empty($s_message) ) {
688
+			if ( ! empty($s_message) ) {
689 689
 				$message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> ';
690
-                $message .= implode(', ', $s_message);
691
-                $message .= '</li>';
692
-            }
693
-        }
694
-
695
-        if ( $message == '<ul>' ) {
696
-            $message = '';
697
-            $errors[] = __( 'Nothing was imported or updated', 'formidable' );
698
-        } else {
699
-            $message .= '</ul>';
700
-        }
701
-    }
690
+				$message .= implode(', ', $s_message);
691
+				$message .= '</li>';
692
+			}
693
+		}
694
+
695
+		if ( $message == '<ul>' ) {
696
+			$message = '';
697
+			$errors[] = __( 'Nothing was imported or updated', 'formidable' );
698
+		} else {
699
+			$message .= '</ul>';
700
+		}
701
+	}
702 702
 
703 703
 	public static function item_count_message( $m, $type, &$s_message ) {
704
-        if ( ! $m ) {
705
-            return;
706
-        }
707
-
708
-        $strings = array(
709
-            'forms'     => sprintf( _n( '%1$s Form', '%1$s Forms', $m, 'formidable' ), $m ),
710
-            'fields'    => sprintf( _n( '%1$s Field', '%1$s Fields', $m, 'formidable' ), $m ),
711
-            'items'     => sprintf( _n( '%1$s Entry', '%1$s Entries', $m, 'formidable' ), $m ),
712
-            'views'     => sprintf( _n( '%1$s View', '%1$s Views', $m, 'formidable' ), $m ),
713
-            'posts'     => sprintf( _n( '%1$s Post', '%1$s Posts', $m, 'formidable' ), $m ),
714
-            'styles'     => sprintf( _n( '%1$s Style', '%1$s Styles', $m, 'formidable' ), $m ),
715
-            'terms'     => sprintf( _n( '%1$s Term', '%1$s Terms', $m, 'formidable' ), $m ),
716
-            'actions'   => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ),
717
-        );
704
+		if ( ! $m ) {
705
+			return;
706
+		}
707
+
708
+		$strings = array(
709
+			'forms'     => sprintf( _n( '%1$s Form', '%1$s Forms', $m, 'formidable' ), $m ),
710
+			'fields'    => sprintf( _n( '%1$s Field', '%1$s Fields', $m, 'formidable' ), $m ),
711
+			'items'     => sprintf( _n( '%1$s Entry', '%1$s Entries', $m, 'formidable' ), $m ),
712
+			'views'     => sprintf( _n( '%1$s View', '%1$s Views', $m, 'formidable' ), $m ),
713
+			'posts'     => sprintf( _n( '%1$s Post', '%1$s Posts', $m, 'formidable' ), $m ),
714
+			'styles'     => sprintf( _n( '%1$s Style', '%1$s Styles', $m, 'formidable' ), $m ),
715
+			'terms'     => sprintf( _n( '%1$s Term', '%1$s Terms', $m, 'formidable' ), $m ),
716
+			'actions'   => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ),
717
+		);
718 718
 
719 719
 		$s_message[] = isset( $strings[ $type ] ) ? $strings[ $type ] : ' ' . $m . ' ' . ucfirst( $type );
720
-    }
720
+	}
721 721
 
722 722
 	/**
723 723
 	 * Prepare the form options for export
@@ -748,16 +748,16 @@  discard block
 block discarded – undo
748 748
 	}
749 749
 
750 750
 	public static function cdata( $str ) {
751
-	    $str = maybe_unserialize($str);
752
-	    if ( is_array($str) ) {
753
-	        $str = json_encode($str);
751
+		$str = maybe_unserialize($str);
752
+		if ( is_array($str) ) {
753
+			$str = json_encode($str);
754 754
 		} else if ( seems_utf8( $str ) == false ) {
755 755
 			$str = utf8_encode( $str );
756 756
 		}
757 757
 
758
-        if ( is_numeric($str) ) {
759
-            return $str;
760
-        }
758
+		if ( is_numeric($str) ) {
759
+			return $str;
760
+		}
761 761
 
762 762
 		self::remove_invalid_characters_from_xml( $str );
763 763
 
@@ -778,58 +778,58 @@  discard block
 block discarded – undo
778 778
 		$str = str_replace( '\x1F', '', $str );
779 779
 	}
780 780
 
781
-    public static function migrate_form_settings_to_actions( $form_options, $form_id, &$imported = array(), $switch = false ) {
782
-        // Get post type
783
-        $post_type = FrmFormActionsController::$action_post_type;
784
-
785
-        // Set up imported index, if not set up yet
786
-        if ( ! isset( $imported['imported']['actions'] ) ) {
787
-            $imported['imported']['actions'] = 0;
788
-        }
789
-
790
-        // Migrate post settings to action
791
-        self::migrate_post_settings_to_action( $form_options, $form_id, $post_type, $imported, $switch );
792
-
793
-        // Migrate email settings to action
794
-        self::migrate_email_settings_to_action( $form_options, $form_id, $post_type, $imported, $switch );
795
-    }
796
-
797
-    /**
798
-    * Migrate post settings to form action
799
-    *
800
-    * @param string $post_type
801
-    */
802
-    private static function migrate_post_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) {
803
-        if ( ! isset($form_options['create_post']) || ! $form_options['create_post'] ) {
804
-            return;
805
-        }
806
-
807
-        $new_action = array(
808
-            'post_type'     => $post_type,
809
-            'post_excerpt'  => 'wppost',
781
+	public static function migrate_form_settings_to_actions( $form_options, $form_id, &$imported = array(), $switch = false ) {
782
+		// Get post type
783
+		$post_type = FrmFormActionsController::$action_post_type;
784
+
785
+		// Set up imported index, if not set up yet
786
+		if ( ! isset( $imported['imported']['actions'] ) ) {
787
+			$imported['imported']['actions'] = 0;
788
+		}
789
+
790
+		// Migrate post settings to action
791
+		self::migrate_post_settings_to_action( $form_options, $form_id, $post_type, $imported, $switch );
792
+
793
+		// Migrate email settings to action
794
+		self::migrate_email_settings_to_action( $form_options, $form_id, $post_type, $imported, $switch );
795
+	}
796
+
797
+	/**
798
+	 * Migrate post settings to form action
799
+	 *
800
+	 * @param string $post_type
801
+	 */
802
+	private static function migrate_post_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) {
803
+		if ( ! isset($form_options['create_post']) || ! $form_options['create_post'] ) {
804
+			return;
805
+		}
806
+
807
+		$new_action = array(
808
+			'post_type'     => $post_type,
809
+			'post_excerpt'  => 'wppost',
810 810
 			'post_title'    => __( 'Create Posts', 'formidable' ),
811
-            'menu_order'    => $form_id,
812
-            'post_status'   => 'publish',
813
-            'post_content'  => array(),
811
+			'menu_order'    => $form_id,
812
+			'post_status'   => 'publish',
813
+			'post_content'  => array(),
814 814
 			'post_name'     => $form_id . '_wppost_1',
815
-        );
815
+		);
816 816
 
817
-        $post_settings = array(
818
-            'post_type', 'post_category', 'post_content',
819
-            'post_excerpt', 'post_title', 'post_name', 'post_date',
817
+		$post_settings = array(
818
+			'post_type', 'post_category', 'post_content',
819
+			'post_excerpt', 'post_title', 'post_name', 'post_date',
820 820
 			'post_status', 'post_custom_fields', 'post_password',
821
-        );
821
+		);
822 822
 
823
-        foreach ( $post_settings as $post_setting ) {
823
+		foreach ( $post_settings as $post_setting ) {
824 824
 			if ( isset( $form_options[ $post_setting ] ) ) {
825 825
 				$new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ];
826
-            }
827
-            unset($post_setting);
828
-        }
826
+			}
827
+			unset($post_setting);
828
+		}
829 829
 
830 830
 		$new_action['event'] = array( 'create', 'update' );
831 831
 
832
-        if ( $switch ) {
832
+		if ( $switch ) {
833 833
 			// Fields with string or int saved
834 834
 			$basic_fields = array( 'post_title', 'post_content', 'post_excerpt', 'post_password', 'post_date', 'post_status' );
835 835
 
@@ -837,22 +837,22 @@  discard block
 block discarded – undo
837 837
 			$array_fields = array( 'post_category', 'post_custom_fields' );
838 838
 
839 839
 			$new_action['post_content'] = self::switch_action_field_ids( $new_action['post_content'], $basic_fields, $array_fields );
840
-        }
841
-        $new_action['post_content'] = json_encode($new_action['post_content']);
840
+		}
841
+		$new_action['post_content'] = json_encode($new_action['post_content']);
842 842
 
843
-        $exists = get_posts( array(
844
-            'name'          => $new_action['post_name'],
845
-            'post_type'     => $new_action['post_type'],
846
-            'post_status'   => $new_action['post_status'],
847
-            'numberposts'   => 1,
848
-        ) );
843
+		$exists = get_posts( array(
844
+			'name'          => $new_action['post_name'],
845
+			'post_type'     => $new_action['post_type'],
846
+			'post_status'   => $new_action['post_status'],
847
+			'numberposts'   => 1,
848
+		) );
849 849
 
850
-        if ( ! $exists ) {
850
+		if ( ! $exists ) {
851 851
 			// this isn't an email, but we need to use a class that will always be included
852 852
 			FrmAppHelper::save_json_post( $new_action );
853
-            $imported['imported']['actions']++;
854
-        }
855
-    }
853
+			$imported['imported']['actions']++;
854
+		}
855
+	}
856 856
 
857 857
 	/**
858 858
 	 * Switch old field IDs for new field IDs in emails and post
@@ -865,211 +865,211 @@  discard block
 block discarded – undo
865 865
 	 * @return string $post_content - new field IDs
866 866
 	 */
867 867
 	private static function switch_action_field_ids( $post_content, $basic_fields, $array_fields = array() ) {
868
-        global $frm_duplicate_ids;
868
+		global $frm_duplicate_ids;
869 869
 
870
-        // If there aren't IDs that were switched, end now
871
-        if ( ! $frm_duplicate_ids ) {
872
-            return;
873
-        }
870
+		// If there aren't IDs that were switched, end now
871
+		if ( ! $frm_duplicate_ids ) {
872
+			return;
873
+		}
874 874
 
875
-        // Get old IDs
876
-        $old = array_keys( $frm_duplicate_ids );
875
+		// Get old IDs
876
+		$old = array_keys( $frm_duplicate_ids );
877 877
 
878
-        // Get new IDs
879
-        $new = array_values( $frm_duplicate_ids );
878
+		// Get new IDs
879
+		$new = array_values( $frm_duplicate_ids );
880 880
 
881
-        // Do a str_replace with each item to set the new IDs
882
-        foreach ( $post_content as $key => $setting ) {
883
-            if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) {
884
-                // Replace old IDs with new IDs
881
+		// Do a str_replace with each item to set the new IDs
882
+		foreach ( $post_content as $key => $setting ) {
883
+			if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) {
884
+				// Replace old IDs with new IDs
885 885
 				$post_content[ $key ] = str_replace( $old, $new, $setting );
886
-            } else if ( is_array( $setting ) && in_array( $key, $array_fields ) ) {
887
-                foreach ( $setting as $k => $val ) {
888
-                    // Replace old IDs with new IDs
886
+			} else if ( is_array( $setting ) && in_array( $key, $array_fields ) ) {
887
+				foreach ( $setting as $k => $val ) {
888
+					// Replace old IDs with new IDs
889 889
 					$post_content[ $key ][ $k ] = str_replace( $old, $new, $val );
890
-                }
891
-            }
892
-            unset( $key, $setting );
893
-        }
894
-        return $post_content;
895
-    }
896
-
897
-    private static function migrate_email_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) {
898
-        // No old notifications or autoresponders to carry over
890
+				}
891
+			}
892
+			unset( $key, $setting );
893
+		}
894
+		return $post_content;
895
+	}
896
+
897
+	private static function migrate_email_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) {
898
+		// No old notifications or autoresponders to carry over
899 899
 		if ( ! isset( $form_options['auto_responder'] ) && ! isset( $form_options['notification'] ) && ! isset( $form_options['email_to'] ) ) {
900
-            return;
901
-        }
900
+			return;
901
+		}
902 902
 
903
-        // Initialize notifications array
904
-        $notifications = array();
903
+		// Initialize notifications array
904
+		$notifications = array();
905 905
 
906
-        // Migrate regular notifications
907
-        self::migrate_notifications_to_action( $form_options, $form_id, $notifications );
906
+		// Migrate regular notifications
907
+		self::migrate_notifications_to_action( $form_options, $form_id, $notifications );
908 908
 
909
-        // Migrate autoresponders
910
-        self::migrate_autoresponder_to_action( $form_options, $form_id, $notifications );
909
+		// Migrate autoresponders
910
+		self::migrate_autoresponder_to_action( $form_options, $form_id, $notifications );
911 911
 
912
-        if (  empty( $notifications ) ) {
913
-            return;
914
-        }
912
+		if (  empty( $notifications ) ) {
913
+			return;
914
+		}
915 915
 
916
-        foreach ( $notifications as $new_notification ) {
917
-            $new_notification['post_type']      = $post_type;
918
-            $new_notification['post_excerpt']   = 'email';
916
+		foreach ( $notifications as $new_notification ) {
917
+			$new_notification['post_type']      = $post_type;
918
+			$new_notification['post_excerpt']   = 'email';
919 919
 			$new_notification['post_title']     = __( 'Email Notification', 'formidable' );
920
-            $new_notification['menu_order']     = $form_id;
921
-            $new_notification['post_status']    = 'publish';
920
+			$new_notification['menu_order']     = $form_id;
921
+			$new_notification['post_status']    = 'publish';
922 922
 
923
-            // Switch field IDs and keys, if needed
924
-            if ( $switch ) {
923
+			// Switch field IDs and keys, if needed
924
+			if ( $switch ) {
925 925
 
926 926
 				// Switch field IDs in email conditional logic
927 927
 				self::switch_email_contition_field_ids( $new_notification['post_content'] );
928 928
 
929 929
 				// Switch all other field IDs in email
930
-                $new_notification['post_content'] = FrmFieldsHelper::switch_field_ids( $new_notification['post_content'] );
931
-            }
932
-            $new_notification['post_content']   = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] );
933
-
934
-            $exists = get_posts( array(
935
-                'name'          => $new_notification['post_name'],
936
-                'post_type'     => $new_notification['post_type'],
937
-                'post_status'   => $new_notification['post_status'],
938
-                'numberposts'   => 1,
939
-            ) );
940
-
941
-            if ( empty($exists) ) {
930
+				$new_notification['post_content'] = FrmFieldsHelper::switch_field_ids( $new_notification['post_content'] );
931
+			}
932
+			$new_notification['post_content']   = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] );
933
+
934
+			$exists = get_posts( array(
935
+				'name'          => $new_notification['post_name'],
936
+				'post_type'     => $new_notification['post_type'],
937
+				'post_status'   => $new_notification['post_status'],
938
+				'numberposts'   => 1,
939
+			) );
940
+
941
+			if ( empty($exists) ) {
942 942
 				FrmAppHelper::save_json_post( $new_notification );
943
-                $imported['imported']['actions']++;
944
-            }
945
-            unset($new_notification);
946
-        }
947
-    }
948
-
949
-    private static function migrate_notifications_to_action( $form_options, $form_id, &$notifications ) {
950
-        if ( ! isset( $form_options['notification'] ) && isset( $form_options['email_to'] ) && ! empty( $form_options['email_to'] ) ) {
951
-            // add old settings into notification array
943
+				$imported['imported']['actions']++;
944
+			}
945
+			unset($new_notification);
946
+		}
947
+	}
948
+
949
+	private static function migrate_notifications_to_action( $form_options, $form_id, &$notifications ) {
950
+		if ( ! isset( $form_options['notification'] ) && isset( $form_options['email_to'] ) && ! empty( $form_options['email_to'] ) ) {
951
+			// add old settings into notification array
952 952
 			$form_options['notification'] = array( 0 => $form_options );
953
-        } else if ( isset( $form_options['notification']['email_to'] ) ) {
954
-            // make sure it's in the correct format
953
+		} else if ( isset( $form_options['notification']['email_to'] ) ) {
954
+			// make sure it's in the correct format
955 955
 			$form_options['notification'] = array( 0 => $form_options['notification'] );
956
-        }
956
+		}
957 957
 
958
-        if ( isset( $form_options['notification'] ) && is_array($form_options['notification']) ) {
959
-            foreach ( $form_options['notification'] as $email_key => $notification ) {
958
+		if ( isset( $form_options['notification'] ) && is_array($form_options['notification']) ) {
959
+			foreach ( $form_options['notification'] as $email_key => $notification ) {
960 960
 
961
-                $atts = array( 'email_to' => '', 'reply_to' => '', 'reply_to_name' => '', 'event' => '', 'form_id' => $form_id, 'email_key' => $email_key );
961
+				$atts = array( 'email_to' => '', 'reply_to' => '', 'reply_to_name' => '', 'event' => '', 'form_id' => $form_id, 'email_key' => $email_key );
962 962
 
963
-                // Format the email data
964
-                self::format_email_data( $atts, $notification );
963
+				// Format the email data
964
+				self::format_email_data( $atts, $notification );
965 965
 
966 966
 				if ( isset( $notification['twilio'] ) && $notification['twilio'] ) {
967 967
 					do_action( 'frm_create_twilio_action', $atts, $notification );
968 968
 				}
969 969
 
970
-                // Setup the new notification
971
-                $new_notification = array();
972
-                self::setup_new_notification( $new_notification, $notification, $atts );
970
+				// Setup the new notification
971
+				$new_notification = array();
972
+				self::setup_new_notification( $new_notification, $notification, $atts );
973 973
 
974
-                $notifications[] = $new_notification;
975
-            }
976
-        }
977
-    }
974
+				$notifications[] = $new_notification;
975
+			}
976
+		}
977
+	}
978 978
 
979
-    private static function format_email_data( &$atts, $notification ) {
980
-        // Format email_to
981
-        self::format_email_to_data( $atts, $notification );
979
+	private static function format_email_data( &$atts, $notification ) {
980
+		// Format email_to
981
+		self::format_email_to_data( $atts, $notification );
982 982
 
983
-        // Format the reply to email and name
984
-        $reply_fields = array( 'reply_to' => '', 'reply_to_name' => '' );
985
-        foreach ( $reply_fields as $f => $val ) {
983
+		// Format the reply to email and name
984
+		$reply_fields = array( 'reply_to' => '', 'reply_to_name' => '' );
985
+		foreach ( $reply_fields as $f => $val ) {
986 986
 			if ( isset( $notification[ $f ] ) ) {
987 987
 				$atts[ $f ] = $notification[ $f ];
988 988
 				if ( 'custom' == $notification[ $f ] ) {
989 989
 					$atts[ $f ] = $notification[ 'cust_' . $f ];
990 990
 				} else if ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) {
991 991
 					$atts[ $f ] = '[' . $atts[ $f ] . ']';
992
-                }
993
-            }
994
-            unset( $f, $val );
995
-        }
992
+				}
993
+			}
994
+			unset( $f, $val );
995
+		}
996 996
 
997
-        // Format event
997
+		// Format event
998 998
 		$atts['event'] = array( 'create' );
999
-        if ( isset( $notification['update_email'] ) && 1 == $notification['update_email'] ) {
1000
-            $atts['event'][] = 'update';
1001
-        } else if ( isset($notification['update_email']) && 2 == $notification['update_email'] ) {
999
+		if ( isset( $notification['update_email'] ) && 1 == $notification['update_email'] ) {
1000
+			$atts['event'][] = 'update';
1001
+		} else if ( isset($notification['update_email']) && 2 == $notification['update_email'] ) {
1002 1002
 			$atts['event'] = array( 'update' );
1003
-        }
1004
-    }
1003
+		}
1004
+	}
1005 1005
 
1006
-    private static function format_email_to_data( &$atts, $notification ) {
1007
-        if ( isset( $notification['email_to'] ) ) {
1006
+	private static function format_email_to_data( &$atts, $notification ) {
1007
+		if ( isset( $notification['email_to'] ) ) {
1008 1008
 			$atts['email_to'] = preg_split( '/ (,|;) /', $notification['email_to'] );
1009
-        } else {
1010
-            $atts['email_to'] = array();
1011
-        }
1009
+		} else {
1010
+			$atts['email_to'] = array();
1011
+		}
1012 1012
 
1013
-        if ( isset( $notification['also_email_to'] ) ) {
1014
-            $email_fields = (array) $notification['also_email_to'];
1015
-            $atts['email_to'] = array_merge( $email_fields, $atts['email_to'] );
1016
-            unset( $email_fields );
1017
-        }
1013
+		if ( isset( $notification['also_email_to'] ) ) {
1014
+			$email_fields = (array) $notification['also_email_to'];
1015
+			$atts['email_to'] = array_merge( $email_fields, $atts['email_to'] );
1016
+			unset( $email_fields );
1017
+		}
1018 1018
 
1019
-        foreach ( $atts['email_to'] as $key => $email_field ) {
1019
+		foreach ( $atts['email_to'] as $key => $email_field ) {
1020 1020
 
1021
-            if ( is_numeric( $email_field ) ) {
1021
+			if ( is_numeric( $email_field ) ) {
1022 1022
 				$atts['email_to'][ $key ] = '[' . $email_field . ']';
1023
-            }
1023
+			}
1024 1024
 
1025
-            if ( strpos( $email_field, '|') ) {
1026
-                $email_opt = explode( '|', $email_field );
1027
-                if ( isset( $email_opt[0] ) ) {
1025
+			if ( strpos( $email_field, '|') ) {
1026
+				$email_opt = explode( '|', $email_field );
1027
+				if ( isset( $email_opt[0] ) ) {
1028 1028
 					$atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']';
1029
-                }
1030
-                unset( $email_opt );
1031
-            }
1032
-        }
1033
-        $atts['email_to'] = implode(', ', $atts['email_to']);
1034
-    }
1035
-
1036
-    private static function setup_new_notification( &$new_notification, $notification, $atts ) {
1037
-        // Set up new notification
1038
-        $new_notification = array(
1039
-            'post_content'  => array(
1040
-                'email_to'      => $atts['email_to'],
1041
-                'event'         => $atts['event'],
1042
-            ),
1029
+				}
1030
+				unset( $email_opt );
1031
+			}
1032
+		}
1033
+		$atts['email_to'] = implode(', ', $atts['email_to']);
1034
+	}
1035
+
1036
+	private static function setup_new_notification( &$new_notification, $notification, $atts ) {
1037
+		// Set up new notification
1038
+		$new_notification = array(
1039
+			'post_content'  => array(
1040
+				'email_to'      => $atts['email_to'],
1041
+				'event'         => $atts['event'],
1042
+			),
1043 1043
 			'post_name'         => $atts['form_id'] . '_email_' . $atts['email_key'],
1044
-        );
1044
+		);
1045 1045
 
1046
-        // Add more fields to the new notification
1047
-        $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' );
1048
-        foreach ( $add_fields as $add_field ) {
1046
+		// Add more fields to the new notification
1047
+		$add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' );
1048
+		foreach ( $add_fields as $add_field ) {
1049 1049
 			if ( isset( $notification[ $add_field ] ) ) {
1050 1050
 				$new_notification['post_content'][ $add_field ] = $notification[ $add_field ];
1051
-            } else if ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) {
1051
+			} else if ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) {
1052 1052
 				$new_notification['post_content'][ $add_field ] = 0;
1053
-            } else {
1053
+			} else {
1054 1054
 				$new_notification['post_content'][ $add_field ] = '';
1055
-            }
1056
-            unset( $add_field );
1057
-        }
1055
+			}
1056
+			unset( $add_field );
1057
+		}
1058 1058
 
1059 1059
 		// Set reply to
1060 1060
 		$new_notification['post_content']['reply_to'] = $atts['reply_to'];
1061 1061
 
1062
-        // Set from
1062
+		// Set from
1063 1063
 		if ( ! empty( $atts['reply_to'] ) || ! empty( $atts['reply_to_name'] ) ) {
1064 1064
 			$new_notification['post_content']['from'] = ( empty( $atts['reply_to_name'] ) ? '[sitename]' : $atts['reply_to_name'] ) . ' <' . ( empty( $atts['reply_to'] ) ? '[admin_email]' : $atts['reply_to'] ) . '>';
1065
-        }
1066
-    }
1065
+		}
1066
+	}
1067 1067
 
1068 1068
 	/**
1069
-	* Switch field IDs in pre-2.0 email conditional logic
1070
-	*
1071
-	* @param $post_content array, pass by reference
1072
-	*/
1069
+	 * Switch field IDs in pre-2.0 email conditional logic
1070
+	 *
1071
+	 * @param $post_content array, pass by reference
1072
+	 */
1073 1073
 	private static function switch_email_contition_field_ids( &$post_content ) {
1074 1074
 		// Switch field IDs in conditional logic
1075 1075
 		if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) {
@@ -1082,36 +1082,36 @@  discard block
 block discarded – undo
1082 1082
 		}
1083 1083
 	}
1084 1084
 
1085
-    private static function migrate_autoresponder_to_action( $form_options, $form_id, &$notifications ) {
1086
-        if ( isset($form_options['auto_responder']) && $form_options['auto_responder'] && isset($form_options['ar_email_message']) && $form_options['ar_email_message'] ) {
1087
-            // migrate autoresponder
1088
-
1089
-            $email_field = isset($form_options['ar_email_to']) ? $form_options['ar_email_to'] : 0;
1090
-            if ( strpos($email_field, '|') ) {
1091
-                // data from entries field
1092
-                $email_field = explode('|', $email_field);
1093
-                if ( isset($email_field[1]) ) {
1094
-                    $email_field = $email_field[1];
1095
-                }
1096
-            }
1097
-            if ( is_numeric($email_field) && ! empty($email_field) ) {
1085
+	private static function migrate_autoresponder_to_action( $form_options, $form_id, &$notifications ) {
1086
+		if ( isset($form_options['auto_responder']) && $form_options['auto_responder'] && isset($form_options['ar_email_message']) && $form_options['ar_email_message'] ) {
1087
+			// migrate autoresponder
1088
+
1089
+			$email_field = isset($form_options['ar_email_to']) ? $form_options['ar_email_to'] : 0;
1090
+			if ( strpos($email_field, '|') ) {
1091
+				// data from entries field
1092
+				$email_field = explode('|', $email_field);
1093
+				if ( isset($email_field[1]) ) {
1094
+					$email_field = $email_field[1];
1095
+				}
1096
+			}
1097
+			if ( is_numeric($email_field) && ! empty($email_field) ) {
1098 1098
 				$email_field = '[' . $email_field . ']';
1099
-            }
1100
-
1101
-            $notification = $form_options;
1102
-            $new_notification2 = array(
1103
-                'post_content'  => array(
1104
-                    'email_message' => $notification['ar_email_message'],
1105
-                    'email_subject' => isset($notification['ar_email_subject']) ? $notification['ar_email_subject'] : '',
1106
-                    'email_to'      => $email_field,
1107
-                    'plain_text'    => isset($notification['ar_plain_text']) ? $notification['ar_plain_text'] : 0,
1108
-                    'inc_user_info' => 0,
1109
-                ),
1099
+			}
1100
+
1101
+			$notification = $form_options;
1102
+			$new_notification2 = array(
1103
+				'post_content'  => array(
1104
+					'email_message' => $notification['ar_email_message'],
1105
+					'email_subject' => isset($notification['ar_email_subject']) ? $notification['ar_email_subject'] : '',
1106
+					'email_to'      => $email_field,
1107
+					'plain_text'    => isset($notification['ar_plain_text']) ? $notification['ar_plain_text'] : 0,
1108
+					'inc_user_info' => 0,
1109
+				),
1110 1110
 				'post_name'     => $form_id . '_email_' . count( $notifications ),
1111
-            );
1111
+			);
1112 1112
 
1113
-            $reply_to = isset($notification['ar_reply_to']) ? $notification['ar_reply_to'] : '';
1114
-            $reply_to_name = isset($notification['ar_reply_to_name']) ? $notification['ar_reply_to_name'] : '';
1113
+			$reply_to = isset($notification['ar_reply_to']) ? $notification['ar_reply_to'] : '';
1114
+			$reply_to_name = isset($notification['ar_reply_to_name']) ? $notification['ar_reply_to_name'] : '';
1115 1115
 
1116 1116
 			if ( ! empty( $reply_to ) ) {
1117 1117
 				$new_notification2['post_content']['reply_to'] = $reply_to;
@@ -1121,9 +1121,9 @@  discard block
 block discarded – undo
1121 1121
 				$new_notification2['post_content']['from'] = ( empty( $reply_to_name ) ? '[sitename]' : $reply_to_name ) . ' <' . ( empty( $reply_to ) ? '[admin_email]' : $reply_to ) . '>';
1122 1122
 			}
1123 1123
 
1124
-            $notifications[] = $new_notification2;
1125
-            unset( $new_notification2 );
1126
-        }
1127
-    }
1124
+			$notifications[] = $new_notification2;
1125
+			unset( $new_notification2 );
1126
+		}
1127
+	}
1128 1128
 }
1129 1129
 
Please login to merge, or discard this patch.
Spacing   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined('ABSPATH') ) {
2
+if ( ! defined( 'ABSPATH' ) ) {
3 3
 	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 			'terms'    => array(),
37 37
         );
38 38
 
39
-        unset($defaults);
39
+        unset( $defaults );
40 40
 
41 41
 		if ( ! defined( 'WP_IMPORTING' ) ) {
42
-            define('WP_IMPORTING', true);
42
+            define( 'WP_IMPORTING', true );
43 43
         }
44 44
 
45 45
 		if ( ! class_exists( 'DOMDocument' ) ) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this XML file', 'formidable' ), libxml_get_errors() );
53 53
 		}
54 54
 
55
-		if ( ! function_exists('simplexml_import_dom') ) {
55
+		if ( ! function_exists( 'simplexml_import_dom' ) ) {
56 56
 			return new WP_Error( 'SimpleXML_parse_error', __( 'Your server is missing the simplexml_import_dom function', 'formidable' ), libxml_get_errors() );
57 57
 		}
58 58
 
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
         // add terms, forms (form and field ids), posts (post ids), and entries to db, in that order
68 68
 		foreach ( array( 'term', 'form', 'view' ) as $item_type ) {
69 69
             // grab cats, tags, and terms, or forms or posts
70
-            if ( isset($xml->{$item_type} ) ) {
70
+            if ( isset( $xml->{$item_type} ) ) {
71 71
 				$function_name = 'import_xml_' . $item_type . 's';
72 72
 				$imported = self::$function_name( $xml->{$item_type}, $imported );
73 73
 				unset( $function_name, $xml->{$item_type} );
74 74
             }
75 75
         }
76 76
 
77
-	    $return = apply_filters('frm_importing_xml', $imported, $xml );
77
+	    $return = apply_filters( 'frm_importing_xml', $imported, $xml );
78 78
 
79 79
 	    return $return;
80 80
     }
81 81
 
82 82
 	public static function import_xml_terms( $terms, $imported ) {
83 83
         foreach ( $terms as $t ) {
84
-			if ( term_exists((string) $t->term_slug, (string) $t->term_taxonomy) ) {
84
+			if ( term_exists( (string) $t->term_slug, (string) $t->term_taxonomy ) ) {
85 85
 			    continue;
86 86
 			}
87 87
 
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
                 'slug'          => (string) $t->term_slug,
92 92
                 'description'   => (string) $t->term_description,
93 93
 				'parent'        => empty( $parent ) ? 0 : $parent,
94
-            ));
94
+            ) );
95 95
 
96 96
 			if ( $term && is_array( $term ) ) {
97
-                $imported['imported']['terms']++;
98
-				$imported['terms'][ (int) $t->term_id ] = $term['term_id'];
97
+                $imported['imported']['terms'] ++;
98
+				$imported['terms'][(int) $t->term_id] = $term['term_id'];
99 99
             }
100 100
 
101 101
 			unset( $term, $t );
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
                 'default_template' => (int) $item->default_template,
139 139
                 'editable'      => (int) $item->editable,
140 140
                 'status'        => (string) $item->status,
141
-                'parent_form_id' => isset($item->parent_form_id) ? (int) $item->parent_form_id : 0,
142
-                'created_at'    => date('Y-m-d H:i:s', strtotime((string) $item->created_at)),
141
+                'parent_form_id' => isset( $item->parent_form_id ) ? (int) $item->parent_form_id : 0,
142
+                'created_at'    => date( 'Y-m-d H:i:s', strtotime( (string) $item->created_at ) ),
143 143
             );
144 144
 
145
-            $form['options'] = FrmAppHelper::maybe_json_decode($form['options']);
145
+            $form['options'] = FrmAppHelper::maybe_json_decode( $form['options'] );
146 146
 
147 147
 			self::update_custom_style_setting_on_import( $form );
148 148
 
@@ -152,35 +152,35 @@  discard block
 block discarded – undo
152 152
                 $edit_query['created_at'] = $form['created_at'];
153 153
             }
154 154
 
155
-            $edit_query = apply_filters('frm_match_xml_form', $edit_query, $form);
155
+            $edit_query = apply_filters( 'frm_match_xml_form', $edit_query, $form );
156 156
 
157
-            $this_form = FrmForm::getAll($edit_query, '', 1);
158
-            unset($edit_query);
157
+            $this_form = FrmForm::getAll( $edit_query, '', 1 );
158
+            unset( $edit_query );
159 159
 
160 160
             if ( ! empty( $this_form ) ) {
161 161
                 $old_id = $form_id = $this_form->id;
162
-                FrmForm::update($form_id, $form );
163
-                $imported['updated']['forms']++;
162
+                FrmForm::update( $form_id, $form );
163
+                $imported['updated']['forms'] ++;
164 164
                 // Keep track of whether this specific form was updated or not
165
-				$imported['form_status'][ $form_id ] = 'updated';
165
+				$imported['form_status'][$form_id] = 'updated';
166 166
 
167 167
 				$form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' );
168 168
                 $old_fields = array();
169 169
                 foreach ( $form_fields as $f ) {
170
-					$old_fields[ $f->id ] = $f;
171
-					$old_fields[ $f->field_key ] = $f->id;
172
-                    unset($f);
170
+					$old_fields[$f->id] = $f;
171
+					$old_fields[$f->field_key] = $f->id;
172
+                    unset( $f );
173 173
                 }
174 174
                 $form_fields = $old_fields;
175
-                unset($old_fields);
175
+                unset( $old_fields );
176 176
             } else {
177 177
                 $old_id = false;
178 178
                 //form does not exist, so create it
179 179
 				$form_id = FrmForm::create( $form );
180 180
                 if ( $form_id ) {
181
-                    $imported['imported']['forms']++;
181
+                    $imported['imported']['forms'] ++;
182 182
                     // Keep track of whether this specific form was updated or not
183
-					$imported['form_status'][ $form_id ] = 'imported';
183
+					$imported['form_status'][$form_id] = 'imported';
184 184
 					self::track_imported_child_forms( (int) $form_id, $form['parent_form_id'], $child_forms );
185 185
                 }
186 186
             }
@@ -190,23 +190,23 @@  discard block
 block discarded – undo
190 190
     		// Delete any fields attached to this form that were not included in the template
191 191
     		if ( isset( $form_fields ) && ! empty( $form_fields ) ) {
192 192
 				foreach ( $form_fields as $field ) {
193
-                    if ( is_object($field) ) {
194
-                        FrmField::destroy($field->id);
193
+                    if ( is_object( $field ) ) {
194
+                        FrmField::destroy( $field->id );
195 195
                     }
196
-                    unset($field);
196
+                    unset( $field );
197 197
                 }
198
-                unset($form_fields);
198
+                unset( $form_fields );
199 199
             }
200 200
 
201 201
 		    // Update field ids/keys to new ones
202 202
 			do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) );
203 203
 
204
-			$imported['forms'][ (int) $item->id ] = $form_id;
204
+			$imported['forms'][(int) $item->id] = $form_id;
205 205
 
206 206
             // Send pre 2.0 form options through function that creates actions
207 207
             self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, $switch = true );
208 208
 
209
-		    unset($form, $item);
209
+		    unset( $form, $item );
210 210
 		}
211 211
 
212 212
 		self::maybe_update_child_form_parent_id( $imported['forms'], $child_forms );
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		$regular_forms = array();
226 226
 
227 227
 		foreach ( $forms as $form ) {
228
-			$parent_form_id = isset( $form->parent_form_id) ? (int) $form->parent_form_id : 0;
228
+			$parent_form_id = isset( $form->parent_form_id ) ? (int) $form->parent_form_id : 0;
229 229
 
230 230
 			if ( $parent_form_id ) {
231 231
 				$child_forms[] = $form;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	*/
248 248
 	private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) {
249 249
 		if ( $parent_form_id ) {
250
-			$child_forms[ $form_id ] = $parent_form_id;
250
+			$child_forms[$form_id] = $parent_form_id;
251 251
 		}
252 252
 	}
253 253
 
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) {
263 263
 		foreach ( $child_forms as $child_form_id => $old_parent_form_id ) {
264 264
 
265
-			if ( isset( $imported_forms[ $old_parent_form_id ] ) && $imported_forms[ $old_parent_form_id ] != $old_parent_form_id ) {
265
+			if ( isset( $imported_forms[$old_parent_form_id] ) && $imported_forms[$old_parent_form_id] != $old_parent_form_id ) {
266 266
 				// Update all children with this old parent_form_id
267
-				$new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ];
267
+				$new_parent_form_id = (int) $imported_forms[$old_parent_form_id];
268 268
 
269 269
 				FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) );
270 270
 			}
@@ -285,51 +285,51 @@  discard block
 block discarded – undo
285 285
 		        'name'          => (string) $field->name,
286 286
 		        'description'   => (string) $field->description,
287 287
 		        'type'          => (string) $field->type,
288
-		        'default_value' => FrmAppHelper::maybe_json_decode( (string) $field->default_value),
288
+		        'default_value' => FrmAppHelper::maybe_json_decode( (string) $field->default_value ),
289 289
 		        'field_order'   => (int) $field->field_order,
290 290
 		        'form_id'       => (int) $form_id,
291 291
 		        'required'      => (int) $field->required,
292
-		        'options'       => FrmAppHelper::maybe_json_decode( (string) $field->options),
292
+		        'options'       => FrmAppHelper::maybe_json_decode( (string) $field->options ),
293 293
 				'field_options' => FrmAppHelper::maybe_json_decode( (string) $field->field_options ),
294 294
 		    );
295 295
 
296
-		    if ( is_array($f['default_value']) && in_array($f['type'], array(
296
+		    if ( is_array( $f['default_value'] ) && in_array( $f['type'], array(
297 297
 		        'text', 'email', 'url', 'textarea',
298
-		        'number','phone', 'date', 'time',
298
+		        'number', 'phone', 'date', 'time',
299 299
 		        'hidden', 'password', 'tag', 'image',
300
-		    )) ) {
301
-		        if ( count($f['default_value']) === 1 ) {
300
+		    ) ) ) {
301
+		        if ( count( $f['default_value'] ) === 1 ) {
302 302
 					$f['default_value'] = '[' . reset( $f['default_value'] ) . ']';
303 303
 		        } else {
304
-		            $f['default_value'] = reset($f['default_value']);
304
+		            $f['default_value'] = reset( $f['default_value'] );
305 305
 		        }
306 306
 		    }
307 307
 
308
-		    $f = apply_filters('frm_duplicated_field', $f);
308
+		    $f = apply_filters( 'frm_duplicated_field', $f );
309 309
 
310 310
 			self::maybe_update_form_select( $f, $imported );
311 311
 
312
-		    if ( ! empty($this_form) ) {
312
+		    if ( ! empty( $this_form ) ) {
313 313
 		        // check for field to edit by field id
314
-				if ( isset( $form_fields[ $f['id'] ] ) ) {
314
+				if ( isset( $form_fields[$f['id']] ) ) {
315 315
 		            FrmField::update( $f['id'], $f );
316
-		            $imported['updated']['fields']++;
316
+		            $imported['updated']['fields'] ++;
317 317
 
318
-					unset( $form_fields[ $f['id'] ] );
318
+					unset( $form_fields[$f['id']] );
319 319
 
320 320
 		            //unset old field key
321
-					if ( isset( $form_fields[ $f['field_key'] ] ) ) {
322
-						unset( $form_fields[ $f['field_key'] ] );
321
+					if ( isset( $form_fields[$f['field_key']] ) ) {
322
+						unset( $form_fields[$f['field_key']] );
323 323
 					}
324
-				} else if ( isset( $form_fields[ $f['field_key'] ] ) ) {
324
+				} else if ( isset( $form_fields[$f['field_key']] ) ) {
325 325
 		            // check for field to edit by field key
326
-		            unset($f['id']);
326
+		            unset( $f['id'] );
327 327
 
328
-					FrmField::update( $form_fields[ $f['field_key'] ], $f );
329
-		            $imported['updated']['fields']++;
328
+					FrmField::update( $form_fields[$f['field_key']], $f );
329
+		            $imported['updated']['fields'] ++;
330 330
 
331
-					unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id
332
-					unset( $form_fields[ $f['field_key'] ] ); //unset old field key
331
+					unset( $form_fields[$form_fields[$f['field_key']]] ); //unset old field id
332
+					unset( $form_fields[$f['field_key']] ); //unset old field key
333 333
 				} else {
334 334
 					$new_id = FrmField::create( $f );
335 335
 					if ( $new_id == false ) {
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 					}
338 338
 
339 339
 		            // if no matching field id or key in this form, create the field
340
-		            $imported['imported']['fields']++;
340
+		            $imported['imported']['fields'] ++;
341 341
 		        }
342 342
 			} else {
343 343
 				$new_id = FrmField::create( $f );
@@ -345,10 +345,10 @@  discard block
 block discarded – undo
345 345
 					continue;
346 346
 				}
347 347
 
348
-	            $imported['imported']['fields']++;
348
+	            $imported['imported']['fields'] ++;
349 349
 		    }
350 350
 
351
-			unset($field, $new_id);
351
+			unset( $field, $new_id );
352 352
 		}
353 353
 	}
354 354
 
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 		if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) {
368 368
 			if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) {
369 369
 				$form_select = $f['field_options']['form_select'];
370
-				if ( isset( $imported['forms'][ $form_select ] ) ) {
371
-					$f['field_options']['form_select'] = $imported['forms'][ $form_select ];
370
+				if ( isset( $imported['forms'][$form_select] ) ) {
371
+					$f['field_options']['form_select'] = $imported['forms'][$form_select];
372 372
 				}
373 373
 			}
374 374
 		}
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
 				'post_id'       => (int) $item->post_id,
432 432
 				'post_parent'   => (int) $item->post_parent,
433 433
 				'menu_order'    => (int) $item->menu_order,
434
-				'post_content'  => FrmFieldsHelper::switch_field_ids((string) $item->content),
435
-				'post_excerpt'  => FrmFieldsHelper::switch_field_ids((string) $item->excerpt),
434
+				'post_content'  => FrmFieldsHelper::switch_field_ids( (string) $item->content ),
435
+				'post_excerpt'  => FrmFieldsHelper::switch_field_ids( (string) $item->excerpt ),
436 436
 				'is_sticky'     => (string) $item->is_sticky,
437 437
 				'comment_status' => (string) $item->comment_status,
438 438
 				'post_date'     => (string) $item->post_date,
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
 			);
444 444
 
445 445
             $old_id = $post['post_id'];
446
-            self::populate_post($post, $item, $imported);
446
+            self::populate_post( $post, $item, $imported );
447 447
 
448
-			unset($item);
448
+			unset( $item );
449 449
 
450 450
 			$post_id = false;
451 451
             if ( $post['post_type'] == $form_action_type ) {
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 				if ( $action_control ) {
454 454
 					$post_id = $action_control->maybe_create_action( $post, $imported['form_status'] );
455 455
 				}
456
-                unset($action_control);
456
+                unset( $action_control );
457 457
             } else if ( $post['post_type'] == 'frm_styles' ) {
458 458
                 // Properly encode post content before inserting the post
459 459
                 $post['post_content'] = FrmAppHelper::maybe_json_decode( $post['post_content'] );
@@ -466,26 +466,26 @@  discard block
 block discarded – undo
466 466
                 $post_id = wp_insert_post( $post );
467 467
             }
468 468
 
469
-            if ( ! is_numeric($post_id) ) {
469
+            if ( ! is_numeric( $post_id ) ) {
470 470
                 continue;
471 471
             }
472 472
 
473
-            self::update_postmeta($post, $post_id);
473
+            self::update_postmeta( $post, $post_id );
474 474
 
475 475
             $this_type = 'posts';
476
-			if ( isset( $post_types[ $post['post_type'] ] ) ) {
477
-				$this_type = $post_types[ $post['post_type'] ];
476
+			if ( isset( $post_types[$post['post_type']] ) ) {
477
+				$this_type = $post_types[$post['post_type']];
478 478
             }
479 479
 
480
-            if ( isset($post['ID']) && $post_id == $post['ID'] ) {
481
-                $imported['updated'][ $this_type ]++;
480
+            if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) {
481
+                $imported['updated'][$this_type] ++;
482 482
             } else {
483
-                $imported['imported'][ $this_type ]++;
483
+                $imported['imported'][$this_type] ++;
484 484
             }
485 485
 
486
-            unset($post);
486
+            unset( $post );
487 487
 
488
-			$imported['posts'][ (int) $old_id ] = $post_id;
488
+			$imported['posts'][(int) $old_id] = $post_id;
489 489
 		}
490 490
 
491 491
 		self::maybe_update_stylesheet( $imported );
@@ -494,23 +494,23 @@  discard block
 block discarded – undo
494 494
     }
495 495
 
496 496
     private static function populate_post( &$post, $item, $imported ) {
497
-		if ( isset($item->attachment_url) ) {
497
+		if ( isset( $item->attachment_url ) ) {
498 498
 			$post['attachment_url'] = (string) $item->attachment_url;
499 499
 		}
500 500
 
501
-		if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) {
501
+		if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) {
502 502
 		    // update to new form id
503
-		    $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ];
503
+		    $post['menu_order'] = $imported['forms'][(int) $post['menu_order']];
504 504
 		}
505 505
 
506 506
 		foreach ( $item->postmeta as $meta ) {
507
-		    self::populate_postmeta($post, $meta, $imported);
508
-			unset($meta);
507
+		    self::populate_postmeta( $post, $meta, $imported );
508
+			unset( $meta );
509 509
 		}
510 510
 
511
-        self::populate_taxonomies($post, $item);
511
+        self::populate_taxonomies( $post, $item );
512 512
 
513
-        self::maybe_editing_post($post);
513
+        self::maybe_editing_post( $post );
514 514
     }
515 515
 
516 516
     private static function populate_postmeta( &$post, $meta, $imported ) {
@@ -522,27 +522,27 @@  discard block
 block discarded – undo
522 522
 		);
523 523
 
524 524
 		//switch old form and field ids to new ones
525
-		if ( $m['key'] == 'frm_form_id' && isset($imported['forms'][ (int) $m['value'] ]) ) {
526
-		    $m['value'] = $imported['forms'][ (int) $m['value'] ];
525
+		if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][(int) $m['value']] ) ) {
526
+		    $m['value'] = $imported['forms'][(int) $m['value']];
527 527
 		} else {
528
-		    $m['value'] = FrmAppHelper::maybe_json_decode($m['value']);
528
+		    $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] );
529 529
 
530
-		    if ( ! empty($frm_duplicate_ids) ) {
530
+		    if ( ! empty( $frm_duplicate_ids ) ) {
531 531
 
532 532
 		        if ( $m['key'] == 'frm_dyncontent' ) {
533
-		            $m['value'] = FrmFieldsHelper::switch_field_ids($m['value']);
533
+		            $m['value'] = FrmFieldsHelper::switch_field_ids( $m['value'] );
534 534
     		    } else if ( $m['key'] == 'frm_options' ) {
535 535
 
536 536
 					foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) {
537
-						if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) {
538
-							$m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ];
537
+						if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) {
538
+							$m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]];
539 539
     		            }
540 540
     		        }
541 541
 
542 542
                     $check_dup_array = array();
543 543
     		        if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) {
544
-    		            if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) {
545
-    		                $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ];
544
+    		            if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) {
545
+    		                $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']];
546 546
     		            } else if ( is_array( $m['value']['order_by'] ) ) {
547 547
                             $check_dup_array[] = 'order_by';
548 548
     		            }
@@ -553,22 +553,22 @@  discard block
 block discarded – undo
553 553
     		        }
554 554
 
555 555
                     foreach ( $check_dup_array as $check_k ) {
556
-						foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) {
557
-							if ( isset( $frm_duplicate_ids[ $mv ] ) ) {
558
-								$m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ];
556
+						foreach ( (array) $m['value'][$check_k] as $mk => $mv ) {
557
+							if ( isset( $frm_duplicate_ids[$mv] ) ) {
558
+								$m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv];
559 559
 		                    }
560
-		                    unset($mk, $mv);
560
+		                    unset( $mk, $mv );
561 561
 		                }
562 562
                     }
563 563
     		    }
564 564
 		    }
565 565
 		}
566 566
 
567
-		if ( ! is_array($m['value']) ) {
568
-		    $m['value'] = FrmAppHelper::maybe_json_decode($m['value']);
567
+		if ( ! is_array( $m['value'] ) ) {
568
+		    $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] );
569 569
 		}
570 570
 
571
-		$post['postmeta'][ (string) $meta->meta_key ] = $m['value'];
571
+		$post['postmeta'][(string) $meta->meta_key] = $m['value'];
572 572
     }
573 573
 
574 574
     /**
@@ -584,23 +584,23 @@  discard block
 block discarded – undo
584 584
             }
585 585
 
586 586
 		    $taxonomy = (string) $att['domain'];
587
-		    if ( is_taxonomy_hierarchical($taxonomy) ) {
587
+		    if ( is_taxonomy_hierarchical( $taxonomy ) ) {
588 588
 		        $name = (string) $att['nicename'];
589
-		        $h_term = get_term_by('slug', $name, $taxonomy);
589
+		        $h_term = get_term_by( 'slug', $name, $taxonomy );
590 590
 		        if ( $h_term ) {
591 591
 		            $name = $h_term->term_id;
592 592
 		        }
593
-		        unset($h_term);
593
+		        unset( $h_term );
594 594
 		    } else {
595 595
 		        $name = (string) $c;
596 596
 		    }
597 597
 
598
-			if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) {
599
-				$post['tax_input'][ $taxonomy ] = array();
598
+			if ( ! isset( $post['tax_input'][$taxonomy] ) ) {
599
+				$post['tax_input'][$taxonomy] = array();
600 600
 			}
601 601
 
602
-			$post['tax_input'][ $taxonomy ][] = $name;
603
-		    unset($name);
602
+			$post['tax_input'][$taxonomy][] = $name;
603
+		    unset( $name );
604 604
 		}
605 605
     }
606 606
 
@@ -617,29 +617,29 @@  discard block
 block discarded – undo
617 617
 
618 618
 		if ( in_array( $post['post_status'], array( 'trash', 'draft' ) ) ) {
619 619
 		    $match_by['include'] = $post['post_id'];
620
-		    unset($match_by['name']);
620
+		    unset( $match_by['name'] );
621 621
 		}
622 622
 
623
-		$editing = get_posts($match_by);
623
+		$editing = get_posts( $match_by );
624 624
 
625
-        if ( ! empty($editing) && current($editing)->post_date == $post['post_date'] ) {
625
+        if ( ! empty( $editing ) && current( $editing )->post_date == $post['post_date'] ) {
626 626
             // set the id of the post to edit
627
-            $post['ID'] = current($editing)->ID;
627
+            $post['ID'] = current( $editing )->ID;
628 628
         }
629 629
     }
630 630
 
631 631
     private static function update_postmeta( &$post, $post_id ) {
632 632
         foreach ( $post['postmeta'] as $k => $v ) {
633 633
             if ( '_edit_last' == $k ) {
634
-                $v = FrmAppHelper::get_user_id_param($v);
634
+                $v = FrmAppHelper::get_user_id_param( $v );
635 635
             } else if ( '_thumbnail_id' == $k && FrmAppHelper::pro_is_installed() ) {
636 636
                 //change the attachment ID
637
-                $v = FrmProXMLHelper::get_file_id($v);
637
+                $v = FrmProXMLHelper::get_file_id( $v );
638 638
             }
639 639
 
640
-            update_post_meta($post_id, $k, $v);
640
+            update_post_meta( $post_id, $k, $v );
641 641
 
642
-            unset($k, $v);
642
+            unset( $k, $v );
643 643
         }
644 644
     }
645 645
 
@@ -656,13 +656,13 @@  discard block
 block discarded – undo
656 656
      * @param string $message
657 657
      */
658 658
 	public static function parse_message( $result, &$message, &$errors ) {
659
-        if ( is_wp_error($result) ) {
659
+        if ( is_wp_error( $result ) ) {
660 660
             $errors[] = $result->get_error_message();
661 661
         } else if ( ! $result ) {
662 662
             return;
663 663
         }
664 664
 
665
-        if ( ! is_array($result) ) {
665
+        if ( ! is_array( $result ) ) {
666 666
             $message = is_string( $result ) ? $result : print_r( $result, 1 );
667 667
             return;
668 668
         }
@@ -674,20 +674,20 @@  discard block
 block discarded – undo
674 674
 
675 675
         $message = '<ul>';
676 676
         foreach ( $result as $type => $results ) {
677
-			if ( ! isset( $t_strings[ $type ] ) ) {
677
+			if ( ! isset( $t_strings[$type] ) ) {
678 678
                 // only print imported and updated
679 679
                 continue;
680 680
             }
681 681
 
682 682
             $s_message = array();
683 683
             foreach ( $results as $k => $m ) {
684
-                self::item_count_message($m, $k, $s_message);
685
-                unset($k, $m);
684
+                self::item_count_message( $m, $k, $s_message );
685
+                unset( $k, $m );
686 686
             }
687 687
 
688
-            if ( ! empty($s_message) ) {
689
-				$message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> ';
690
-                $message .= implode(', ', $s_message);
688
+            if ( ! empty( $s_message ) ) {
689
+				$message .= '<li><strong>' . $t_strings[$type] . ':</strong> ';
690
+                $message .= implode( ', ', $s_message );
691 691
                 $message .= '</li>';
692 692
             }
693 693
         }
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
             'actions'   => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ),
717 717
         );
718 718
 
719
-		$s_message[] = isset( $strings[ $type ] ) ? $strings[ $type ] : ' ' . $m . ' ' . ucfirst( $type );
719
+		$s_message[] = isset( $strings[$type] ) ? $strings[$type] : ' ' . $m . ' ' . ucfirst( $type );
720 720
     }
721 721
 
722 722
 	/**
@@ -748,14 +748,14 @@  discard block
 block discarded – undo
748 748
 	}
749 749
 
750 750
 	public static function cdata( $str ) {
751
-	    $str = maybe_unserialize($str);
752
-	    if ( is_array($str) ) {
753
-	        $str = json_encode($str);
751
+	    $str = maybe_unserialize( $str );
752
+	    if ( is_array( $str ) ) {
753
+	        $str = json_encode( $str );
754 754
 		} else if ( seems_utf8( $str ) == false ) {
755 755
 			$str = utf8_encode( $str );
756 756
 		}
757 757
 
758
-        if ( is_numeric($str) ) {
758
+        if ( is_numeric( $str ) ) {
759 759
             return $str;
760 760
         }
761 761
 
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
     * @param string $post_type
801 801
     */
802 802
     private static function migrate_post_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) {
803
-        if ( ! isset($form_options['create_post']) || ! $form_options['create_post'] ) {
803
+        if ( ! isset( $form_options['create_post'] ) || ! $form_options['create_post'] ) {
804 804
             return;
805 805
         }
806 806
 
@@ -821,10 +821,10 @@  discard block
 block discarded – undo
821 821
         );
822 822
 
823 823
         foreach ( $post_settings as $post_setting ) {
824
-			if ( isset( $form_options[ $post_setting ] ) ) {
825
-				$new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ];
824
+			if ( isset( $form_options[$post_setting] ) ) {
825
+				$new_action['post_content'][$post_setting] = $form_options[$post_setting];
826 826
             }
827
-            unset($post_setting);
827
+            unset( $post_setting );
828 828
         }
829 829
 
830 830
 		$new_action['event'] = array( 'create', 'update' );
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 
839 839
 			$new_action['post_content'] = self::switch_action_field_ids( $new_action['post_content'], $basic_fields, $array_fields );
840 840
         }
841
-        $new_action['post_content'] = json_encode($new_action['post_content']);
841
+        $new_action['post_content'] = json_encode( $new_action['post_content'] );
842 842
 
843 843
         $exists = get_posts( array(
844 844
             'name'          => $new_action['post_name'],
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
         if ( ! $exists ) {
851 851
 			// this isn't an email, but we need to use a class that will always be included
852 852
 			FrmAppHelper::save_json_post( $new_action );
853
-            $imported['imported']['actions']++;
853
+            $imported['imported']['actions'] ++;
854 854
         }
855 855
     }
856 856
 
@@ -882,11 +882,11 @@  discard block
 block discarded – undo
882 882
         foreach ( $post_content as $key => $setting ) {
883 883
             if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) {
884 884
                 // Replace old IDs with new IDs
885
-				$post_content[ $key ] = str_replace( $old, $new, $setting );
885
+				$post_content[$key] = str_replace( $old, $new, $setting );
886 886
             } else if ( is_array( $setting ) && in_array( $key, $array_fields ) ) {
887 887
                 foreach ( $setting as $k => $val ) {
888 888
                     // Replace old IDs with new IDs
889
-					$post_content[ $key ][ $k ] = str_replace( $old, $new, $val );
889
+					$post_content[$key][$k] = str_replace( $old, $new, $val );
890 890
                 }
891 891
             }
892 892
             unset( $key, $setting );
@@ -909,14 +909,14 @@  discard block
 block discarded – undo
909 909
         // Migrate autoresponders
910 910
         self::migrate_autoresponder_to_action( $form_options, $form_id, $notifications );
911 911
 
912
-        if (  empty( $notifications ) ) {
912
+        if ( empty( $notifications ) ) {
913 913
             return;
914 914
         }
915 915
 
916 916
         foreach ( $notifications as $new_notification ) {
917 917
             $new_notification['post_type']      = $post_type;
918 918
             $new_notification['post_excerpt']   = 'email';
919
-			$new_notification['post_title']     = __( 'Email Notification', 'formidable' );
919
+			$new_notification['post_title'] = __( 'Email Notification', 'formidable' );
920 920
             $new_notification['menu_order']     = $form_id;
921 921
             $new_notification['post_status']    = 'publish';
922 922
 
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 				// Switch all other field IDs in email
930 930
                 $new_notification['post_content'] = FrmFieldsHelper::switch_field_ids( $new_notification['post_content'] );
931 931
             }
932
-            $new_notification['post_content']   = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] );
932
+            $new_notification['post_content'] = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] );
933 933
 
934 934
             $exists = get_posts( array(
935 935
                 'name'          => $new_notification['post_name'],
@@ -938,11 +938,11 @@  discard block
 block discarded – undo
938 938
                 'numberposts'   => 1,
939 939
             ) );
940 940
 
941
-            if ( empty($exists) ) {
941
+            if ( empty( $exists ) ) {
942 942
 				FrmAppHelper::save_json_post( $new_notification );
943
-                $imported['imported']['actions']++;
943
+                $imported['imported']['actions'] ++;
944 944
             }
945
-            unset($new_notification);
945
+            unset( $new_notification );
946 946
         }
947 947
     }
948 948
 
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 			$form_options['notification'] = array( 0 => $form_options['notification'] );
956 956
         }
957 957
 
958
-        if ( isset( $form_options['notification'] ) && is_array($form_options['notification']) ) {
958
+        if ( isset( $form_options['notification'] ) && is_array( $form_options['notification'] ) ) {
959 959
             foreach ( $form_options['notification'] as $email_key => $notification ) {
960 960
 
961 961
                 $atts = array( 'email_to' => '', 'reply_to' => '', 'reply_to_name' => '', 'event' => '', 'form_id' => $form_id, 'email_key' => $email_key );
@@ -983,12 +983,12 @@  discard block
 block discarded – undo
983 983
         // Format the reply to email and name
984 984
         $reply_fields = array( 'reply_to' => '', 'reply_to_name' => '' );
985 985
         foreach ( $reply_fields as $f => $val ) {
986
-			if ( isset( $notification[ $f ] ) ) {
987
-				$atts[ $f ] = $notification[ $f ];
988
-				if ( 'custom' == $notification[ $f ] ) {
989
-					$atts[ $f ] = $notification[ 'cust_' . $f ];
990
-				} else if ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) {
991
-					$atts[ $f ] = '[' . $atts[ $f ] . ']';
986
+			if ( isset( $notification[$f] ) ) {
987
+				$atts[$f] = $notification[$f];
988
+				if ( 'custom' == $notification[$f] ) {
989
+					$atts[$f] = $notification['cust_' . $f];
990
+				} else if ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) {
991
+					$atts[$f] = '[' . $atts[$f] . ']';
992 992
                 }
993 993
             }
994 994
             unset( $f, $val );
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 		$atts['event'] = array( 'create' );
999 999
         if ( isset( $notification['update_email'] ) && 1 == $notification['update_email'] ) {
1000 1000
             $atts['event'][] = 'update';
1001
-        } else if ( isset($notification['update_email']) && 2 == $notification['update_email'] ) {
1001
+        } else if ( isset( $notification['update_email'] ) && 2 == $notification['update_email'] ) {
1002 1002
 			$atts['event'] = array( 'update' );
1003 1003
         }
1004 1004
     }
@@ -1019,18 +1019,18 @@  discard block
 block discarded – undo
1019 1019
         foreach ( $atts['email_to'] as $key => $email_field ) {
1020 1020
 
1021 1021
             if ( is_numeric( $email_field ) ) {
1022
-				$atts['email_to'][ $key ] = '[' . $email_field . ']';
1022
+				$atts['email_to'][$key] = '[' . $email_field . ']';
1023 1023
             }
1024 1024
 
1025
-            if ( strpos( $email_field, '|') ) {
1025
+            if ( strpos( $email_field, '|' ) ) {
1026 1026
                 $email_opt = explode( '|', $email_field );
1027 1027
                 if ( isset( $email_opt[0] ) ) {
1028
-					$atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']';
1028
+					$atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']';
1029 1029
                 }
1030 1030
                 unset( $email_opt );
1031 1031
             }
1032 1032
         }
1033
-        $atts['email_to'] = implode(', ', $atts['email_to']);
1033
+        $atts['email_to'] = implode( ', ', $atts['email_to'] );
1034 1034
     }
1035 1035
 
1036 1036
     private static function setup_new_notification( &$new_notification, $notification, $atts ) {
@@ -1046,12 +1046,12 @@  discard block
 block discarded – undo
1046 1046
         // Add more fields to the new notification
1047 1047
         $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' );
1048 1048
         foreach ( $add_fields as $add_field ) {
1049
-			if ( isset( $notification[ $add_field ] ) ) {
1050
-				$new_notification['post_content'][ $add_field ] = $notification[ $add_field ];
1049
+			if ( isset( $notification[$add_field] ) ) {
1050
+				$new_notification['post_content'][$add_field] = $notification[$add_field];
1051 1051
             } else if ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) {
1052
-				$new_notification['post_content'][ $add_field ] = 0;
1052
+				$new_notification['post_content'][$add_field] = 0;
1053 1053
             } else {
1054
-				$new_notification['post_content'][ $add_field ] = '';
1054
+				$new_notification['post_content'][$add_field] = '';
1055 1055
             }
1056 1056
             unset( $add_field );
1057 1057
         }
@@ -1075,26 +1075,26 @@  discard block
 block discarded – undo
1075 1075
 		if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) {
1076 1076
 			foreach ( $post_content['conditions'] as $email_key => $val ) {
1077 1077
 				if ( is_numeric( $email_key ) ) {
1078
-					$post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) );
1078
+					$post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) );
1079 1079
 				}
1080
-				unset( $email_key, $val);
1080
+				unset( $email_key, $val );
1081 1081
 			}
1082 1082
 		}
1083 1083
 	}
1084 1084
 
1085 1085
     private static function migrate_autoresponder_to_action( $form_options, $form_id, &$notifications ) {
1086
-        if ( isset($form_options['auto_responder']) && $form_options['auto_responder'] && isset($form_options['ar_email_message']) && $form_options['ar_email_message'] ) {
1086
+        if ( isset( $form_options['auto_responder'] ) && $form_options['auto_responder'] && isset( $form_options['ar_email_message'] ) && $form_options['ar_email_message'] ) {
1087 1087
             // migrate autoresponder
1088 1088
 
1089
-            $email_field = isset($form_options['ar_email_to']) ? $form_options['ar_email_to'] : 0;
1090
-            if ( strpos($email_field, '|') ) {
1089
+            $email_field = isset( $form_options['ar_email_to'] ) ? $form_options['ar_email_to'] : 0;
1090
+            if ( strpos( $email_field, '|' ) ) {
1091 1091
                 // data from entries field
1092
-                $email_field = explode('|', $email_field);
1093
-                if ( isset($email_field[1]) ) {
1092
+                $email_field = explode( '|', $email_field );
1093
+                if ( isset( $email_field[1] ) ) {
1094 1094
                     $email_field = $email_field[1];
1095 1095
                 }
1096 1096
             }
1097
-            if ( is_numeric($email_field) && ! empty($email_field) ) {
1097
+            if ( is_numeric( $email_field ) && ! empty( $email_field ) ) {
1098 1098
 				$email_field = '[' . $email_field . ']';
1099 1099
             }
1100 1100
 
@@ -1102,16 +1102,16 @@  discard block
 block discarded – undo
1102 1102
             $new_notification2 = array(
1103 1103
                 'post_content'  => array(
1104 1104
                     'email_message' => $notification['ar_email_message'],
1105
-                    'email_subject' => isset($notification['ar_email_subject']) ? $notification['ar_email_subject'] : '',
1105
+                    'email_subject' => isset( $notification['ar_email_subject'] ) ? $notification['ar_email_subject'] : '',
1106 1106
                     'email_to'      => $email_field,
1107
-                    'plain_text'    => isset($notification['ar_plain_text']) ? $notification['ar_plain_text'] : 0,
1107
+                    'plain_text'    => isset( $notification['ar_plain_text'] ) ? $notification['ar_plain_text'] : 0,
1108 1108
                     'inc_user_info' => 0,
1109 1109
                 ),
1110 1110
 				'post_name'     => $form_id . '_email_' . count( $notifications ),
1111 1111
             );
1112 1112
 
1113
-            $reply_to = isset($notification['ar_reply_to']) ? $notification['ar_reply_to'] : '';
1114
-            $reply_to_name = isset($notification['ar_reply_to_name']) ? $notification['ar_reply_to_name'] : '';
1113
+            $reply_to = isset( $notification['ar_reply_to'] ) ? $notification['ar_reply_to'] : '';
1114
+            $reply_to_name = isset( $notification['ar_reply_to_name'] ) ? $notification['ar_reply_to_name'] : '';
1115 1115
 
1116 1116
 			if ( ! empty( $reply_to ) ) {
1117 1117
 				$new_notification2['post_content']['reply_to'] = $reply_to;
Please login to merge, or discard this patch.
classes/helpers/FrmFormsListHelper.php 2 patches
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 }
5 5
 
6 6
 class FrmFormsListHelper extends FrmListHelper {
7
-    var $status = '';
7
+	var $status = '';
8 8
 
9 9
 	public function __construct( $args ) {
10 10
 		$this->status = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	public function prepare_items() {
16
-	    global $wpdb, $per_page, $mode;
16
+		global $wpdb, $per_page, $mode;
17 17
 
18
-	    $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
18
+		$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
19 19
 
20 20
 		$default_orderby = 'name';
21 21
 		$default_order = 'ASC';
22 22
 
23
-        $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : $default_orderby;
23
+		$orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : $default_orderby;
24 24
 		$order = ( isset( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : $default_order;
25 25
 
26 26
 		$page = $this->get_pagenum();
@@ -28,40 +28,40 @@  discard block
 block discarded – undo
28 28
 
29 29
 		$start = ( isset( $_REQUEST['start'] ) ) ? $_REQUEST['start'] : (( $page - 1 ) * $per_page);
30 30
 
31
-        $s_query = array();
32
-        $s_query[] = array( 'or' => 1, 'parent_form_id' => null, 'parent_form_id <' => 1 );
31
+		$s_query = array();
32
+		$s_query[] = array( 'or' => 1, 'parent_form_id' => null, 'parent_form_id <' => 1 );
33 33
 		switch ( $this->status ) {
34
-		    case 'template':
35
-                $s_query['is_template'] = 1;
36
-                $s_query['status !'] = 'trash';
37
-		        break;
38
-		    case 'draft':
39
-                $s_query['is_template'] = 0;
40
-                $s_query['status'] = 'draft';
41
-		        break;
42
-		    case 'trash':
43
-                $s_query['status'] = 'trash';
44
-		        break;
45
-		    default:
46
-                $s_query['is_template'] = 0;
47
-                $s_query['status !'] = 'trash';
48
-		        break;
34
+			case 'template':
35
+				$s_query['is_template'] = 1;
36
+				$s_query['status !'] = 'trash';
37
+				break;
38
+			case 'draft':
39
+				$s_query['is_template'] = 0;
40
+				$s_query['status'] = 'draft';
41
+				break;
42
+			case 'trash':
43
+				$s_query['status'] = 'trash';
44
+				break;
45
+			default:
46
+				$s_query['is_template'] = 0;
47
+				$s_query['status !'] = 'trash';
48
+				break;
49 49
 		}
50 50
 
51
-        $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : '';
52
-	    if ( $s != '' ) {
53
-	        preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
54
-		    $search_terms = array_map('trim', $matches[0]);
55
-	        foreach ( (array) $search_terms as $term ) {
56
-                $s_query[] = array(
57
-                    'or'    => true, 'name LIKE' => $term, 'description LIKE' => $term, 'created_at LIKE' => $term,
58
-                );
59
-	            unset($term);
60
-            }
61
-	    }
51
+		$s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : '';
52
+		if ( $s != '' ) {
53
+			preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
54
+			$search_terms = array_map('trim', $matches[0]);
55
+			foreach ( (array) $search_terms as $term ) {
56
+				$s_query[] = array(
57
+					'or'    => true, 'name LIKE' => $term, 'description LIKE' => $term, 'created_at LIKE' => $term,
58
+				);
59
+				unset($term);
60
+			}
61
+		}
62 62
 
63 63
 		$this->items = FrmForm::getAll( $s_query, $orderby . ' ' . $order, $start . ',' . $per_page );
64
-        $total_items = FrmDb::get_count( 'frm_forms', $s_query );
64
+		$total_items = FrmDb::get_count( 'frm_forms', $s_query );
65 65
 
66 66
 		$this->set_pagination_args( array(
67 67
 			'total_items' => $total_items,
@@ -70,69 +70,69 @@  discard block
 block discarded – undo
70 70
 	}
71 71
 
72 72
 	public function no_items() {
73
-	    if ( 'template' == $this->status ) {
74
-            _e( 'No Templates Found.', 'formidable' ) ?>
73
+		if ( 'template' == $this->status ) {
74
+			_e( 'No Templates Found.', 'formidable' ) ?>
75 75
             <br/><br/><?php _e( 'To add a new template:', 'formidable' ) ?>
76 76
 			<ol><li><?php printf( __( 'Create a new %1$sform%2$s.', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin?page=formidable&frm_action=new' ) ) . '"', '</a>' ) ?></li>
77 77
                 <li><?php printf(__( 'After your form is created, go to Formidable -> %1$sForms%2$s.', 'formidable' ), '<a href="?page=formidable">', '</a>') ?></li>
78 78
                 <li><?php _e( 'Place your mouse over the name of the form you just created, and click the "Create Template" link.', 'formidable' ) ?></li>
79 79
             </ol>
80 80
 <?php   } else {
81
-            _e( 'No Forms Found.', 'formidable' ) ?>
81
+			_e( 'No Forms Found.', 'formidable' ) ?>
82 82
             <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable&frm_action=new' ) ) ?>"><?php _e( 'Add New', 'formidable' ); ?></a>
83 83
 <?php   }
84 84
 	}
85 85
 
86 86
 	public function get_bulk_actions() {
87
-	    $actions = array();
87
+		$actions = array();
88 88
 
89 89
 		if ( in_array( $this->status, array( '', 'published' ) ) ) {
90
-	        $actions['bulk_create_template'] = __( 'Create Template', 'formidable' );
91
-	    }
92
-
93
-	    if ( 'trash' == $this->status ) {
94
-	        if ( current_user_can('frm_edit_forms') ) {
95
-	            $actions['bulk_untrash'] = __( 'Restore', 'formidable' );
96
-	        }
97
-
98
-	        if ( current_user_can('frm_delete_forms') ) {
99
-	            $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' );
100
-	        }
101
-	    } else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) {
102
-	        $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' );
103
-	    } else if ( current_user_can('frm_delete_forms') ) {
104
-	        $actions['bulk_delete'] = __( 'Delete');
105
-	    }
106
-
107
-        return $actions;
108
-    }
90
+			$actions['bulk_create_template'] = __( 'Create Template', 'formidable' );
91
+		}
92
+
93
+		if ( 'trash' == $this->status ) {
94
+			if ( current_user_can('frm_edit_forms') ) {
95
+				$actions['bulk_untrash'] = __( 'Restore', 'formidable' );
96
+			}
97
+
98
+			if ( current_user_can('frm_delete_forms') ) {
99
+				$actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' );
100
+			}
101
+		} else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) {
102
+			$actions['bulk_trash'] = __( 'Move to Trash', 'formidable' );
103
+		} else if ( current_user_can('frm_delete_forms') ) {
104
+			$actions['bulk_delete'] = __( 'Delete');
105
+		}
106
+
107
+		return $actions;
108
+	}
109 109
 
110 110
 	public function extra_tablenav( $which ) {
111
-        if ( 'top' != $which ) {
112
-            return;
113
-        }
111
+		if ( 'top' != $which ) {
112
+			return;
113
+		}
114 114
 
115
-        if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) {
115
+		if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) {
116 116
 ?>
117 117
             <div class="alignleft actions frm_visible_overflow">
118 118
 			<?php submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); ?>
119 119
             </div>
120 120
 <?php
121
-            return;
122
-        }
121
+			return;
122
+		}
123 123
 
124
-        if ( 'template' != $this->status ) {
125
-            return;
126
-        }
124
+		if ( 'template' != $this->status ) {
125
+			return;
126
+		}
127 127
 
128 128
 		$where = apply_filters( 'frm_forms_dropdown', array(), '' );
129 129
 		$forms = FrmForm::get_published_forms( $where );
130 130
 
131
-        $base = admin_url('admin.php?page=formidable&form_type=template');
132
-        $args = array(
133
-            'frm_action'    => 'duplicate',
134
-            'template'      => true,
135
-        );
131
+		$base = admin_url('admin.php?page=formidable&form_type=template');
132
+		$args = array(
133
+			'frm_action'    => 'duplicate',
134
+			'template'      => true,
135
+		);
136 136
 
137 137
 ?>
138 138
     <div class="alignleft actions frm_visible_overflow">
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
         <a href="#" id="frm-templateDrop" class="frm-dropdown-toggle button" data-toggle="dropdown"><?php _e( 'Create New Template', 'formidable' ) ?> <b class="caret"></b></a>
141 141
 		<ul class="frm-dropdown-menu" role="menu" aria-labelledby="frm-templateDrop">
142 142
 		<?php
143
-        if ( empty( $forms ) ) { ?>
143
+		if ( empty( $forms ) ) { ?>
144 144
             <li class="frm_dropdown_li"><?php _e( 'You have not created any forms yet. <br/>You must create a form before you can make a template.', 'formidable' ) ?></li>
145 145
         <?php
146
-        } else {
147
-            foreach ( $forms as $form ) {
148
-		        $args['id'] = $form->id; ?>
146
+		} else {
147
+			foreach ( $forms as $form ) {
148
+				$args['id'] = $form->id; ?>
149 149
 			<li><a href="<?php echo esc_url( add_query_arg( $args, $base ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li>
150 150
 			<?php
151
-			    unset($form);
151
+				unset($form);
152 152
 			}
153
-        }
154
-        ?>
153
+		}
154
+		?>
155 155
 		</ul>
156 156
 	</div>
157 157
 	</div>
@@ -161,30 +161,30 @@  discard block
 block discarded – undo
161 161
 	public function get_views() {
162 162
 
163 163
 		$statuses = array(
164
-		    'published' => __( 'My Forms', 'formidable' ),
165
-		    'template'  => __( 'Templates', 'formidable' ),
166
-		    'draft'     => __( 'Drafts', 'formidable' ),
167
-		    'trash'     => __( 'Trash', 'formidable' ),
164
+			'published' => __( 'My Forms', 'formidable' ),
165
+			'template'  => __( 'Templates', 'formidable' ),
166
+			'draft'     => __( 'Drafts', 'formidable' ),
167
+			'trash'     => __( 'Trash', 'formidable' ),
168 168
 		);
169 169
 
170
-	    $links = array();
171
-	    $counts = FrmForm::get_count();
172
-        $form_type = isset( $_REQUEST['form_type'] ) ? sanitize_text_field( $_REQUEST['form_type'] ) : 'published';
170
+		$links = array();
171
+		$counts = FrmForm::get_count();
172
+		$form_type = isset( $_REQUEST['form_type'] ) ? sanitize_text_field( $_REQUEST['form_type'] ) : 'published';
173 173
 
174
-	    foreach ( $statuses as $status => $name ) {
174
+		foreach ( $statuses as $status => $name ) {
175 175
 
176
-	        if ( $status == $form_type ) {
177
-    			$class = ' class="current"';
178
-    		} else {
179
-    		    $class = '';
180
-    		}
176
+			if ( $status == $form_type ) {
177
+				$class = ' class="current"';
178
+			} else {
179
+				$class = '';
180
+			}
181 181
 
182
-    		if ( $counts->{$status} || 'published' == $status ) {
182
+			if ( $counts->{$status} || 'published' == $status ) {
183 183
 				$links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>';
184
-		    }
184
+			}
185 185
 
186
-		    unset($status, $name);
187
-	    }
186
+			unset($status, $name);
187
+		}
188 188
 
189 189
 		return $links;
190 190
 	}
@@ -200,16 +200,16 @@  discard block
 block discarded – undo
200 200
 	}
201 201
 
202 202
 	public function single_row( $item, $style = '' ) {
203
-	    global $frm_vars, $mode;
203
+		global $frm_vars, $mode;
204 204
 
205 205
 		// Set up the hover actions for this user
206 206
 		$actions = array();
207 207
 		$edit_link = '?page=formidable&frm_action=edit&id=' . $item->id;
208 208
 		$duplicate_link = '?page=formidable&frm_action=duplicate&id=' . $item->id;
209 209
 
210
-        $this->get_actions($actions, $item, $edit_link, $duplicate_link);
210
+		$this->get_actions($actions, $item, $edit_link, $duplicate_link);
211 211
 
212
-        $action_links = $this->row_actions( $actions );
212
+		$action_links = $this->row_actions( $actions );
213 213
 
214 214
 		// Set up the checkbox ( because the user is editable, otherwise its empty )
215 215
 		$checkbox = '<input type="checkbox" name="item-action[]" id="cb-item-action-' . absint( $item->id ) . '" value="' . esc_attr( $item->id ) . '" />';
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 
219 219
 		list( $columns, $hidden ) = $this->get_column_info();
220 220
 
221
-        $format = 'Y/m/d';
222
-        if ( 'list' != $mode ) {
223
-            $format .= ' \<\b\r \/\> g:i:s a';
221
+		$format = 'Y/m/d';
222
+		if ( 'list' != $mode ) {
223
+			$format .= ' \<\b\r \/\> g:i:s a';
224 224
 		}
225 225
 
226 226
 		foreach ( $columns as $column_name => $column_display_name ) {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
 			$style = '';
230 230
 			if ( in_array( $column_name, $hidden ) ) {
231
-                $class .= ' frm_hidden';
231
+				$class .= ' frm_hidden';
232 232
 			}
233 233
 
234 234
 			$class = 'class="' . esc_attr( $class ) . '"';
@@ -241,41 +241,41 @@  discard block
 block discarded – undo
241 241
 					break;
242 242
 				case 'id':
243 243
 				case 'form_key':
244
-				    $val = $item->{$column_name};
245
-				    break;
244
+					$val = $item->{$column_name};
245
+					break;
246 246
 				case 'name':
247
-				    $val = $this->get_form_name( $item, $actions, $edit_link, $mode );
248
-			        $val .= $action_links;
247
+					$val = $this->get_form_name( $item, $actions, $edit_link, $mode );
248
+					$val .= $action_links;
249 249
 
250
-				    break;
250
+					break;
251 251
 				case 'created_at':
252
-				    $date = date($format, strtotime($item->created_at));
252
+					$date = date($format, strtotime($item->created_at));
253 253
 					$val = '<abbr title="' . esc_attr( date( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>';
254 254
 					break;
255 255
 				case 'shortcode':
256 256
 					$val = '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable id=' . $item->id . ']' ) . '" /><br/>';
257
-				    if ( 'excerpt' == $mode ) {
257
+					if ( 'excerpt' == $mode ) {
258 258
 						$val .= '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable key=' . $item->form_key . ']' ) . '" />';
259
-				    }
260
-			        break;
261
-			    case 'entries':
259
+					}
260
+					break;
261
+				case 'entries':
262 262
 					if ( isset( $item->options['no_save'] ) && $item->options['no_save'] ) {
263 263
 						$val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="' . esc_attr('Entries are not being saved', 'formidable' ) . '"></i>';
264
-			        } else {
265
-			            $text = FrmEntry::getRecordCount($item->id);
264
+					} else {
265
+						$text = FrmEntry::getRecordCount($item->id);
266 266
 						$val = current_user_can('frm_view_entries') ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text;
267
-                        unset($text);
268
-                    }
269
-			        break;
270
-                case 'type':
271
-                    $val = ( $item->is_template && $item->default_template ) ? __( 'Default', 'formidable' ) : __( 'Custom', 'formidable' );
272
-                    break;
267
+						unset($text);
268
+					}
269
+					break;
270
+				case 'type':
271
+					$val = ( $item->is_template && $item->default_template ) ? __( 'Default', 'formidable' ) : __( 'Custom', 'formidable' );
272
+					break;
273 273
 			}
274 274
 
275 275
 			if ( isset($val) ) {
276
-			    $r .= "<td $attributes>";
277
-			    $r .= $val;
278
-			    $r .= '</td>';
276
+				$r .= "<td $attributes>";
277
+				$r .= $val;
278
+				$r .= '</td>';
279 279
 			}
280 280
 			unset($val);
281 281
 		}
@@ -284,38 +284,38 @@  discard block
 block discarded – undo
284 284
 		return $r;
285 285
 	}
286 286
 
287
-    /**
288
-     * @param string $edit_link
289
-     * @param string $duplicate_link
290
-     */
291
-    private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) {
287
+	/**
288
+	 * @param string $edit_link
289
+	 * @param string $duplicate_link
290
+	 */
291
+	private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) {
292 292
 		if ( 'trash' == $this->status ) {
293 293
 			if ( current_user_can('frm_edit_forms') ) {
294 294
 				$actions['restore'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' );
295 295
 			}
296 296
 
297
-		    if ( current_user_can('frm_delete_forms') ) {
297
+			if ( current_user_can('frm_delete_forms') ) {
298 298
 				$trash_url = wp_nonce_url( '?page=formidable&form_status=trash&frm_action=destroy&id=' . $item->id, 'destroy_form_' . $item->id );
299 299
 				$actions['trash'] = '<a href="' . esc_url( $trash_url ) .'" class="submitdelete" onclick="return confirm(\'' . __( 'Are you sure you want to permanently delete that?', 'formidable' ) . '\')">' . __( 'Delete Permanently' ) . '</a>';
300
-    		}
301
-            return;
300
+			}
301
+			return;
302 302
 		}
303 303
 
304 304
 		if ( current_user_can('frm_edit_forms') ) {
305
-            if ( ! $item->is_template || ! $item->default_template ) {
305
+			if ( ! $item->is_template || ! $item->default_template ) {
306 306
 				$actions['frm_edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit' ) . '</a>';
307
-            }
307
+			}
308 308
 
309
-		    if ( $item->is_template ) {
309
+			if ( $item->is_template ) {
310 310
 				$actions['frm_duplicate'] = '<a href="'. esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Create Form from Template', 'formidable' ) . '</a>';
311
-            } else {
311
+			} else {
312 312
 				$actions['frm_settings'] = '<a href="' . esc_url( '?page=formidable&frm_action=settings&id=' . $item->id ) . '">' . __( 'Settings', 'formidable' ) . '</a>';
313 313
 
314
-    		    if ( FrmAppHelper::pro_is_installed() ) {
314
+				if ( FrmAppHelper::pro_is_installed() ) {
315 315
 					$actions['duplicate'] = '<a href="' . esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Duplicate', 'formidable' ) . '</a>';
316
-        	    }
317
-        	}
318
-        }
316
+				}
317
+			}
318
+		}
319 319
 
320 320
 		$actions['trash'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' );
321 321
 		if ( empty( $actions['trash'] ) ) {
@@ -324,52 +324,52 @@  discard block
 block discarded – undo
324 324
 		}
325 325
 
326 326
 		$actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview') . '</a>';
327
-    }
327
+	}
328 328
 
329
-    /**
330
-     * @param string $edit_link
331
-     */
329
+	/**
330
+	 * @param string $edit_link
331
+	 */
332 332
 	private function get_form_name( $item, $actions, $edit_link, $mode = 'list' ) {
333
-        $form_name = $item->name;
334
-        if ( trim($form_name) == '' ) {
335
-            $form_name = __( '(no title)');
336
-        }
333
+		$form_name = $item->name;
334
+		if ( trim($form_name) == '' ) {
335
+			$form_name = __( '(no title)');
336
+		}
337 337
 		$form_name = FrmAppHelper::kses( $form_name );
338 338
 		if ( 'excerpt' != $mode ) {
339 339
 			$form_name = FrmAppHelper::truncate( $form_name, 50 );
340 340
 		}
341 341
 
342
-        $val = '<strong>';
343
-        if ( 'trash' == $this->status ) {
344
-            $val .= $form_name;
345
-        } else {
342
+		$val = '<strong>';
343
+		if ( 'trash' == $this->status ) {
344
+			$val .= $form_name;
345
+		} else {
346 346
 			$val .= '<a href="' . esc_url( isset( $actions['frm_edit'] ) ? $edit_link : FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" class="row-title">' . FrmAppHelper::kses( $form_name ) . '</a> ';
347
-        }
347
+		}
348 348
 
349
-        $this->add_draft_label( $item, $val );
350
-        $val .= '</strong>';
349
+		$this->add_draft_label( $item, $val );
350
+		$val .= '</strong>';
351 351
 
352
-        $this->add_form_description( $item, $val );
352
+		$this->add_form_description( $item, $val );
353 353
 
354
-        return $val;
355
-    }
354
+		return $val;
355
+	}
356 356
 
357
-    /**
358
-     * @param string $val
359
-     */
360
-    private function add_draft_label( $item, &$val ) {
361
-        if ( 'draft' == $item->status && 'draft' != $this->status ) {
357
+	/**
358
+	 * @param string $val
359
+	 */
360
+	private function add_draft_label( $item, &$val ) {
361
+		if ( 'draft' == $item->status && 'draft' != $this->status ) {
362 362
 			$val .= ' - <span class="post-state">' . __( 'Draft', 'formidable' ) . '</span>';
363
-        }
364
-    }
365
-
366
-    /**
367
-     * @param string $val
368
-     */
369
-    private function add_form_description( $item, &$val ) {
370
-        global $mode;
371
-        if ( 'excerpt' == $mode ) {
372
-            $val .= FrmAppHelper::truncate(strip_tags($item->description), 50);
373
-        }
374
-    }
363
+		}
364
+	}
365
+
366
+	/**
367
+	 * @param string $val
368
+	 */
369
+	private function add_form_description( $item, &$val ) {
370
+		global $mode;
371
+		if ( 'excerpt' == $mode ) {
372
+			$val .= FrmAppHelper::truncate(strip_tags($item->description), 50);
373
+		}
374
+	}
375 375
 }
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		$page = $this->get_pagenum();
27 27
 		$per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' );
28 28
 
29
-		$start = ( isset( $_REQUEST['start'] ) ) ? $_REQUEST['start'] : (( $page - 1 ) * $per_page);
29
+		$start = ( isset( $_REQUEST['start'] ) ) ? $_REQUEST['start'] : ( ( $page - 1 ) * $per_page );
30 30
 
31 31
         $s_query = array();
32 32
         $s_query[] = array( 'or' => 1, 'parent_form_id' => null, 'parent_form_id <' => 1 );
@@ -48,15 +48,15 @@  discard block
 block discarded – undo
48 48
 		        break;
49 49
 		}
50 50
 
51
-        $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : '';
51
+        $s = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
52 52
 	    if ( $s != '' ) {
53
-	        preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
54
-		    $search_terms = array_map('trim', $matches[0]);
53
+	        preg_match_all( '/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches );
54
+		    $search_terms = array_map( 'trim', $matches[0] );
55 55
 	        foreach ( (array) $search_terms as $term ) {
56 56
                 $s_query[] = array(
57 57
                     'or'    => true, 'name LIKE' => $term, 'description LIKE' => $term, 'created_at LIKE' => $term,
58 58
                 );
59
-	            unset($term);
59
+	            unset( $term );
60 60
             }
61 61
 	    }
62 62
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             _e( 'No Templates Found.', 'formidable' ) ?>
75 75
             <br/><br/><?php _e( 'To add a new template:', 'formidable' ) ?>
76 76
 			<ol><li><?php printf( __( 'Create a new %1$sform%2$s.', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin?page=formidable&frm_action=new' ) ) . '"', '</a>' ) ?></li>
77
-                <li><?php printf(__( 'After your form is created, go to Formidable -> %1$sForms%2$s.', 'formidable' ), '<a href="?page=formidable">', '</a>') ?></li>
77
+                <li><?php printf( __( 'After your form is created, go to Formidable -> %1$sForms%2$s.', 'formidable' ), '<a href="?page=formidable">', '</a>' ) ?></li>
78 78
                 <li><?php _e( 'Place your mouse over the name of the form you just created, and click the "Create Template" link.', 'formidable' ) ?></li>
79 79
             </ol>
80 80
 <?php   } else {
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
 	    }
92 92
 
93 93
 	    if ( 'trash' == $this->status ) {
94
-	        if ( current_user_can('frm_edit_forms') ) {
94
+	        if ( current_user_can( 'frm_edit_forms' ) ) {
95 95
 	            $actions['bulk_untrash'] = __( 'Restore', 'formidable' );
96 96
 	        }
97 97
 
98
-	        if ( current_user_can('frm_delete_forms') ) {
98
+	        if ( current_user_can( 'frm_delete_forms' ) ) {
99 99
 	            $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' );
100 100
 	        }
101
-	    } else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) {
101
+	    } else if ( EMPTY_TRASH_DAYS && current_user_can( 'frm_delete_forms' ) ) {
102 102
 	        $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' );
103
-	    } else if ( current_user_can('frm_delete_forms') ) {
104
-	        $actions['bulk_delete'] = __( 'Delete');
103
+	    } else if ( current_user_can( 'frm_delete_forms' ) ) {
104
+	        $actions['bulk_delete'] = __( 'Delete' );
105 105
 	    }
106 106
 
107 107
         return $actions;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             return;
113 113
         }
114 114
 
115
-        if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) {
115
+        if ( 'trash' == $this->status && current_user_can( 'frm_delete_forms' ) ) {
116 116
 ?>
117 117
             <div class="alignleft actions frm_visible_overflow">
118 118
 			<?php submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); ?>
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 		$where = apply_filters( 'frm_forms_dropdown', array(), '' );
129 129
 		$forms = FrmForm::get_published_forms( $where );
130 130
 
131
-        $base = admin_url('admin.php?page=formidable&form_type=template');
131
+        $base = admin_url( 'admin.php?page=formidable&form_type=template' );
132 132
         $args = array(
133 133
             'frm_action'    => 'duplicate',
134 134
             'template'      => true,
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		        $args['id'] = $form->id; ?>
149 149
 			<li><a href="<?php echo esc_url( add_query_arg( $args, $base ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li>
150 150
 			<?php
151
-			    unset($form);
151
+			    unset( $form );
152 152
 			}
153 153
         }
154 154
         ?>
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
     		}
181 181
 
182 182
     		if ( $counts->{$status} || 'published' == $status ) {
183
-				$links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>';
183
+				$links[$status] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>';
184 184
 		    }
185 185
 
186
-		    unset($status, $name);
186
+		    unset( $status, $name );
187 187
 	    }
188 188
 
189 189
 		return $links;
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		$edit_link = '?page=formidable&frm_action=edit&id=' . $item->id;
208 208
 		$duplicate_link = '?page=formidable&frm_action=duplicate&id=' . $item->id;
209 209
 
210
-        $this->get_actions($actions, $item, $edit_link, $duplicate_link);
210
+        $this->get_actions( $actions, $item, $edit_link, $duplicate_link );
211 211
 
212 212
         $action_links = $this->row_actions( $actions );
213 213
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
 				    break;
251 251
 				case 'created_at':
252
-				    $date = date($format, strtotime($item->created_at));
252
+				    $date = date( $format, strtotime( $item->created_at ) );
253 253
 					$val = '<abbr title="' . esc_attr( date( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>';
254 254
 					break;
255 255
 				case 'shortcode':
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 			        break;
261 261
 			    case 'entries':
262 262
 					if ( isset( $item->options['no_save'] ) && $item->options['no_save'] ) {
263
-						$val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="' . esc_attr('Entries are not being saved', 'formidable' ) . '"></i>';
263
+						$val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="' . esc_attr( 'Entries are not being saved', 'formidable' ) . '"></i>';
264 264
 			        } else {
265
-			            $text = FrmEntry::getRecordCount($item->id);
266
-						$val = current_user_can('frm_view_entries') ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text;
267
-                        unset($text);
265
+			            $text = FrmEntry::getRecordCount( $item->id );
266
+						$val = current_user_can( 'frm_view_entries' ) ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text;
267
+                        unset( $text );
268 268
                     }
269 269
 			        break;
270 270
                 case 'type':
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
                     break;
273 273
 			}
274 274
 
275
-			if ( isset($val) ) {
275
+			if ( isset( $val ) ) {
276 276
 			    $r .= "<td $attributes>";
277 277
 			    $r .= $val;
278 278
 			    $r .= '</td>';
279 279
 			}
280
-			unset($val);
280
+			unset( $val );
281 281
 		}
282 282
 		$r .= '</tr>';
283 283
 
@@ -290,18 +290,18 @@  discard block
 block discarded – undo
290 290
      */
291 291
     private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) {
292 292
 		if ( 'trash' == $this->status ) {
293
-			if ( current_user_can('frm_edit_forms') ) {
293
+			if ( current_user_can( 'frm_edit_forms' ) ) {
294 294
 				$actions['restore'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' );
295 295
 			}
296 296
 
297
-		    if ( current_user_can('frm_delete_forms') ) {
297
+		    if ( current_user_can( 'frm_delete_forms' ) ) {
298 298
 				$trash_url = wp_nonce_url( '?page=formidable&form_status=trash&frm_action=destroy&id=' . $item->id, 'destroy_form_' . $item->id );
299 299
 				$actions['trash'] = '<a href="' . esc_url( $trash_url ) . '" class="submitdelete" onclick="return confirm(\'' . __( 'Are you sure you want to permanently delete that?', 'formidable' ) . '\')">' . __( 'Delete Permanently' ) . '</a>';
300 300
     		}
301 301
             return;
302 302
 		}
303 303
 
304
-		if ( current_user_can('frm_edit_forms') ) {
304
+		if ( current_user_can( 'frm_edit_forms' ) ) {
305 305
             if ( ! $item->is_template || ! $item->default_template ) {
306 306
 				$actions['frm_edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit' ) . '</a>';
307 307
             }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 			unset( $actions['trash'] );
324 324
 		}
325 325
 
326
-		$actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview') . '</a>';
326
+		$actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview' ) . '</a>';
327 327
     }
328 328
 
329 329
     /**
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
      */
332 332
 	private function get_form_name( $item, $actions, $edit_link, $mode = 'list' ) {
333 333
         $form_name = $item->name;
334
-        if ( trim($form_name) == '' ) {
335
-            $form_name = __( '(no title)');
334
+        if ( trim( $form_name ) == '' ) {
335
+            $form_name = __( '(no title)' );
336 336
         }
337 337
 		$form_name = FrmAppHelper::kses( $form_name );
338 338
 		if ( 'excerpt' != $mode ) {
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     private function add_form_description( $item, &$val ) {
370 370
         global $mode;
371 371
         if ( 'excerpt' == $mode ) {
372
-            $val .= FrmAppHelper::truncate(strip_tags($item->description), 50);
372
+            $val .= FrmAppHelper::truncate( strip_tags( $item->description ), 50 );
373 373
         }
374 374
     }
375 375
 }
Please login to merge, or discard this patch.
classes/helpers/FrmEntriesListHelper.php 2 patches
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -6,46 +6,46 @@  discard block
 block discarded – undo
6 6
 	protected $field;
7 7
 
8 8
 	public function prepare_items() {
9
-        global $wpdb, $per_page;
9
+		global $wpdb, $per_page;
10 10
 
11 11
 		$per_page = $this->get_items_per_page( 'formidable_page_formidable_entries_per_page' );
12 12
 
13
-        $form_id = $this->params['form'];
14
-        if ( ! $form_id ) {
15
-            $this->items = array();
16
-    		$this->set_pagination_args( array(
17
-    			'total_items' => 0,
13
+		$form_id = $this->params['form'];
14
+		if ( ! $form_id ) {
15
+			$this->items = array();
16
+			$this->set_pagination_args( array(
17
+				'total_items' => 0,
18 18
 				'per_page' => $per_page,
19
-    		) );
20
-            return;
21
-        }
19
+			) );
20
+			return;
21
+		}
22 22
 
23 23
 		$default_orderby = 'id';
24 24
 		$default_order = 'DESC';
25 25
 
26
-	    $s_query = array( 'it.form_id' => $form_id );
26
+		$s_query = array( 'it.form_id' => $form_id );
27 27
 
28 28
 		$s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : '';
29 29
 
30
-	    if ( $s != '' && FrmAppHelper::pro_is_installed() ) {
31
-	        $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : '';
32
-	        $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid);
33
-	    }
30
+		if ( $s != '' && FrmAppHelper::pro_is_installed() ) {
31
+			$fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : '';
32
+			$s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid);
33
+		}
34 34
 
35
-        $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby;
36
-        if ( strpos($orderby, 'meta') !== false ) {
37
-            $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) );
35
+		$orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby;
36
+		if ( strpos($orderby, 'meta') !== false ) {
37
+			$order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) );
38 38
 			$orderby .= in_array( $order_field_type, array( 'number', 'scale' ) ) ? ' +0 ' : '';
39
-        }
39
+		}
40 40
 
41 41
 		$order = isset( $_REQUEST['order'] ) ? sanitize_title( $_REQUEST['order'] ) : $default_order;
42 42
 		$order = ' ORDER BY ' . $orderby . ' ' . $order;
43 43
 
44
-        $page = $this->get_pagenum();
44
+		$page = $this->get_pagenum();
45 45
 		$start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page );
46 46
 
47 47
 		$this->items = FrmEntry::getAll( $s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, false );
48
-        $total_items = FrmEntry::getRecordCount($s_query);
48
+		$total_items = FrmEntry::getRecordCount($s_query);
49 49
 
50 50
 		$this->set_pagination_args( array(
51 51
 			'total_items' => $total_items,
@@ -54,17 +54,17 @@  discard block
 block discarded – undo
54 54
 	}
55 55
 
56 56
 	public function no_items() {
57
-        $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
58
-	    if ( ! empty($s) ) {
59
-            _e( 'No Entries Found', 'formidable' );
60
-            return;
61
-        }
62
-
63
-        $form_id = $form = $this->params['form'];
64
-        if ( $form_id ) {
65
-            $form = FrmForm::getOne($form_id);
66
-        }
67
-        $colspan = $this->get_column_count();
57
+		$s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
58
+		if ( ! empty($s) ) {
59
+			_e( 'No Entries Found', 'formidable' );
60
+			return;
61
+		}
62
+
63
+		$form_id = $form = $this->params['form'];
64
+		if ( $form_id ) {
65
+			$form = FrmForm::getOne($form_id);
66
+		}
67
+		$colspan = $this->get_column_count();
68 68
 
69 69
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/no_entries.php' );
70 70
 	}
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 	}
75 75
 
76 76
 	/**
77
-	* Gets the name of the primary column in the Entries screen
78
-	*
79
-	* @since 2.0.14
80
-	*
81
-	* @return string $primary_column
82
-	*/
77
+	 * Gets the name of the primary column in the Entries screen
78
+	 *
79
+	 * @since 2.0.14
80
+	 *
81
+	 * @return string $primary_column
82
+	 */
83 83
 	protected function get_primary_column_name() {
84 84
 		$columns = get_column_headers( $this->screen );
85 85
 		$hidden = get_hidden_columns( $this->screen );
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
 		$this->get_actions( $actions, $item, $view_link );
105 105
 
106
-        $action_links = $this->row_actions( $actions );
106
+		$action_links = $this->row_actions( $actions );
107 107
 
108 108
 		// Set up the checkbox ( because the user is editable, otherwise its empty )
109 109
 		$checkbox = "<input type='checkbox' name='item-action[]' id='cb-item-action-{$item->id}' value='{$item->id}' />";
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		$r = "<tr id='item-action-{$item->id}'$style>";
112 112
 
113 113
 		list( $columns, $hidden, , $primary ) = $this->get_column_info();
114
-        $action_col = false;
114
+		$action_col = false;
115 115
 
116 116
 		foreach ( $columns as $column_name => $column_display_name ) {
117 117
 			$class = $column_name . ' column-' . $column_name;
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 			if ( in_array( $column_name, $hidden ) ) {
124 124
 				$class .= ' frm_hidden';
125 125
 			} else if ( ! $action_col && ! in_array( $column_name, array( 'cb', 'id', 'form_id', 'post_id' ) ) ) {
126
-			    $action_col = $column_name;
127
-            }
126
+				$action_col = $column_name;
127
+			}
128 128
 
129 129
 			$attributes = 'class="' . esc_attr( $class ) . '"';
130 130
 			unset($class);
@@ -140,30 +140,30 @@  discard block
 block discarded – undo
140 140
 				case 'ip':
141 141
 				case 'id':
142 142
 				case 'item_key':
143
-				    $val = $item->{$col_name};
144
-				    break;
143
+					$val = $item->{$col_name};
144
+					break;
145 145
 				case 'name':
146 146
 				case 'description':
147
-				    $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100);
148
-				    break;
147
+					$val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100);
148
+					break;
149 149
 				case 'created_at':
150 150
 				case 'updated_at':
151
-				    $date = FrmAppHelper::get_formatted_time($item->{$col_name});
151
+					$date = FrmAppHelper::get_formatted_time($item->{$col_name});
152 152
 					$val = '<abbr title="' . esc_attr( FrmAppHelper::get_formatted_time( $item->{$col_name}, '', 'g:i:s A' ) ) . '">' . $date . '</abbr>';
153 153
 					break;
154 154
 				case 'is_draft':
155
-				    $val = empty($item->is_draft) ? __( 'No') : __( 'Yes');
156
-			        break;
155
+					$val = empty($item->is_draft) ? __( 'No') : __( 'Yes');
156
+					break;
157 157
 				case 'form_id':
158
-				    $val = FrmFormsHelper::edit_form_link($item->form_id);
159
-    				break;
158
+					$val = FrmFormsHelper::edit_form_link($item->form_id);
159
+					break;
160 160
 				case 'post_id':
161
-				    $val = FrmAppHelper::post_edit_link($item->post_id);
162
-				    break;
161
+					$val = FrmAppHelper::post_edit_link($item->post_id);
162
+					break;
163 163
 				case 'user_id':
164
-				    $user = get_userdata($item->user_id);
165
-				    $val = $user->user_login;
166
-				    break;
164
+					$user = get_userdata($item->user_id);
165
+					$val = $user->user_login;
166
+					break;
167 167
 				default:
168 168
 					$val = apply_filters( 'frm_entries_' . $col_name . '_column', false, compact( 'item' ) );
169 169
 					if ( $val === false ) {
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
173 173
 			}
174 174
 
175 175
 			if ( isset( $val ) ) {
176
-			    $r .= "<td $attributes>";
176
+				$r .= "<td $attributes>";
177 177
 				if ( $column_name == $action_col ) {
178 178
 					$edit_link = '?page=formidable-entries&frm_action=edit&id=' . $item->id;
179 179
 					$r .= '<a href="' . esc_url( isset( $actions['edit'] ) ? $edit_link : $view_link ) . '" class="row-title" >' . $val . '</a> ';
180
-			        $r .= $action_links;
180
+					$r .= $action_links;
181 181
 				} else {
182
-			        $r .= $val;
183
-			    }
184
-			    $r .= '</td>';
182
+					$r .= $val;
183
+				}
184
+				$r .= '</td>';
185 185
 			}
186 186
 			unset($val);
187 187
 		}
@@ -190,19 +190,19 @@  discard block
 block discarded – undo
190 190
 		return $r;
191 191
 	}
192 192
 
193
-    /**
194
-     * @param string $view_link
195
-     */
196
-    private function get_actions( &$actions, $item, $view_link ) {
193
+	/**
194
+	 * @param string $view_link
195
+	 */
196
+	private function get_actions( &$actions, $item, $view_link ) {
197 197
 		$actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>';
198 198
 
199
-        if ( current_user_can('frm_delete_entries') ) {
199
+		if ( current_user_can('frm_delete_entries') ) {
200 200
 			$delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form'];
201 201
 			$actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete that?', 'formidable' ) ) . '\')">' . __( 'Delete' ) . '</a>';
202
-	    }
202
+		}
203 203
 
204
-        $actions = apply_filters('frm_row_actions', $actions, $item);
205
-    }
204
+		$actions = apply_filters('frm_row_actions', $actions, $item);
205
+	}
206 206
 
207 207
 	private function get_column_value( $item, &$val ) {
208 208
 		$col_name = $this->column_name;
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 	    $s_query = array( 'it.form_id' => $form_id );
27 27
 
28
-		$s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : '';
28
+		$s = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
29 29
 
30 30
 	    if ( $s != '' && FrmAppHelper::pro_is_installed() ) {
31 31
 	        $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : '';
32
-	        $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid);
32
+	        $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid );
33 33
 	    }
34 34
 
35 35
         $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby;
36
-        if ( strpos($orderby, 'meta') !== false ) {
36
+        if ( strpos( $orderby, 'meta' ) !== false ) {
37 37
             $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) );
38 38
 			$orderby .= in_array( $order_field_type, array( 'number', 'scale' ) ) ? ' +0 ' : '';
39 39
         }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		$start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page );
46 46
 
47 47
 		$this->items = FrmEntry::getAll( $s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, false );
48
-        $total_items = FrmEntry::getRecordCount($s_query);
48
+        $total_items = FrmEntry::getRecordCount( $s_query );
49 49
 
50 50
 		$this->set_pagination_args( array(
51 51
 			'total_items' => $total_items,
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 
56 56
 	public function no_items() {
57 57
         $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
58
-	    if ( ! empty($s) ) {
58
+	    if ( ! empty( $s ) ) {
59 59
             _e( 'No Entries Found', 'formidable' );
60 60
             return;
61 61
         }
62 62
 
63 63
         $form_id = $form = $this->params['form'];
64 64
         if ( $form_id ) {
65
-            $form = FrmForm::getOne($form_id);
65
+            $form = FrmForm::getOne( $form_id );
66 66
         }
67 67
         $colspan = $this->get_column_count();
68 68
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 		$r = "<tr id='item-action-{$item->id}'$style>";
112 112
 
113
-		list( $columns, $hidden, , $primary ) = $this->get_column_info();
113
+		list( $columns, $hidden,, $primary ) = $this->get_column_info();
114 114
         $action_col = false;
115 115
 
116 116
 		foreach ( $columns as $column_name => $column_display_name ) {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             }
128 128
 
129 129
 			$attributes = 'class="' . esc_attr( $class ) . '"';
130
-			unset($class);
130
+			unset( $class );
131 131
 			$attributes .= ' data-colname="' . $column_display_name . '"';
132 132
 
133 133
 			$col_name = preg_replace( '/^(' . $this->params['form'] . '_)/', '', $column_name );
@@ -144,24 +144,24 @@  discard block
 block discarded – undo
144 144
 				    break;
145 145
 				case 'name':
146 146
 				case 'description':
147
-				    $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100);
147
+				    $val = FrmAppHelper::truncate( strip_tags( $item->{$col_name}), 100 );
148 148
 				    break;
149 149
 				case 'created_at':
150 150
 				case 'updated_at':
151
-				    $date = FrmAppHelper::get_formatted_time($item->{$col_name});
151
+				    $date = FrmAppHelper::get_formatted_time( $item->{$col_name});
152 152
 					$val = '<abbr title="' . esc_attr( FrmAppHelper::get_formatted_time( $item->{$col_name}, '', 'g:i:s A' ) ) . '">' . $date . '</abbr>';
153 153
 					break;
154 154
 				case 'is_draft':
155
-				    $val = empty($item->is_draft) ? __( 'No') : __( 'Yes');
155
+				    $val = empty( $item->is_draft ) ? __( 'No' ) : __( 'Yes' );
156 156
 			        break;
157 157
 				case 'form_id':
158
-				    $val = FrmFormsHelper::edit_form_link($item->form_id);
158
+				    $val = FrmFormsHelper::edit_form_link( $item->form_id );
159 159
     				break;
160 160
 				case 'post_id':
161
-				    $val = FrmAppHelper::post_edit_link($item->post_id);
161
+				    $val = FrmAppHelper::post_edit_link( $item->post_id );
162 162
 				    break;
163 163
 				case 'user_id':
164
-				    $user = get_userdata($item->user_id);
164
+				    $user = get_userdata( $item->user_id );
165 165
 				    $val = $user->user_login;
166 166
 				    break;
167 167
 				default:
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			    }
184 184
 			    $r .= '</td>';
185 185
 			}
186
-			unset($val);
186
+			unset( $val );
187 187
 		}
188 188
 		$r .= '</tr>';
189 189
 
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
     private function get_actions( &$actions, $item, $view_link ) {
197 197
 		$actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>';
198 198
 
199
-        if ( current_user_can('frm_delete_entries') ) {
199
+        if ( current_user_can( 'frm_delete_entries' ) ) {
200 200
 			$delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form'];
201 201
 			$actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete that?', 'formidable' ) ) . '\')">' . __( 'Delete' ) . '</a>';
202 202
 	    }
203 203
 
204
-        $actions = apply_filters('frm_row_actions', $actions, $item);
204
+        $actions = apply_filters( 'frm_row_actions', $actions, $item );
205 205
     }
206 206
 
207 207
 	private function get_column_value( $item, &$val ) {
Please login to merge, or discard this patch.
classes/helpers/FrmStylesHelper.php 2 patches
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -1,67 +1,67 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class FrmStylesHelper {
3 3
 
4
-    public static function jquery_themes() {
5
-        $themes = array(
6
-            'ui-lightness'  => 'UI Lightness',
7
-            'ui-darkness'   => 'UI Darkness',
8
-            'smoothness'    => 'Smoothness',
9
-            'start'         => 'Start',
10
-            'redmond'       => 'Redmond',
11
-            'sunny'         => 'Sunny',
12
-            'overcast'      => 'Overcast',
13
-            'le-frog'       => 'Le Frog',
14
-            'flick'         => 'Flick',
4
+	public static function jquery_themes() {
5
+		$themes = array(
6
+			'ui-lightness'  => 'UI Lightness',
7
+			'ui-darkness'   => 'UI Darkness',
8
+			'smoothness'    => 'Smoothness',
9
+			'start'         => 'Start',
10
+			'redmond'       => 'Redmond',
11
+			'sunny'         => 'Sunny',
12
+			'overcast'      => 'Overcast',
13
+			'le-frog'       => 'Le Frog',
14
+			'flick'         => 'Flick',
15 15
 			'pepper-grinder' => 'Pepper Grinder',
16
-            'eggplant'      => 'Eggplant',
17
-            'dark-hive'     => 'Dark Hive',
18
-            'cupertino'     => 'Cupertino',
19
-            'south-street'  => 'South Street',
20
-            'blitzer'       => 'Blitzer',
21
-            'humanity'      => 'Humanity',
22
-            'hot-sneaks'    => 'Hot Sneaks',
23
-            'excite-bike'   => 'Excite Bike',
24
-            'vader'         => 'Vader',
25
-            'dot-luv'       => 'Dot Luv',
26
-            'mint-choc'     => 'Mint Choc',
27
-            'black-tie'     => 'Black Tie',
28
-            'trontastic'    => 'Trontastic',
29
-            'swanky-purse'  => 'Swanky Purse',
30
-        );
31
-
32
-        $themes = apply_filters('frm_jquery_themes', $themes);
33
-        return $themes;
34
-    }
16
+			'eggplant'      => 'Eggplant',
17
+			'dark-hive'     => 'Dark Hive',
18
+			'cupertino'     => 'Cupertino',
19
+			'south-street'  => 'South Street',
20
+			'blitzer'       => 'Blitzer',
21
+			'humanity'      => 'Humanity',
22
+			'hot-sneaks'    => 'Hot Sneaks',
23
+			'excite-bike'   => 'Excite Bike',
24
+			'vader'         => 'Vader',
25
+			'dot-luv'       => 'Dot Luv',
26
+			'mint-choc'     => 'Mint Choc',
27
+			'black-tie'     => 'Black Tie',
28
+			'trontastic'    => 'Trontastic',
29
+			'swanky-purse'  => 'Swanky Purse',
30
+		);
31
+
32
+		$themes = apply_filters('frm_jquery_themes', $themes);
33
+		return $themes;
34
+	}
35 35
 
36 36
 	public static function jquery_css_url( $theme_css ) {
37
-        if ( $theme_css == -1 ) {
38
-            return;
39
-        }
40
-
41
-        if ( ! $theme_css || $theme_css == '' || $theme_css == 'ui-lightness' ) {
42
-            $css_file = FrmAppHelper::plugin_url() . '/css/ui-lightness/jquery-ui.css';
43
-        } else if ( preg_match('/^http.?:\/\/.*\..*$/', $theme_css) ) {
44
-            $css_file = $theme_css;
45
-        } else {
46
-            $uploads = self::get_upload_base();
37
+		if ( $theme_css == -1 ) {
38
+			return;
39
+		}
40
+
41
+		if ( ! $theme_css || $theme_css == '' || $theme_css == 'ui-lightness' ) {
42
+			$css_file = FrmAppHelper::plugin_url() . '/css/ui-lightness/jquery-ui.css';
43
+		} else if ( preg_match('/^http.?:\/\/.*\..*$/', $theme_css) ) {
44
+			$css_file = $theme_css;
45
+		} else {
46
+			$uploads = self::get_upload_base();
47 47
 			$file_path = '/formidable/css/' . $theme_css . '/jquery-ui.css';
48
-            if ( file_exists($uploads['basedir'] . $file_path) ) {
49
-                $css_file = $uploads['baseurl'] . $file_path;
50
-            } else {
48
+			if ( file_exists($uploads['basedir'] . $file_path) ) {
49
+				$css_file = $uploads['baseurl'] . $file_path;
50
+			} else {
51 51
 				$css_file = FrmAppHelper::jquery_ui_base_url() . '/themes/' . $theme_css . '/jquery-ui.min.css';
52
-            }
53
-        }
52
+			}
53
+		}
54 54
 
55
-        return $css_file;
56
-    }
55
+		return $css_file;
56
+	}
57 57
 
58
-    public static function enqueue_jquery_css() {
58
+	public static function enqueue_jquery_css() {
59 59
 		$form = self::get_form_for_page();
60 60
 		$theme_css = FrmStylesController::get_style_val( 'theme_css', $form );
61
-        if ( $theme_css != -1 ) {
62
-            wp_enqueue_style('jquery-theme', self::jquery_css_url($theme_css), array(), FrmAppHelper::plugin_version());
63
-        }
64
-    }
61
+		if ( $theme_css != -1 ) {
62
+			wp_enqueue_style('jquery-theme', self::jquery_css_url($theme_css), array(), FrmAppHelper::plugin_version());
63
+		}
64
+	}
65 65
 
66 66
 	public static function get_form_for_page() {
67 67
 		global $frm_vars;
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 		return $form_id;
78 78
 	}
79 79
 
80
-    public static function get_upload_base() {
81
-        $uploads = wp_upload_dir();
82
-        if ( is_ssl() && ! preg_match('/^https:\/\/.*\..*$/', $uploads['baseurl']) ) {
83
-            $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
84
-        }
80
+	public static function get_upload_base() {
81
+		$uploads = wp_upload_dir();
82
+		if ( is_ssl() && ! preg_match('/^https:\/\/.*\..*$/', $uploads['baseurl']) ) {
83
+			$uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
84
+		}
85 85
 
86
-        return $uploads;
87
-    }
86
+		return $uploads;
87
+	}
88 88
 
89 89
 	public static function style_menu( $active = '' ) {
90 90
 ?>
@@ -94,22 +94,22 @@  discard block
 block discarded – undo
94 94
 			<a href="<?php echo esc_url( admin_url('admin.php?page=formidable-styles&frm_action=custom_css' ) ) ?>" class="nav-tab <?php echo ( 'custom_css' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Custom CSS', 'formidable' ) ?></a>
95 95
         </h2>
96 96
 <?php
97
-    }
97
+	}
98 98
 
99
-    public static function minus_icons() {
100
-        return array(
99
+	public static function minus_icons() {
100
+		return array(
101 101
 			0 => array( '-' => '62e', '+' => '62f' ),
102 102
 			1 => array( '-' => '600', '+' => '602' ),
103 103
 			2 => array( '-' => '604', '+' => '603' ),
104 104
 			3 => array( '-' => '633', '+' => '632' ),
105 105
 			4 => array( '-' => '613', '+' => '60f' ),
106
-        );
107
-    }
106
+		);
107
+	}
108 108
 
109
-    public static function arrow_icons() {
110
-        $minus_icons = self::minus_icons();
109
+	public static function arrow_icons() {
110
+		$minus_icons = self::minus_icons();
111 111
 
112
-        return array(
112
+		return array(
113 113
 			6 => array( '-' => '62d', '+' => '62a' ),
114 114
 			0 => array( '-' => '60d', '+' => '609' ),
115 115
 			1 => array( '-' => '60e', '+' => '60c' ),
@@ -117,44 +117,44 @@  discard block
 block discarded – undo
117 117
 			3 => array( '-' => '62b', '+' => '628' ),
118 118
 			4 => array( '-' => '62c', '+' => '629' ),
119 119
 			5 => array( '-' => '635', '+' => '634' ),
120
-            'p0' => $minus_icons[0],
121
-            'p1' => $minus_icons[1],
122
-            'p2' => $minus_icons[2],
123
-            'p3' => $minus_icons[3],
124
-            'p4' => $minus_icons[4],
125
-        );
126
-    }
127
-
128
-    /**
129
-     * @since 2.0
130
-     * @return The class for this icon
131
-     */
120
+			'p0' => $minus_icons[0],
121
+			'p1' => $minus_icons[1],
122
+			'p2' => $minus_icons[2],
123
+			'p3' => $minus_icons[3],
124
+			'p4' => $minus_icons[4],
125
+		);
126
+	}
127
+
128
+	/**
129
+	 * @since 2.0
130
+	 * @return The class for this icon
131
+	 */
132 132
 	public static function icon_key_to_class( $key, $icon = '+', $type = 'arrow' ) {
133
-        if ( 'arrow' == $type && is_numeric($key) ) {
134
-            //frm_arrowup6_icon
133
+		if ( 'arrow' == $type && is_numeric($key) ) {
134
+			//frm_arrowup6_icon
135 135
 			$arrow = array( '-' => 'down', '+' => 'up' );
136 136
 			$class = 'frm_arrow' . $arrow[ $icon ];
137
-        } else {
138
-            //frm_minus1_icon
139
-            $key = str_replace('p', '', $key);
137
+		} else {
138
+			//frm_minus1_icon
139
+			$key = str_replace('p', '', $key);
140 140
 			$plus = array( '-' => 'minus', '+' => 'plus' );
141 141
 			$class = 'frm_' . $plus[ $icon ];
142
-        }
142
+		}
143 143
 
144
-        if ( $key ) {
145
-            $class .= $key;
146
-        }
147
-        $class .= '_icon';
144
+		if ( $key ) {
145
+			$class .= $key;
146
+		}
147
+		$class .= '_icon';
148 148
 
149
-        return $class;
150
-    }
149
+		return $class;
150
+	}
151 151
 
152 152
 	public static function bs_icon_select( $style, $frm_style, $type = 'arrow' ) {
153 153
 		$function_name = $type . '_icons';
154 154
 		$icons = self::$function_name();
155 155
 		unset( $function_name );
156 156
 
157
-        $name = ( 'arrow' == $type ) ? 'collapse_icon' : 'repeat_icon';
157
+		$name = ( 'arrow' == $type ) ? 'collapse_icon' : 'repeat_icon';
158 158
 ?>
159 159
     	<select name="<?php echo esc_attr( $frm_style->get_field_name($name) ) ?>" id="frm_<?php echo esc_attr( $name ) ?>" class="frm_icon_font frm_multiselect hide-if-js">
160 160
             <?php foreach ( $icons as $key => $icon ) { ?>
@@ -187,22 +187,22 @@  discard block
 block discarded – undo
187 187
             </ul>
188 188
         </div>
189 189
 <?php
190
-    }
190
+	}
191 191
 
192 192
 	public static function hex2rgb( $hex ) {
193
-        $hex = str_replace('#', '', $hex);
193
+		$hex = str_replace('#', '', $hex);
194 194
 
195
-        if ( strlen($hex) == 3 ) {
195
+		if ( strlen($hex) == 3 ) {
196 196
 			$r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) );
197 197
 			$g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) );
198 198
 			$b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) );
199
-        } else {
199
+		} else {
200 200
 			$r = hexdec( substr( $hex, 0, 2 ) );
201 201
 			$g = hexdec( substr( $hex, 2, 2 ) );
202 202
 			$b = hexdec( substr( $hex, 4, 2 ) );
203
-        }
203
+		}
204 204
 		$rgb = array( $r, $g, $b );
205
-        return implode(',', $rgb); // returns the rgb values separated by commas
206
-        //return $rgb; // returns an array with the rgb values
207
-    }
205
+		return implode(',', $rgb); // returns the rgb values separated by commas
206
+		//return $rgb; // returns an array with the rgb values
207
+	}
208 208
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             'swanky-purse'  => 'Swanky Purse',
30 30
         );
31 31
 
32
-        $themes = apply_filters('frm_jquery_themes', $themes);
32
+        $themes = apply_filters( 'frm_jquery_themes', $themes );
33 33
         return $themes;
34 34
     }
35 35
 
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 
41 41
         if ( ! $theme_css || $theme_css == '' || $theme_css == 'ui-lightness' ) {
42 42
             $css_file = FrmAppHelper::plugin_url() . '/css/ui-lightness/jquery-ui.css';
43
-        } else if ( preg_match('/^http.?:\/\/.*\..*$/', $theme_css) ) {
43
+        } else if ( preg_match( '/^http.?:\/\/.*\..*$/', $theme_css ) ) {
44 44
             $css_file = $theme_css;
45 45
         } else {
46 46
             $uploads = self::get_upload_base();
47 47
 			$file_path = '/formidable/css/' . $theme_css . '/jquery-ui.css';
48
-            if ( file_exists($uploads['basedir'] . $file_path) ) {
48
+            if ( file_exists( $uploads['basedir'] . $file_path ) ) {
49 49
                 $css_file = $uploads['baseurl'] . $file_path;
50 50
             } else {
51 51
 				$css_file = FrmAppHelper::jquery_ui_base_url() . '/themes/' . $theme_css . '/jquery-ui.min.css';
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		$form = self::get_form_for_page();
60 60
 		$theme_css = FrmStylesController::get_style_val( 'theme_css', $form );
61 61
         if ( $theme_css != -1 ) {
62
-            wp_enqueue_style('jquery-theme', self::jquery_css_url($theme_css), array(), FrmAppHelper::plugin_version());
62
+            wp_enqueue_style( 'jquery-theme', self::jquery_css_url( $theme_css ), array(), FrmAppHelper::plugin_version() );
63 63
         }
64 64
     }
65 65
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 
80 80
     public static function get_upload_base() {
81 81
         $uploads = wp_upload_dir();
82
-        if ( is_ssl() && ! preg_match('/^https:\/\/.*\..*$/', $uploads['baseurl']) ) {
83
-            $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
82
+        if ( is_ssl() && ! preg_match( '/^https:\/\/.*\..*$/', $uploads['baseurl'] ) ) {
83
+            $uploads['baseurl'] = str_replace( 'http://', 'https://', $uploads['baseurl'] );
84 84
         }
85 85
 
86 86
         return $uploads;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         <h2 class="nav-tab-wrapper">
92 92
 			<a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles' ) ) ?>" class="nav-tab <?php echo ( '' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Edit Styles', 'formidable' ) ?></a>
93 93
 			<a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=manage' ) ) ?>" class="nav-tab <?php echo ( 'manage' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Manage Form Styles', 'formidable' ) ?></a>
94
-			<a href="<?php echo esc_url( admin_url('admin.php?page=formidable-styles&frm_action=custom_css' ) ) ?>" class="nav-tab <?php echo ( 'custom_css' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Custom CSS', 'formidable' ) ?></a>
94
+			<a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=custom_css' ) ) ?>" class="nav-tab <?php echo ( 'custom_css' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Custom CSS', 'formidable' ) ?></a>
95 95
         </h2>
96 96
 <?php
97 97
     }
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
      * @return The class for this icon
131 131
      */
132 132
 	public static function icon_key_to_class( $key, $icon = '+', $type = 'arrow' ) {
133
-        if ( 'arrow' == $type && is_numeric($key) ) {
133
+        if ( 'arrow' == $type && is_numeric( $key ) ) {
134 134
             //frm_arrowup6_icon
135 135
 			$arrow = array( '-' => 'down', '+' => 'up' );
136
-			$class = 'frm_arrow' . $arrow[ $icon ];
136
+			$class = 'frm_arrow' . $arrow[$icon];
137 137
         } else {
138 138
             //frm_minus1_icon
139
-            $key = str_replace('p', '', $key);
139
+            $key = str_replace( 'p', '', $key );
140 140
 			$plus = array( '-' => 'minus', '+' => 'plus' );
141
-			$class = 'frm_' . $plus[ $icon ];
141
+			$class = 'frm_' . $plus[$icon];
142 142
         }
143 143
 
144 144
         if ( $key ) {
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 
157 157
         $name = ( 'arrow' == $type ) ? 'collapse_icon' : 'repeat_icon';
158 158
 ?>
159
-    	<select name="<?php echo esc_attr( $frm_style->get_field_name($name) ) ?>" id="frm_<?php echo esc_attr( $name ) ?>" class="frm_icon_font frm_multiselect hide-if-js">
159
+    	<select name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ) ?>" id="frm_<?php echo esc_attr( $name ) ?>" class="frm_icon_font frm_multiselect hide-if-js">
160 160
             <?php foreach ( $icons as $key => $icon ) { ?>
161
-			<option value="<?php echo esc_attr( $key ) ?>" <?php selected( $style->post_content[ $name ], $key ) ?>>
161
+			<option value="<?php echo esc_attr( $key ) ?>" <?php selected( $style->post_content[$name], $key ) ?>>
162 162
 				<?php echo '&#xe' . $icon['+'] . '; &#xe' . $icon['-'] . ';'; ?>
163 163
             </option>
164 164
             <?php } ?>
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 
167 167
         <div class="btn-group hide-if-no-js" id="frm_<?php echo esc_attr( $name ) ?>_select">
168 168
             <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button">
169
-				<i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ) ?>"></i>
170
-				<i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ) ?>"></i>
169
+				<i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[$name], '+', $type ) ) ?>"></i>
170
+				<i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[$name], '-', $type ) ) ?>"></i>
171 171
                 <b class="caret"></b>
172 172
             </button>
173 173
             <ul class="multiselect-container frm-dropdown-menu">
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
     }
191 191
 
192 192
 	public static function hex2rgb( $hex ) {
193
-        $hex = str_replace('#', '', $hex);
193
+        $hex = str_replace( '#', '', $hex );
194 194
 
195
-        if ( strlen($hex) == 3 ) {
195
+        if ( strlen( $hex ) == 3 ) {
196 196
 			$r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) );
197 197
 			$g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) );
198 198
 			$b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) );
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			$b = hexdec( substr( $hex, 4, 2 ) );
203 203
         }
204 204
 		$rgb = array( $r, $g, $b );
205
-        return implode(',', $rgb); // returns the rgb values separated by commas
205
+        return implode( ',', $rgb ); // returns the rgb values separated by commas
206 206
         //return $rgb; // returns an array with the rgb values
207 207
     }
208 208
 }
Please login to merge, or discard this patch.
css/_single_theme.css.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -3,23 +3,23 @@  discard block
 block discarded – undo
3 3
 if ( isset($_GET['frm_style_setting']) || isset($_GET['flat']) ) {
4 4
 	if ( isset( $_GET['frm_style_setting'] ) ) {
5 5
 		extract( $_GET['frm_style_setting']['post_content'] );
6
-    } else {
7
-        extract($_GET);
8
-    }
6
+	} else {
7
+		extract($_GET);
8
+	}
9 9
 
10
-    $important_style = isset($important_style) ? $important_style : 0;
11
-    $auto_width = isset($auto_width) ? $auto_width : 0;
12
-    $submit_style = isset($submit_style) ? $submit_style : 0;
10
+	$important_style = isset($important_style) ? $important_style : 0;
11
+	$auto_width = isset($auto_width) ? $auto_width : 0;
12
+	$submit_style = isset($submit_style) ? $submit_style : 0;
13 13
 
14 14
 	$style_name = FrmAppHelper::simple_get( 'style_name', 'sanitize_title' );
15 15
 	if ( ! empty( $style_name ) ) {
16 16
 		$style_class = $style_name . '.with_frm_style';
17
-    } else {
18
-        $style_class = 'with_frm_style';
19
-    }
17
+	} else {
18
+		$style_class = 'with_frm_style';
19
+	}
20 20
 } else {
21 21
 	$style_class = 'frm_style_' . $style->post_name . '.with_frm_style';
22
-    extract($style->post_content);
22
+	extract($style->post_content);
23 23
 }
24 24
 
25 25
 $important = empty($important_style) ? '' : ' !important';
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 }
41 41
 
42 42
 if ( ! isset($collapse_icon) ) {
43
-    $collapse_icon = 0;
43
+	$collapse_icon = 0;
44 44
 }
45 45
 
46 46
 if ( ! isset( $center_form ) ) {
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
     color:#<?php echo esc_html( $text_color . $important ) ?>;
338 338
 	background-color:<?php echo esc_html( ( empty( $bg_color ) ? 'transparent' : '#' . $bg_color ) . $important ); ?>;
339 339
 <?php if ( ! empty($important) ) {
340
-    echo esc_html( 'background-image:none' . $important . ';' );
340
+	echo esc_html( 'background-image:none' . $important . ';' );
341 341
 }
342 342
 ?>
343 343
     border-color:#<?php echo esc_html( $border_color . $important ) ?>;
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
     color:#<?php echo esc_html( $submit_active_color . $important ) ?>;
549 549
 }
550 550
 <?php
551
-    }
551
+	}
552 552
 }
553 553
 ?>
554 554
 
@@ -851,11 +851,11 @@  discard block
 block discarded – undo
851 851
 
852 852
 .<?php echo esc_html( $style_class ) ?> .chosen-container-single .chosen-single div{
853 853
 <?php
854
-    // calculate the top position based on field padding
855
-    $top_pad = explode(' ', $field_pad);
856
-    $top_pad = reset($top_pad); // the top padding is listed first
857
-    $pad_unit = preg_replace('/[0-9]+/', '', $top_pad); //px, em, rem...
858
-    $top_margin = (int) str_replace($pad_unit, '', $top_pad) / 2;
854
+	// calculate the top position based on field padding
855
+	$top_pad = explode(' ', $field_pad);
856
+	$top_pad = reset($top_pad); // the top padding is listed first
857
+	$pad_unit = preg_replace('/[0-9]+/', '', $top_pad); //px, em, rem...
858
+	$top_margin = (int) str_replace($pad_unit, '', $top_pad) / 2;
859 859
 ?>
860 860
     top:<?php echo esc_html( $top_margin . $pad_unit . $important ) ?>;
861 861
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( isset($_GET['frm_style_setting']) || isset($_GET['flat']) ) {
3
+if ( isset( $_GET['frm_style_setting'] ) || isset( $_GET['flat'] ) ) {
4 4
 	if ( isset( $_GET['frm_style_setting'] ) ) {
5 5
 		extract( $_GET['frm_style_setting']['post_content'] );
6 6
     } else {
7
-        extract($_GET);
7
+        extract( $_GET );
8 8
     }
9 9
 
10
-    $important_style = isset($important_style) ? $important_style : 0;
11
-    $auto_width = isset($auto_width) ? $auto_width : 0;
12
-    $submit_style = isset($submit_style) ? $submit_style : 0;
10
+    $important_style = isset( $important_style ) ? $important_style : 0;
11
+    $auto_width = isset( $auto_width ) ? $auto_width : 0;
12
+    $submit_style = isset( $submit_style ) ? $submit_style : 0;
13 13
 
14 14
 	$style_name = FrmAppHelper::simple_get( 'style_name', 'sanitize_title' );
15 15
 	if ( ! empty( $style_name ) ) {
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
     }
20 20
 } else {
21 21
 	$style_class = 'frm_style_' . $style->post_name . '.with_frm_style';
22
-    extract($style->post_content);
22
+    extract( $style->post_content );
23 23
 }
24 24
 
25
-$important = empty($important_style) ? '' : ' !important';
25
+$important = empty( $important_style ) ? '' : ' !important';
26 26
 $label_margin = (int) $width + 10;
27 27
 
28 28
 $minus_icons = FrmStylesHelper::minus_icons();
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	$change_margin = 650 . 'px';
40 40
 }
41 41
 
42
-if ( ! isset($collapse_icon) ) {
42
+if ( ! isset( $collapse_icon ) ) {
43 43
     $collapse_icon = 0;
44 44
 }
45 45
 
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 }
149 149
 
150 150
 .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_minus_icon:before{
151
-	content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['-'] : $minus_icons[1]['-'] ) ?>";
151
+	content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['-'] : $minus_icons[1]['-'] ) ?>";
152 152
 }
153 153
 
154 154
 .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_plus_icon:before{
155
-	content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['+'] : $minus_icons[1]['+'] ) ?>";
155
+	content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['+'] : $minus_icons[1]['+'] ) ?>";
156 156
 }
157 157
 
158 158
 .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_minus_icon:before,
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
 }
162 162
 
163 163
 .<?php echo esc_html( $style_class ) ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{
164
-	content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ) ?>";
164
+	content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['-'] : $arrow_icons[1]['-'] ) ?>";
165 165
 }
166 166
 
167 167
 .<?php echo esc_html( $style_class ) ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{
168
-	content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ) ?>";
168
+	content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['+'] : $arrow_icons[1]['+'] ) ?>";
169 169
 }
170 170
 
171 171
 .<?php echo esc_html( $style_class ) ?> .form-field{
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 .<?php echo esc_html( $style_class ) ?> .frm_error{
188 188
     margin:0;
189 189
     padding:0;
190
-    font-family:<?php echo FrmAppHelper::kses( stripslashes($font) . $important ) ?>;
190
+    font-family:<?php echo FrmAppHelper::kses( stripslashes( $font ) . $important ) ?>;
191 191
     font-size:<?php echo esc_html( $description_font_size . $important ) ?>;
192 192
     color:#<?php echo esc_html( $description_color . $important ) ?>;
193 193
     font-weight:<?php echo esc_html( $description_weight . $important ) ?>;
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 
294 294
 .<?php echo esc_html( $style_class ) ?> .frm_scale label{
295 295
     font-weight:<?php echo esc_html( $check_weight . $important ) ?>;
296
-    font-family:<?php echo FrmAppHelper::kses( stripslashes($font) . $important ) ?>;
296
+    font-family:<?php echo FrmAppHelper::kses( stripslashes( $font ) . $important ) ?>;
297 297
     font-size:<?php echo esc_html( $check_font_size . $important ) ?>;
298 298
     color:#<?php echo esc_html( $check_label_color . $important ) ?>;
299 299
 }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 .<?php echo esc_html( $style_class ) ?> select,
314 314
 .<?php echo esc_html( $style_class ) ?> textarea,
315 315
 .<?php echo esc_html( $style_class ) ?> .chosen-container{
316
-	font-family:<?php echo FrmAppHelper::kses( stripslashes($font) . $important ) ?>;
316
+	font-family:<?php echo FrmAppHelper::kses( stripslashes( $font ) . $important ) ?>;
317 317
     font-size:<?php echo esc_html( $field_font_size ) ?>;
318 318
     margin-bottom:0<?php echo esc_html( $important ) ?>;
319 319
 }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 .<?php echo esc_html( $style_class ) ?> .chosen-container-single .chosen-single{
337 337
     color:#<?php echo esc_html( $text_color . $important ) ?>;
338 338
 	background-color:<?php echo esc_html( ( empty( $bg_color ) ? 'transparent' : '#' . $bg_color ) . $important ); ?>;
339
-<?php if ( ! empty($important) ) {
339
+<?php if ( ! empty( $important ) ) {
340 340
     echo esc_html( 'background-image:none' . $important . ';' );
341 341
 }
342 342
 ?>
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 
361 361
 .<?php echo esc_html( $style_class ) ?> input[type=file]::-webkit-file-upload-button{
362 362
     color:#<?php echo esc_html( $text_color . $important ) ?>;
363
-	background-color:<?php echo esc_html( ( empty( $bg_color ) ? 'transparent' : '# '. $bg_color ) . $important ); ?>;
363
+	background-color:<?php echo esc_html( ( empty( $bg_color ) ? 'transparent' : '# ' . $bg_color ) . $important ); ?>;
364 364
 	padding:<?php echo esc_html( $field_pad . $important ) ?>;
365 365
 	border-radius:<?php echo esc_html( $border_radius . $important ) ?>;
366 366
 	border-color:#<?php echo esc_html( $border_color . $important ) ?>;
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
     line-height:normal<?php echo esc_html( $important ) ?>;
495 495
     text-align:center;
496 496
     background:#<?php echo esc_html( $submit_bg_color );
497
-	if ( ! empty($submit_bg_img) ) {
497
+	if ( ! empty( $submit_bg_img ) ) {
498 498
 		echo esc_html( ' url(' . $submit_bg_img . ')' );
499 499
 	}
500 500
 	echo esc_html( $important ); ?>;
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 
593 593
 .<?php echo esc_html( $style_class ) ?> .frm_radio label,
594 594
 .<?php echo esc_html( $style_class ) ?> .frm_checkbox label{
595
-    font-family:<?php echo FrmAppHelper::kses( stripslashes($font) . $important ) ?>;
595
+    font-family:<?php echo FrmAppHelper::kses( stripslashes( $font ) . $important ) ?>;
596 596
     font-size:<?php echo esc_html( $check_font_size . $important ) ?>;
597 597
     color:#<?php echo esc_html( $check_label_color . $important ) ?>;
598 598
     font-weight:<?php echo esc_html( $check_weight . $important ) ?>;
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
     -webkit-border-radius:<?php echo esc_html( $border_radius . $important ) ?>;
734 734
     border-radius:<?php echo esc_html( $border_radius . $important ) ?>;
735 735
     font-size:<?php echo esc_html( $submit_font_size . $important ) ?>;
736
-    font-family:<?php echo FrmAppHelper::kses( stripslashes($font) . $important ) ?>;
736
+    font-family:<?php echo FrmAppHelper::kses( stripslashes( $font ) . $important ) ?>;
737 737
     font-weight:<?php echo esc_html( $submit_weight . $important ) ?>;
738 738
     color:#<?php echo esc_html( $submit_text_color . $important ) ?>;
739 739
     background:#<?php echo esc_html( $submit_bg_color . $important ) ?>;
@@ -852,10 +852,10 @@  discard block
 block discarded – undo
852 852
 .<?php echo esc_html( $style_class ) ?> .chosen-container-single .chosen-single div{
853 853
 <?php
854 854
     // calculate the top position based on field padding
855
-    $top_pad = explode(' ', $field_pad);
856
-    $top_pad = reset($top_pad); // the top padding is listed first
857
-    $pad_unit = preg_replace('/[0-9]+/', '', $top_pad); //px, em, rem...
858
-    $top_margin = (int) str_replace($pad_unit, '', $top_pad) / 2;
855
+    $top_pad = explode( ' ', $field_pad );
856
+    $top_pad = reset( $top_pad ); // the top padding is listed first
857
+    $pad_unit = preg_replace( '/[0-9]+/', '', $top_pad ); //px, em, rem...
858
+    $top_margin = (int) str_replace( $pad_unit, '', $top_pad ) / 2;
859 859
 ?>
860 860
     top:<?php echo esc_html( $top_margin . $pad_unit . $important ) ?>;
861 861
 }
Please login to merge, or discard this patch.
css/custom_theme.css.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! isset($saving) ) {
3
-    header( 'Content-type: text/css' );
3
+	header( 'Content-type: text/css' );
4 4
 
5
-    if ( isset($css) && $css ) {
6
-        echo $css;
7
-        die();
8
-    }
5
+	if ( isset($css) && $css ) {
6
+		echo $css;
7
+		die();
8
+	}
9 9
 }
10 10
 
11 11
 if ( ! isset($frm_style) ) {
12
-    $frm_style = new FrmStyle();
12
+	$frm_style = new FrmStyle();
13 13
 }
14 14
 
15 15
 $styles = $frm_style->get_all();
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 <?php
188 188
 foreach ( $styles as $style ) {
189 189
 	include( dirname( __FILE__ ) . '/_single_theme.css.php' );
190
-    unset($style);
190
+	unset($style);
191 191
 }
192 192
 ?>
193 193
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! isset($saving) ) {
2
+if ( ! isset( $saving ) ) {
3 3
     header( 'Content-type: text/css' );
4 4
 
5
-    if ( isset($css) && $css ) {
5
+    if ( isset( $css ) && $css ) {
6 6
         echo $css;
7 7
         die();
8 8
     }
9 9
 }
10 10
 
11
-if ( ! isset($frm_style) ) {
11
+if ( ! isset( $frm_style ) ) {
12 12
     $frm_style = new FrmStyle();
13 13
 }
14 14
 
15 15
 $styles = $frm_style->get_all();
16
-$default_style = $frm_style->get_default_style($styles);
16
+$default_style = $frm_style->get_default_style( $styles );
17 17
 $defaults = $default_style->post_content;
18 18
 ?>
19 19
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 <?php
188 188
 foreach ( $styles as $style ) {
189 189
 	include( dirname( __FILE__ ) . '/_single_theme.css.php' );
190
-    unset($style);
190
+    unset( $style );
191 191
 }
192 192
 ?>
193 193
 
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
     overflow:hidden!important;
620 620
 }
621 621
 
622
-<?php include( dirname(__FILE__) . '/frm_grids.css' ); ?>
622
+<?php include( dirname( __FILE__ ) . '/frm_grids.css' ); ?>
623 623
 
624 624
 /* Left and right label styling for non-Formidable styling - very basic, not responsive */
625 625
 .frm_form_field.frm_left_container label.frm_primary_label{
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
     -moz-border-radius:<?php echo $defaults['border_radius'] ?>;
976 976
     -webkit-border-radius:<?php echo $defaults['border_radius'] ?>;
977 977
     border-radius:<?php echo $defaults['border_radius'] ?>;
978
-    width:<?php echo ($defaults['field_width'] == '' ? 'auto' : $defaults['field_width']) ?>;
978
+    width:<?php echo ( $defaults['field_width'] == '' ? 'auto' : $defaults['field_width'] ) ?>;
979 979
     max-width:100%;
980 980
     font-size:<?php echo $defaults['field_font_size'] ?>;
981 981
     padding:<?php echo $defaults['field_pad'] ?>;
Please login to merge, or discard this patch.
classes/views/frm-fields/input.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -10,41 +10,41 @@  discard block
 block discarded – undo
10 10
 <?php
11 11
 
12 12
 } else if ( $field['type'] == 'radio' ) {
13
-    $read_only = false;
13
+	$read_only = false;
14 14
 	if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) {
15
-        $read_only = true; ?>
15
+		$read_only = true; ?>
16 16
 <input type="hidden" value="<?php echo esc_attr( $field['value'] ) ?>" name="<?php echo esc_attr( $field_name ) ?>" />
17 17
 <?php
18
-    }
18
+	}
19 19
 
20
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
20
+	if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
21 21
 		do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
22
-    } else if ( is_array($field['options']) ) {
23
-        foreach ( $field['options'] as $opt_key => $opt ) {
22
+	} else if ( is_array($field['options']) ) {
23
+		foreach ( $field['options'] as $opt_key => $opt ) {
24 24
 			if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] != $opt_key ) ) {
25
-                continue;
26
-            }
25
+				continue;
26
+			}
27 27
 
28
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
29
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?>
28
+			$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
29
+			$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?>
30 30
 			<div class="<?php echo esc_attr( apply_filters( 'frm_radio_class', 'frm_radio', $field, $field_val ) ) ?>"><?php
31 31
 
32 32
 			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
33 33
 				?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
34
-            }
35
-            $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
34
+			}
35
+			$checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
36 36
 
37
-            $other_opt = false;
38
-            $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
39
-            ?>
37
+			$other_opt = false;
38
+			$other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
39
+			?>
40 40
             <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php
41
-            echo $checked;
42
-            do_action('frm_field_input_html', $field);
41
+			echo $checked;
42
+			do_action('frm_field_input_html', $field);
43 43
 ?>/><?php
44 44
 
45 45
 			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
46 46
 				echo ' ' . $opt . '</label>';
47
-            }
47
+			}
48 48
 
49 49
 			FrmFieldsHelper::include_other_input( array(
50 50
 				'other_opt' => $other_opt, 'read_only' => $read_only,
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 				'html_id' => $html_id, 'opt_key' => $opt_key,
54 54
 			) );
55 55
 
56
-            unset( $other_opt, $other_args );
56
+			unset( $other_opt, $other_args );
57 57
 ?></div>
58 58
 <?php
59
-        }
60
-    }
59
+		}
60
+	}
61 61
 } else if ( $field['type'] == 'select' ) {
62
-    $read_only = false;
63
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
62
+	$read_only = false;
63
+	if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
64 64
 		echo FrmFieldsHelper::dropdown_categories( array( 'name' => $field_name, 'field' => $field ) );
65 65
 	} else {
66 66
 		if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			?>
94 94
 		<option value="<?php echo esc_attr($field_val) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : '';?>><?php echo ($opt == '') ? ' ' : $opt; ?></option>
95 95
     <?php
96
-    	} ?>
96
+		} ?>
97 97
 </select>
98 98
 <?php
99 99
 		FrmFieldsHelper::include_other_input( array(
@@ -102,52 +102,52 @@  discard block
 block discarded – undo
102 102
 			'value' => $other_args['value'], 'field' => $field,
103 103
 			'html_id' => $html_id, 'opt_key' => false,
104 104
 		) );
105
-    }
105
+	}
106 106
 } else if ( $field['type'] == 'checkbox' ) {
107
-    $checked_values = $field['value'];
108
-    $read_only = false;
107
+	$checked_values = $field['value'];
108
+	$read_only = false;
109 109
 
110 110
 	if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) {
111
-        $read_only = true;
112
-        if ( $checked_values ) {
113
-            foreach ( (array) $checked_values as $checked_value ) { ?>
111
+		$read_only = true;
112
+		if ( $checked_values ) {
113
+			foreach ( (array) $checked_values as $checked_value ) { ?>
114 114
 <input type="hidden" value="<?php echo esc_attr( $checked_value ) ?>" name="<?php echo esc_attr( $field_name ) ?>[]" />
115 115
 <?php
116
-            }
117
-        } else { ?>
116
+			}
117
+		} else { ?>
118 118
 <input type="hidden" value="" name="<?php echo esc_attr( $field_name ) ?>[]" />
119 119
 <?php
120
-        }
121
-    }
120
+		}
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
 		do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
125
-    } else if ( $field['options'] ) {
126
-        foreach ( $field['options'] as $opt_key => $opt ) {
127
-            if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] != $opt_key) ) {
128
-                continue;
129
-            }
130
-
131
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
132
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
133
-            $checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : '';
134
-
135
-            // Check if other opt, and get values for other field if needed
136
-            $other_opt = false;
125
+	} else if ( $field['options'] ) {
126
+		foreach ( $field['options'] as $opt_key => $opt ) {
127
+			if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] != $opt_key) ) {
128
+				continue;
129
+			}
130
+
131
+			$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
132
+			$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
133
+			$checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : '';
134
+
135
+			// Check if other opt, and get values for other field if needed
136
+			$other_opt = false;
137 137
 			$other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $checked );
138 138
 
139
-            ?>
139
+			?>
140 140
 			<div class="<?php echo esc_attr( apply_filters( 'frm_checkbox_class', 'frm_checkbox', $field, $field_val ) ) ?>" id="frm_checkbox_<?php echo esc_attr( $field['id'] ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
141 141
 
142
-            if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
143
-                ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
144
-            }
142
+			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
143
+				?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
144
+			}
145 145
 
146
-            ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php
146
+			?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php
147 147
 
148
-            if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
148
+			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
149 149
 				echo ' ' . $opt . '</label>';
150
-            }
150
+			}
151 151
 
152 152
 			FrmFieldsHelper::include_other_input( array(
153 153
 				'other_opt' => $other_opt, 'read_only' => $read_only,
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 				'html_id' => $html_id, 'opt_key' => $opt_key,
157 157
 			) );
158 158
 
159
-            unset( $other_opt, $other_args, $checked );
159
+			unset( $other_opt, $other_args, $checked );
160 160
 
161
-            ?></div>
161
+			?></div>
162 162
 <?php
163
-        }
164
-    }
163
+		}
164
+	}
165 165
 } else if ( $field['type'] == 'captcha' && ! FrmAppHelper::is_admin() ) {
166
-    $frm_settings = FrmAppHelper::get_settings();
167
-    if ( ! empty($frm_settings->pubkey) ) {
168
-        FrmFieldsHelper::display_recaptcha($field);
169
-    }
166
+	$frm_settings = FrmAppHelper::get_settings();
167
+	if ( ! empty($frm_settings->pubkey) ) {
168
+		FrmFieldsHelper::display_recaptcha($field);
169
+	}
170 170
 } else {
171 171
 	do_action( 'frm_form_fields', $field, $field_name, compact( 'errors', 'html_id' ) );
172 172
 	do_action( 'frm_form_field_' . $field['type'], $field, $field_name, compact( 'errors', 'html_id' ) );
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php if ( in_array( $field['type'], array( 'email', 'url', 'text' ) ) ) { ?>
2
-<input type="<?php echo ( $frm_settings->use_html || $field['type'] == 'password' ) ? $field['type'] : 'text'; ?>" id="<?php echo esc_attr( $html_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" value="<?php echo esc_attr( $field['value'] ) ?>" <?php do_action('frm_field_input_html', $field) ?>/>
2
+<input type="<?php echo ( $frm_settings->use_html || $field['type'] == 'password' ) ? $field['type'] : 'text'; ?>" id="<?php echo esc_attr( $html_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" value="<?php echo esc_attr( $field['value'] ) ?>" <?php do_action( 'frm_field_input_html', $field ) ?>/>
3 3
 <?php } else if ( $field['type'] == 'textarea' ) { ?>
4 4
 <textarea name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php
5 5
 if ( $field['max'] ) {
6 6
 	echo 'rows="' . esc_attr( $field['max'] ) . '" ';
7 7
 }
8
-do_action('frm_field_input_html', $field);
9
-?>><?php echo FrmAppHelper::esc_textarea($field['value']) ?></textarea>
8
+do_action( 'frm_field_input_html', $field );
9
+?>><?php echo FrmAppHelper::esc_textarea( $field['value'] ) ?></textarea>
10 10
 <?php
11 11
 
12 12
 } else if ( $field['type'] == 'radio' ) {
@@ -17,29 +17,29 @@  discard block
 block discarded – undo
17 17
 <?php
18 18
     }
19 19
 
20
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
20
+    if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
21 21
 		do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
22
-    } else if ( is_array($field['options']) ) {
22
+    } else if ( is_array( $field['options'] ) ) {
23 23
         foreach ( $field['options'] as $opt_key => $opt ) {
24 24
 			if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] != $opt_key ) ) {
25 25
                 continue;
26 26
             }
27 27
 
28
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
29
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?>
28
+            $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
29
+            $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); ?>
30 30
 			<div class="<?php echo esc_attr( apply_filters( 'frm_radio_class', 'frm_radio', $field, $field_val ) ) ?>"><?php
31 31
 
32 32
 			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
33 33
 				?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
34 34
             }
35
-            $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
35
+            $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' ';
36 36
 
37 37
             $other_opt = false;
38 38
             $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
39 39
             ?>
40 40
             <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php
41 41
             echo $checked;
42
-            do_action('frm_field_input_html', $field);
42
+            do_action( 'frm_field_input_html', $field );
43 43
 ?>/><?php
44 44
 
45 45
 			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     }
61 61
 } else if ( $field['type'] == 'select' ) {
62 62
     $read_only = false;
63
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
63
+    if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
64 64
 		echo FrmFieldsHelper::dropdown_categories( array( 'name' => $field_name, 'field' => $field ) );
65 65
 	} else {
66 66
 		if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) {
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 					<input type="hidden" value="<?php echo esc_attr( $selected_value ) ?>" name="<?php echo esc_attr( $field_name ) ?>[]" /> <?php
72 72
 				}
73 73
 			} else { ?>
74
-				<input type="hidden" value="<?php echo esc_attr($field['value']) ?>" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" /> <?php
74
+				<input type="hidden" value="<?php echo esc_attr( $field['value'] ) ?>" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" /> <?php
75 75
 			} ?>
76
-				<select disabled="disabled" <?php do_action('frm_field_input_html', $field) ?>> <?php
76
+				<select disabled="disabled" <?php do_action( 'frm_field_input_html', $field ) ?>> <?php
77 77
 
78 78
 		} else { ?>
79
-<select name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php do_action('frm_field_input_html', $field) ?>>
79
+<select name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php do_action( 'frm_field_input_html', $field ) ?>>
80 80
 <?php   }
81 81
 
82 82
 		$other_opt = $other_checked = false;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 				}
92 92
 			}
93 93
 			?>
94
-		<option value="<?php echo esc_attr($field_val) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : '';?>><?php echo ($opt == '') ? ' ' : $opt; ?></option>
94
+		<option value="<?php echo esc_attr( $field_val ) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : ''; ?>><?php echo ( $opt == '' ) ? ' ' : $opt; ?></option>
95 95
     <?php
96 96
     	} ?>
97 97
 </select>
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
         }
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
 		do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
125 125
     } else if ( $field['options'] ) {
126 126
         foreach ( $field['options'] as $opt_key => $opt ) {
127
-            if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] != $opt_key) ) {
127
+            if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] != $opt_key ) ) {
128 128
                 continue;
129 129
             }
130 130
 
131
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
132
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
133
-            $checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : '';
131
+            $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
132
+            $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
133
+            $checked = FrmAppHelper::check_selected( $checked_values, $field_val ) ? ' checked="checked"' : '';
134 134
 
135 135
             // Check if other opt, and get values for other field if needed
136 136
             $other_opt = false;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
144 144
             }
145 145
 
146
-            ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php
146
+            ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action( 'frm_field_input_html', $field ) ?> /><?php
147 147
 
148 148
             if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
149 149
 				echo ' ' . $opt . '</label>';
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
     }
165 165
 } else if ( $field['type'] == 'captcha' && ! FrmAppHelper::is_admin() ) {
166 166
     $frm_settings = FrmAppHelper::get_settings();
167
-    if ( ! empty($frm_settings->pubkey) ) {
168
-        FrmFieldsHelper::display_recaptcha($field);
167
+    if ( ! empty( $frm_settings->pubkey ) ) {
168
+        FrmFieldsHelper::display_recaptcha( $field );
169 169
     }
170 170
 } else {
171 171
 	do_action( 'frm_form_fields', $field, $field_name, compact( 'errors', 'html_id' ) );
Please login to merge, or discard this patch.