Completed
Branch 3.0 (1aee71)
by Stephanie
03:09
created
classes/controllers/FrmXMLController.php 2 patches
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -2,109 +2,109 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmXMLController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		add_submenu_page( 'formidable', 'Formidable | ' . __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route' );
7
-    }
7
+	}
8 8
 
9
-    public static function add_default_templates() {
9
+	public static function add_default_templates() {
10 10
 		if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
11
-    		// XML import is not enabled on your server
12
-    		return;
13
-    	}
11
+			// XML import is not enabled on your server
12
+			return;
13
+		}
14 14
 
15
-        $set_err = libxml_use_internal_errors(true);
16
-        $loader = libxml_disable_entity_loader( true );
15
+		$set_err = libxml_use_internal_errors(true);
16
+		$loader = libxml_disable_entity_loader( true );
17 17
 
18 18
 		$files = apply_filters( 'frm_default_templates_files', array( FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml' ) );
19 19
 
20
-        foreach ( (array) $files as $file ) {
21
-            FrmXMLHelper::import_xml($file);
22
-            unset($file);
23
-        }
24
-        /*
20
+		foreach ( (array) $files as $file ) {
21
+			FrmXMLHelper::import_xml($file);
22
+			unset($file);
23
+		}
24
+		/*
25 25
         if(is_wp_error($result))
26 26
             $errors[] = $result->get_error_message();
27 27
         else if($result)
28 28
             $message = $result;
29 29
         */
30 30
 
31
-        unset( $files );
31
+		unset( $files );
32 32
 
33
-        libxml_use_internal_errors( $set_err );
34
-    	libxml_disable_entity_loader( $loader );
35
-    }
33
+		libxml_use_internal_errors( $set_err );
34
+		libxml_disable_entity_loader( $loader );
35
+	}
36 36
 
37
-    public static function route() {
38
-        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
37
+	public static function route() {
38
+		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
39 39
 		$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
40 40
 		if ( $action == 'import_xml' ) {
41
-            return self::import_xml();
41
+			return self::import_xml();
42 42
 		} else if ( $action == 'export_xml' ) {
43
-            return self::export_xml();
44
-        } else {
45
-            if ( apply_filters( 'frm_xml_route', true, $action ) ) {
46
-                return self::form();
47
-            }
48
-        }
49
-    }
50
-
51
-    public static function form( $errors = array(), $message = '' ) {
43
+			return self::export_xml();
44
+		} else {
45
+			if ( apply_filters( 'frm_xml_route', true, $action ) ) {
46
+				return self::form();
47
+			}
48
+		}
49
+	}
50
+
51
+	public static function form( $errors = array(), $message = '' ) {
52 52
 		$where = array(
53 53
 			'status' => array( null, '', 'published' ),
54 54
 		);
55 55
 		$forms = FrmForm::getAll( $where, 'name' );
56 56
 
57
-        $export_types = apply_filters( 'frm_xml_export_types',
58
-            array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) )
59
-        );
57
+		$export_types = apply_filters( 'frm_xml_export_types',
58
+			array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) )
59
+		);
60 60
 
61
-        $export_format = apply_filters( 'frm_export_formats', array(
62
-            'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
61
+		$export_format = apply_filters( 'frm_export_formats', array(
62
+			'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
63 63
 			'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ),
64
-        ) );
64
+		) );
65 65
 
66 66
 		include( FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php' );
67
-    }
67
+	}
68 68
 
69
-    public static function import_xml() {
70
-        $errors = array();
71
-        $message = '';
69
+	public static function import_xml() {
70
+		$errors = array();
71
+		$message = '';
72 72
 
73
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce');
74
-        if ( $permission_error !== false ) {
75
-            $errors[] = $permission_error;
76
-            self::form($errors);
77
-            return;
78
-        }
73
+		$permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce');
74
+		if ( $permission_error !== false ) {
75
+			$errors[] = $permission_error;
76
+			self::form($errors);
77
+			return;
78
+		}
79 79
 
80
-        if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
81
-            $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' );
82
-            self::form($errors);
83
-            return;
84
-        }
80
+		if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
81
+			$errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' );
82
+			self::form($errors);
83
+			return;
84
+		}
85 85
 
86
-        $file = $_FILES['frm_import_file']['tmp_name'];
86
+		$file = $_FILES['frm_import_file']['tmp_name'];
87 87
 
88
-        if ( ! is_uploaded_file( $file ) ) {
89
-            unset($file);
90
-            $errors[] = __( 'The file does not exist, please try again.', 'formidable' );
91
-            self::form($errors);
92
-            return;
93
-        }
88
+		if ( ! is_uploaded_file( $file ) ) {
89
+			unset($file);
90
+			$errors[] = __( 'The file does not exist, please try again.', 'formidable' );
91
+			self::form($errors);
92
+			return;
93
+		}
94 94
 
95
-        //add_filter('upload_mimes', 'FrmXMLController::allow_mime');
95
+		//add_filter('upload_mimes', 'FrmXMLController::allow_mime');
96 96
 
97
-        $export_format = apply_filters('frm_export_formats', array(
97
+		$export_format = apply_filters('frm_export_formats', array(
98 98
 			'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
99 99
 		) );
100 100
 
101
-        $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION));
102
-        if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) {
103
-            // allow other file types to be imported
101
+		$file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION));
102
+		if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) {
103
+			// allow other file types to be imported
104 104
 			do_action( 'frm_before_import_' . $file_type );
105
-            return;
106
-        }
107
-        unset($file_type);
105
+			return;
106
+		}
107
+		unset($file_type);
108 108
 
109 109
 		if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
110 110
 			$errors[] = __( 'XML import is not enabled on your server.', 'formidable' );
@@ -123,145 +123,145 @@  discard block
 block discarded – undo
123 123
 		libxml_use_internal_errors( $set_err );
124 124
 		libxml_disable_entity_loader( $loader );
125 125
 
126
-        self::form($errors, $message);
127
-    }
126
+		self::form($errors, $message);
127
+	}
128 128
 
129
-    public static function export_xml() {
130
-        $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' );
131
-        if ( ! empty($error) ) {
132
-            wp_die( $error );
133
-        }
129
+	public static function export_xml() {
130
+		$error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' );
131
+		if ( ! empty($error) ) {
132
+			wp_die( $error );
133
+		}
134 134
 
135 135
 		$ids = FrmAppHelper::get_post_param( 'frm_export_forms', array() );
136 136
 		$type = FrmAppHelper::get_post_param( 'type', array() );
137 137
 		$format = FrmAppHelper::get_post_param( 'format', 'xml', 'sanitize_title' );
138 138
 
139
-        if ( ! headers_sent() && ! $type ) {
140
-            wp_redirect( esc_url_raw( admin_url( 'admin.php?page=formidable-import' ) ) );
141
-            die();
142
-        }
139
+		if ( ! headers_sent() && ! $type ) {
140
+			wp_redirect( esc_url_raw( admin_url( 'admin.php?page=formidable-import' ) ) );
141
+			die();
142
+		}
143 143
 
144
-        if ( $format == 'xml' ) {
145
-            self::generate_xml($type, compact('ids'));
144
+		if ( $format == 'xml' ) {
145
+			self::generate_xml($type, compact('ids'));
146 146
 		} if ( $format == 'csv' ) {
147 147
 			self::generate_csv( compact('ids') );
148
-        } else {
148
+		} else {
149 149
 			do_action( 'frm_export_format_' . $format, compact('ids') );
150
-        }
150
+		}
151 151
 
152
-        wp_die();
153
-    }
152
+		wp_die();
153
+	}
154 154
 
155 155
 	public static function generate_xml( $type, $args = array() ) {
156
-    	global $wpdb;
156
+		global $wpdb;
157 157
 
158
-	    self::prepare_types_array( $type );
158
+		self::prepare_types_array( $type );
159 159
 
160
-	    $tables = array(
160
+		$tables = array(
161 161
 			'items'     => $wpdb->prefix . 'frm_items',
162 162
 			'forms'     => $wpdb->prefix . 'frm_forms',
163
-	        'posts'     => $wpdb->posts,
164
-	        'styles'    => $wpdb->posts,
165
-	        'actions'   => $wpdb->posts,
166
-	    );
163
+			'posts'     => $wpdb->posts,
164
+			'styles'    => $wpdb->posts,
165
+			'actions'   => $wpdb->posts,
166
+		);
167 167
 
168 168
 		$defaults = array( 'ids' => false );
169
-	    $args = wp_parse_args( $args, $defaults );
169
+		$args = wp_parse_args( $args, $defaults );
170 170
 
171
-        $sitename = sanitize_key( get_bloginfo( 'name' ) );
171
+		$sitename = sanitize_key( get_bloginfo( 'name' ) );
172 172
 
173
-    	if ( ! empty( $sitename ) ) {
173
+		if ( ! empty( $sitename ) ) {
174 174
 			$sitename .= '.';
175 175
 		}
176
-    	$filename = $sitename . 'formidable.' . date( 'Y-m-d' ) . '.xml';
176
+		$filename = $sitename . 'formidable.' . date( 'Y-m-d' ) . '.xml';
177 177
 
178
-    	header( 'Content-Description: File Transfer' );
179
-    	header( 'Content-Disposition: attachment; filename=' . $filename );
180
-    	header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
178
+		header( 'Content-Description: File Transfer' );
179
+		header( 'Content-Disposition: attachment; filename=' . $filename );
180
+		header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
181 181
 
182
-        //make sure ids are numeric
183
-    	if ( is_array( $args['ids'] ) && ! empty( $args['ids'] ) ) {
184
-	        $args['ids'] = array_filter( $args['ids'], 'is_numeric' );
185
-	    }
182
+		//make sure ids are numeric
183
+		if ( is_array( $args['ids'] ) && ! empty( $args['ids'] ) ) {
184
+			$args['ids'] = array_filter( $args['ids'], 'is_numeric' );
185
+		}
186 186
 
187
-	    $records = array();
187
+		$records = array();
188 188
 
189 189
 		foreach ( $type as $tb_type ) {
190
-            $where = array();
190
+			$where = array();
191 191
 			$join = '';
192
-            $table = $tables[ $tb_type ];
192
+			$table = $tables[ $tb_type ];
193 193
 
194 194
 			$select = $table . '.id';
195
-            $query_vars = array();
195
+			$query_vars = array();
196 196
 
197
-            switch ( $tb_type ) {
198
-                case 'forms':
199
-                    //add forms
200
-                    if ( $args['ids'] ) {
197
+			switch ( $tb_type ) {
198
+				case 'forms':
199
+					//add forms
200
+					if ( $args['ids'] ) {
201 201
 						$where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids'] );
202
-                	} else {
202
+					} else {
203 203
 						$where[ $table . '.status !' ] = 'draft';
204
-                	}
205
-                break;
206
-                case 'actions':
204
+					}
205
+				break;
206
+				case 'actions':
207 207
 					$select = $table . '.ID';
208 208
 					$where['post_type'] = FrmFormActionsController::$action_post_type;
209
-                    if ( ! empty($args['ids']) ) {
209
+					if ( ! empty($args['ids']) ) {
210 210
 						$where['menu_order'] = $args['ids'];
211
-                    }
212
-                break;
213
-                case 'items':
214
-                    //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
215
-                    if ( $args['ids'] ) {
211
+					}
212
+				break;
213
+				case 'items':
214
+					//$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
215
+					if ( $args['ids'] ) {
216 216
 						$where[ $table . '.form_id' ] = $args['ids'];
217
-                    }
218
-                break;
219
-                case 'styles':
220
-                    // Loop through all exported forms and get their selected style IDs
217
+					}
218
+				break;
219
+				case 'styles':
220
+					// Loop through all exported forms and get their selected style IDs
221 221
 					$frm_style = new FrmStyle();
222 222
 					$default_style = $frm_style->get_default_style();
223
-                    $form_ids = $args['ids'];
224
-                    $style_ids = array();
225
-                    foreach ( $form_ids as $form_id ) {
226
-                        $form_data = FrmForm::getOne( $form_id );
227
-                        // For forms that have not been updated while running 2.0, check if custom_style is set
228
-                        if ( isset( $form_data->options['custom_style'] ) ) {
223
+					$form_ids = $args['ids'];
224
+					$style_ids = array();
225
+					foreach ( $form_ids as $form_id ) {
226
+						$form_data = FrmForm::getOne( $form_id );
227
+						// For forms that have not been updated while running 2.0, check if custom_style is set
228
+						if ( isset( $form_data->options['custom_style'] ) ) {
229 229
 							if ( $form_data->options['custom_style'] == 1 ) {
230 230
 								$style_ids[] = $default_style->ID;
231 231
 							} else {
232 232
 								$style_ids[] = $form_data->options['custom_style'];
233 233
 							}
234
-                        }
235
-                        unset( $form_id, $form_data );
236
-                    }
234
+						}
235
+						unset( $form_id, $form_data );
236
+					}
237 237
 					$select = $table . '.ID';
238
-                    $where['post_type'] = 'frm_styles';
239
-
240
-                    // Only export selected styles
241
-                    if ( ! empty( $style_ids ) ) {
242
-                        $where['ID'] = $style_ids;
243
-                    }
244
-                break;
245
-                default:
238
+					$where['post_type'] = 'frm_styles';
239
+
240
+					// Only export selected styles
241
+					if ( ! empty( $style_ids ) ) {
242
+						$where['ID'] = $style_ids;
243
+					}
244
+				break;
245
+				default:
246 246
 					$select = $table . '.ID';
247
-                    $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
248
-                    $where['pm.meta_key'] = 'frm_form_id';
249
-
250
-                    if ( empty($args['ids']) ) {
251
-                        $where['pm.meta_value >'] = 1;
252
-                    } else {
253
-                        $where['pm.meta_value'] = $args['ids'];
254
-                    }
255
-                break;
256
-            }
247
+					$join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
248
+					$where['pm.meta_key'] = 'frm_form_id';
249
+
250
+					if ( empty($args['ids']) ) {
251
+						$where['pm.meta_value >'] = 1;
252
+					} else {
253
+						$where['pm.meta_value'] = $args['ids'];
254
+					}
255
+				break;
256
+			}
257 257
 
258 258
 			$records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select );
259
-            unset($tb_type);
260
-        }
259
+			unset($tb_type);
260
+		}
261 261
 
262 262
 		echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n";
263 263
 		include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' );
264
-    }
264
+	}
265 265
 
266 266
 	private static function prepare_types_array( &$type ) {
267 267
 		$type = (array) $type;
@@ -342,14 +342,14 @@  discard block
 block discarded – undo
342 342
 	}
343 343
 
344 344
 	/**
345
-	* Get the fields that should be included in the CSV export
346
-	*
347
-	* @since 2.0.19
348
-	*
349
-	* @param int $form_id
350
-	* @param object $form
351
-	* @return array $csv_fields
352
-	*/
345
+	 * Get the fields that should be included in the CSV export
346
+	 *
347
+	 * @since 2.0.19
348
+	 *
349
+	 * @param int $form_id
350
+	 * @param object $form
351
+	 * @return array $csv_fields
352
+	 */
353 353
 	private static function get_fields_for_csv_export( $form_id, $form ) {
354 354
 		$csv_fields = FrmField::get_all_for_form( $form_id, '', 'include', 'include' );
355 355
 		$no_export_fields = FrmField::no_save_fields();
@@ -363,16 +363,16 @@  discard block
 block discarded – undo
363 363
 	}
364 364
 
365 365
 	public static function allow_mime( $mimes ) {
366
-        if ( ! isset( $mimes['csv'] ) ) {
367
-            // allow csv files
368
-            $mimes['csv'] = 'text/csv';
369
-        }
370
-
371
-        if ( ! isset( $mimes['xml'] ) ) {
372
-            // allow xml
373
-            $mimes['xml'] = 'text/xml';
374
-        }
375
-
376
-        return $mimes;
377
-    }
366
+		if ( ! isset( $mimes['csv'] ) ) {
367
+			// allow csv files
368
+			$mimes['csv'] = 'text/csv';
369
+		}
370
+
371
+		if ( ! isset( $mimes['xml'] ) ) {
372
+			// allow xml
373
+			$mimes['xml'] = 'text/xml';
374
+		}
375
+
376
+		return $mimes;
377
+	}
378 378
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
     		return;
13 13
     	}
14 14
 
15
-        $set_err = libxml_use_internal_errors(true);
15
+        $set_err = libxml_use_internal_errors( true );
16 16
         $loader = libxml_disable_entity_loader( true );
17 17
 
18 18
 		$files = apply_filters( 'frm_default_templates_files', array( FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml' ) );
19 19
 
20 20
         foreach ( (array) $files as $file ) {
21
-            FrmXMLHelper::import_xml($file);
22
-            unset($file);
21
+            FrmXMLHelper::import_xml( $file );
22
+            unset( $file );
23 23
         }
24 24
         /*
25 25
         if(is_wp_error($result))
@@ -70,41 +70,41 @@  discard block
 block discarded – undo
70 70
         $errors = array();
71 71
         $message = '';
72 72
 
73
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce');
73
+        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'import-xml', 'import-xml-nonce' );
74 74
         if ( $permission_error !== false ) {
75 75
             $errors[] = $permission_error;
76
-            self::form($errors);
76
+            self::form( $errors );
77 77
             return;
78 78
         }
79 79
 
80
-        if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
80
+        if ( ! isset( $_FILES ) || ! isset( $_FILES['frm_import_file'] ) || empty( $_FILES['frm_import_file']['name'] ) || (int) $_FILES['frm_import_file']['size'] < 1 ) {
81 81
             $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' );
82
-            self::form($errors);
82
+            self::form( $errors );
83 83
             return;
84 84
         }
85 85
 
86 86
         $file = $_FILES['frm_import_file']['tmp_name'];
87 87
 
88 88
         if ( ! is_uploaded_file( $file ) ) {
89
-            unset($file);
89
+            unset( $file );
90 90
             $errors[] = __( 'The file does not exist, please try again.', 'formidable' );
91
-            self::form($errors);
91
+            self::form( $errors );
92 92
             return;
93 93
         }
94 94
 
95 95
         //add_filter('upload_mimes', 'FrmXMLController::allow_mime');
96 96
 
97
-        $export_format = apply_filters('frm_export_formats', array(
97
+        $export_format = apply_filters( 'frm_export_formats', array(
98 98
 			'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
99 99
 		) );
100 100
 
101
-        $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION));
102
-        if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) {
101
+        $file_type = strtolower( pathinfo( $_FILES['frm_import_file']['name'], PATHINFO_EXTENSION ) );
102
+        if ( $file_type != 'xml' && isset( $export_format[$file_type] ) ) {
103 103
             // allow other file types to be imported
104 104
 			do_action( 'frm_before_import_' . $file_type );
105 105
             return;
106 106
         }
107
-        unset($file_type);
107
+        unset( $file_type );
108 108
 
109 109
 		if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
110 110
 			$errors[] = __( 'XML import is not enabled on your server.', 'formidable' );
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
 		libxml_use_internal_errors( $set_err );
124 124
 		libxml_disable_entity_loader( $loader );
125 125
 
126
-        self::form($errors, $message);
126
+        self::form( $errors, $message );
127 127
     }
128 128
 
129 129
     public static function export_xml() {
130 130
         $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' );
131
-        if ( ! empty($error) ) {
131
+        if ( ! empty( $error ) ) {
132 132
             wp_die( $error );
133 133
         }
134 134
 
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
         }
143 143
 
144 144
         if ( $format == 'xml' ) {
145
-            self::generate_xml($type, compact('ids'));
145
+            self::generate_xml( $type, compact( 'ids' ) );
146 146
 		} if ( $format == 'csv' ) {
147
-			self::generate_csv( compact('ids') );
147
+			self::generate_csv( compact( 'ids' ) );
148 148
         } else {
149
-			do_action( 'frm_export_format_' . $format, compact('ids') );
149
+			do_action( 'frm_export_format_' . $format, compact( 'ids' ) );
150 150
         }
151 151
 
152 152
         wp_die();
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		foreach ( $type as $tb_type ) {
190 190
             $where = array();
191 191
 			$join = '';
192
-            $table = $tables[ $tb_type ];
192
+            $table = $tables[$tb_type];
193 193
 
194 194
 			$select = $table . '.id';
195 195
             $query_vars = array();
@@ -200,20 +200,20 @@  discard block
 block discarded – undo
200 200
                     if ( $args['ids'] ) {
201 201
 						$where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids'] );
202 202
                 	} else {
203
-						$where[ $table . '.status !' ] = 'draft';
203
+						$where[$table . '.status !'] = 'draft';
204 204
                 	}
205 205
                 break;
206 206
                 case 'actions':
207 207
 					$select = $table . '.ID';
208 208
 					$where['post_type'] = FrmFormActionsController::$action_post_type;
209
-                    if ( ! empty($args['ids']) ) {
209
+                    if ( ! empty( $args['ids'] ) ) {
210 210
 						$where['menu_order'] = $args['ids'];
211 211
                     }
212 212
                 break;
213 213
                 case 'items':
214 214
                     //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
215 215
                     if ( $args['ids'] ) {
216
-						$where[ $table . '.form_id' ] = $args['ids'];
216
+						$where[$table . '.form_id'] = $args['ids'];
217 217
                     }
218 218
                 break;
219 219
                 case 'styles':
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
                     $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
248 248
                     $where['pm.meta_key'] = 'frm_form_id';
249 249
 
250
-                    if ( empty($args['ids']) ) {
250
+                    if ( empty( $args['ids'] ) ) {
251 251
                         $where['pm.meta_value >'] = 1;
252 252
                     } else {
253 253
                         $where['pm.meta_value'] = $args['ids'];
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
                 break;
256 256
             }
257 257
 
258
-			$records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select );
259
-            unset($tb_type);
258
+			$records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select );
259
+            unset( $tb_type );
260 260
         }
261 261
 
262
-		echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n";
262
+		echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo( 'charset' ) ) . "\" ?>\n";
263 263
 		include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' );
264 264
     }
265 265
 
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
 			$fid = FrmAppHelper::get_param( 'fid', '', 'get', 'sanitize_text_field' );
298 298
 		}
299 299
 
300
-		set_time_limit(0); //Remove time limit to execute this function
301
-		$mem_limit = str_replace('M', '', ini_get('memory_limit'));
300
+		set_time_limit( 0 ); //Remove time limit to execute this function
301
+		$mem_limit = str_replace( 'M', '', ini_get( 'memory_limit' ) );
302 302
 		if ( (int) $mem_limit < 256 ) {
303
-			ini_set('memory_limit', '256M');
303
+			ini_set( 'memory_limit', '256M' );
304 304
 		}
305 305
 
306 306
 		global $wpdb;
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 		$no_export_fields = FrmField::no_save_fields();
356 356
 		foreach ( $csv_fields as $k => $f ) {
357 357
 			if ( in_array( $f->type, $no_export_fields ) ) {
358
-				unset( $csv_fields[ $k ] );
358
+				unset( $csv_fields[$k] );
359 359
 			}
360 360
 		}
361 361
 
Please login to merge, or discard this patch.
classes/helpers/FrmFieldsHelper.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -117,6 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 	/**
119 119
 	 * @since 3.0
120
+	 * @return string
120 121
 	 */
121 122
 	public static function get_default_field( $type ) {
122 123
 		$field_type = FrmFieldFactory::get_field_type( $type );
@@ -138,6 +139,7 @@  discard block
 block discarded – undo
138 139
 
139 140
     /**
140 141
      * @since 2.0
142
+     * @param string $error
141 143
      */
142 144
 	public static function get_error_msg( $field, $error ) {
143 145
 		$frm_settings = FrmAppHelper::get_settings();
@@ -696,6 +698,9 @@  discard block
 block discarded – undo
696 698
         return $field_types;
697 699
     }
698 700
 
701
+    /**
702
+     * @param string[] $inputs
703
+     */
699 704
     private static function field_types_for_input( $inputs, $fields, &$field_types ) {
700 705
         foreach ( $inputs as $input ) {
701 706
             $field_types[ $input ] = $fields[ $input ];
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 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,8 +7,8 @@  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 14
 		$values = self::get_default_field( $type );
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			if ( in_array( $type, array( 'data', 'lookup' ) ) ) {
26 26
 				$values['field_options']['data_type'] = $setting;
27 27
 			} else {
28
-				$values['field_options'][ $setting ] = 1;
28
+				$values['field_options'][$setting] = 1;
29 29
 			}
30 30
 		}
31 31
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		if ( ! $doing_ajax ) {
49 49
 			$field_values = array( 'name', 'description', 'field_key', 'type', 'default_value', 'field_order', 'required' );
50 50
 			foreach ( $field_values as $var ) {
51
-				$values[ $var ] = FrmAppHelper::get_param( $var, $values[ $var ], 'get', 'htmlspecialchars' );
51
+				$values[$var] = FrmAppHelper::get_param( $var, $values[$var], 'get', 'htmlspecialchars' );
52 52
 				unset( $var );
53 53
 			}
54 54
 
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 		$defaults = self::get_default_field_options_from_field( $field );
79 79
 
80 80
 		foreach ( $defaults as $opt => $default ) {
81
-			$current_opt = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default;
82
-			$values[ $opt ] = ( $_POST && isset( $_POST['field_options'][ $opt . '_' . $field->id ] ) ) ? stripslashes_deep( maybe_unserialize( $_POST['field_options'][ $opt . '_' . $field->id ] ) ) : $current_opt;
81
+			$current_opt = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default;
82
+			$values[$opt] = ( $_POST && isset( $_POST['field_options'][$opt . '_' . $field->id] ) ) ? stripslashes_deep( maybe_unserialize( $_POST['field_options'][$opt . '_' . $field->id] ) ) : $current_opt;
83 83
 			unset( $opt, $default );
84 84
 		}
85 85
 	}
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
130 130
         $values['form_id'] = $form_id;
131
-        $values['options'] = maybe_serialize($field->options);
132
-        $values['default_value'] = maybe_serialize($field->default_value);
131
+        $values['options'] = maybe_serialize( $field->options );
132
+        $values['default_value'] = maybe_serialize( $field->default_value );
133 133
 
134 134
         foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
135
-            $values[ $col ] = $field->{$col};
135
+            $values[$col] = $field->{$col};
136 136
         }
137 137
     }
138 138
 
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 
147 147
 		$conf_msg = __( 'The entered values do not match', 'formidable' );
148 148
 		$defaults = array(
149
-			'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ) ),
150
-			'invalid'   => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ) ),
149
+			'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ) ),
150
+			'invalid'   => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ) ),
151 151
 			'blank'     => array( 'full' => $frm_settings->blank_msg, 'part' => $frm_settings->blank_msg ),
152 152
 			'conf_msg'  => array( 'full' => $conf_msg, 'part' => $conf_msg ),
153 153
 		);
154 154
 
155 155
 		$msg = FrmField::get_option( $field, $error );
156
-		$msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg;
156
+		$msg = empty( $msg ) ? $defaults[$error]['part'] : $msg;
157 157
 		$msg = do_shortcode( $msg );
158 158
 		return $msg;
159 159
 	}
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 			$default_html = apply_filters( 'frm_other_custom_html', '', $type );
173 173
 		}
174 174
 
175
-		return apply_filters('frm_custom_html', $default_html, $type);
175
+		return apply_filters( 'frm_custom_html', $default_html, $type );
176 176
 	}
177 177
 
178 178
 	public static function show_fields( $fields, $errors, $form, $form_action ) {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		}
265 265
 
266 266
         $field_name = $field['name'];
267
-        $html_id = self::get_html_id($field);
267
+        $html_id = self::get_html_id( $field );
268 268
 
269 269
 		foreach ( $field['options'] as $opt_key => $opt ) {
270 270
 		    $field_val = self::get_value_from_array( $opt, $opt_key, $field );
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 			// Get string for Other text field, if needed
274 274
 			$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
275 275
 
276
-			$checked = ( $other_val || isset( $field['value'] ) && ( ( ! is_array( $field['value'] ) && $field['value'] == $field_val ) || ( is_array($field['value'] ) && in_array( $field_val, $field['value'] ) ) ) ) ? ' checked="checked"':'';
276
+			$checked = ( $other_val || isset( $field['value'] ) && ( ( ! is_array( $field['value'] ) && $field['value'] == $field_val ) || ( is_array( $field['value'] ) && in_array( $field_val, $field['value'] ) ) ) ) ? ' checked="checked"' : '';
277 277
 
278 278
 		    // If this is an "Other" option, get the HTML for it
279 279
 			if ( self::is_other_opt( $opt_key ) ) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	}
300 300
 
301 301
 	public static function get_term_link( $tax_id ) {
302
-        $tax = get_taxonomy($tax_id);
302
+        $tax = get_taxonomy( $tax_id );
303 303
         if ( ! $tax ) {
304 304
             return;
305 305
         }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
309 309
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
310 310
         );
311
-        unset($tax);
311
+        unset( $tax );
312 312
 
313 313
         return $link;
314 314
     }
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 		$hide_opt = self::get_value_for_comparision( $hide_opt );
318 318
 		$observed_value = self::get_value_for_comparision( $observed_value );
319 319
 
320
-        if ( is_array($observed_value) ) {
321
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
320
+        if ( is_array( $observed_value ) ) {
321
+            return self::array_value_condition( $observed_value, $cond, $hide_opt );
322 322
         }
323 323
 
324 324
         $m = false;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         } else if ( $cond == '<' ) {
332 332
             $m = $observed_value < $hide_opt;
333 333
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
334
-            $m = stripos($observed_value, $hide_opt);
334
+            $m = stripos( $observed_value, $hide_opt );
335 335
             if ( $cond == 'not LIKE' ) {
336 336
                 $m = ( $m === false ) ? true : false;
337 337
             } else {
@@ -357,23 +357,23 @@  discard block
 block discarded – undo
357 357
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
358 358
         $m = false;
359 359
         if ( $cond == '==' ) {
360
-            if ( is_array($hide_opt) ) {
361
-                $m = array_intersect($hide_opt, $observed_value);
362
-                $m = empty($m) ? false : true;
360
+            if ( is_array( $hide_opt ) ) {
361
+                $m = array_intersect( $hide_opt, $observed_value );
362
+                $m = empty( $m ) ? false : true;
363 363
             } else {
364
-                $m = in_array($hide_opt, $observed_value);
364
+                $m = in_array( $hide_opt, $observed_value );
365 365
             }
366 366
         } else if ( $cond == '!=' ) {
367
-            $m = ! in_array($hide_opt, $observed_value);
367
+            $m = ! in_array( $hide_opt, $observed_value );
368 368
         } else if ( $cond == '>' ) {
369
-            $min = min($observed_value);
369
+            $min = min( $observed_value );
370 370
             $m = $min > $hide_opt;
371 371
         } else if ( $cond == '<' ) {
372
-            $max = max($observed_value);
372
+            $max = max( $observed_value );
373 373
             $m = $max < $hide_opt;
374 374
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
375 375
             foreach ( $observed_value as $ob ) {
376
-                $m = strpos($ob, $hide_opt);
376
+                $m = strpos( $ob, $hide_opt );
377 377
                 if ( $m !== false ) {
378 378
                     $m = true;
379 379
                     break;
@@ -394,27 +394,27 @@  discard block
 block discarded – undo
394 394
      * @return string
395 395
      */
396 396
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
397
-        if ( strpos($value, '[sitename]') !== false ) {
397
+        if ( strpos( $value, '[sitename]' ) !== false ) {
398 398
             $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
399
-            $value = str_replace('[sitename]', $new_value, $value);
399
+            $value = str_replace( '[sitename]', $new_value, $value );
400 400
         }
401 401
 
402
-        $value = apply_filters('frm_content', $value, $form, $entry);
403
-        $value = do_shortcode($value);
402
+        $value = apply_filters( 'frm_content', $value, $form, $entry );
403
+        $value = do_shortcode( $value );
404 404
 
405 405
         return $value;
406 406
     }
407 407
 
408 408
 	public static function get_shortcodes( $content, $form_id ) {
409 409
         if ( FrmAppHelper::pro_is_installed() ) {
410
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
410
+            return FrmProDisplaysHelper::get_shortcodes( $content, $form_id );
411 411
         }
412 412
 
413 413
         $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
414 414
 
415
-        $tagregexp = self::allowed_shortcodes($fields);
415
+        $tagregexp = self::allowed_shortcodes( $fields );
416 416
 
417
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
417
+        preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER );
418 418
 
419 419
         return $matches;
420 420
     }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
             $tagregexp[] = $field->field_key;
433 433
         }
434 434
 
435
-        $tagregexp = implode('|', $tagregexp);
435
+        $tagregexp = implode( '|', $tagregexp );
436 436
         return $tagregexp;
437 437
     }
438 438
 
@@ -448,28 +448,28 @@  discard block
 block discarded – undo
448 448
 				continue;
449 449
 			}
450 450
 
451
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
451
+            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] );
452 452
 
453
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
454
-				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
455
-                $tags = explode(' ', $tag);
456
-                if ( is_array($tags) ) {
453
+            if ( ! empty( $shortcodes[3][$short_key] ) ) {
454
+				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][$short_key] );
455
+                $tags = explode( ' ', $tag );
456
+                if ( is_array( $tags ) ) {
457 457
                     $tag = $tags[0];
458 458
                 }
459 459
             } else {
460
-                $tag = $shortcodes[2][ $short_key ];
460
+                $tag = $shortcodes[2][$short_key];
461 461
             }
462 462
 
463 463
             switch ( $tag ) {
464 464
                 case 'id':
465 465
                 case 'key':
466 466
                 case 'ip':
467
-                    $replace_with = $shortcode_values[ $tag ];
467
+                    $replace_with = $shortcode_values[$tag];
468 468
                 break;
469 469
 
470 470
                 case 'user_agent':
471 471
                 case 'user-agent':
472
-                    $entry->description = maybe_unserialize($entry->description);
472
+                    $entry->description = maybe_unserialize( $entry->description );
473 473
 					$replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] );
474 474
                 break;
475 475
 
@@ -477,25 +477,25 @@  discard block
 block discarded – undo
477 477
                 case 'created-at':
478 478
                 case 'updated_at':
479 479
                 case 'updated-at':
480
-                    if ( isset($atts['format']) ) {
480
+                    if ( isset( $atts['format'] ) ) {
481 481
                         $time_format = ' ';
482 482
                     } else {
483
-                        $atts['format'] = get_option('date_format');
483
+                        $atts['format'] = get_option( 'date_format' );
484 484
                         $time_format = '';
485 485
                     }
486 486
 
487
-                    $this_tag = str_replace('-', '_', $tag);
488
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
489
-                    unset($this_tag);
487
+                    $this_tag = str_replace( '-', '_', $tag );
488
+                    $replace_with = FrmAppHelper::get_formatted_time( $entry->{$this_tag}, $atts['format'], $time_format );
489
+                    unset( $this_tag );
490 490
                 break;
491 491
 
492 492
                 case 'created_by':
493 493
                 case 'created-by':
494 494
                 case 'updated_by':
495 495
                 case 'updated-by':
496
-                    $this_tag = str_replace('-', '_', $tag);
496
+                    $this_tag = str_replace( '-', '_', $tag );
497 497
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
498
-                    unset($this_tag);
498
+                    unset( $this_tag );
499 499
                 break;
500 500
 
501 501
                 case 'admin_email':
@@ -512,16 +512,16 @@  discard block
 block discarded – undo
512 512
                         break;
513 513
                     }
514 514
 
515
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
515
+                    $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
516 516
 
517 517
                     $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
518 518
 
519 519
                     $atts['entry_id'] = $entry->id;
520 520
                     $atts['entry_key'] = $entry->item_key;
521 521
 
522
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
522
+                    if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) {
523 523
                         $replace_with = $field->name;
524
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
524
+                    } else if ( isset( $atts['show'] ) && $atts['show'] == 'description' ) {
525 525
                         $replace_with = $field->description;
526 526
 					} else {
527 527
 						$string_value = $replace_with;
@@ -536,15 +536,15 @@  discard block
 block discarded – undo
536 536
 						}
537 537
 					}
538 538
 
539
-                    unset($field);
539
+                    unset( $field );
540 540
                 break;
541 541
             }
542 542
 
543
-            if ( isset($replace_with) ) {
544
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
543
+            if ( isset( $replace_with ) ) {
544
+                $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content );
545 545
             }
546 546
 
547
-            unset($atts, $conditional, $replace_with);
547
+            unset( $atts, $conditional, $replace_with );
548 548
 		}
549 549
 
550 550
 		return $content;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
         $new_value = '';
561 561
         switch ( $tag ) {
562 562
             case 'admin_email':
563
-                $new_value = get_option('admin_email');
563
+                $new_value = get_option( 'admin_email' );
564 564
                 break;
565 565
             case 'siteurl':
566 566
                 $new_value = FrmAppHelper::site_url();
@@ -586,28 +586,28 @@  discard block
 block discarded – undo
586 586
      * @return string|array
587 587
      */
588 588
     public static function process_get_shortcode( $atts, $return_array = false ) {
589
-        if ( ! isset($atts['param']) ) {
589
+        if ( ! isset( $atts['param'] ) ) {
590 590
             return '';
591 591
         }
592 592
 
593
-        if ( strpos($atts['param'], '&#91;') ) {
594
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
595
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
593
+        if ( strpos( $atts['param'], '&#91;' ) ) {
594
+            $atts['param'] = str_replace( '&#91;', '[', $atts['param'] );
595
+            $atts['param'] = str_replace( '&#93;', ']', $atts['param'] );
596 596
         }
597 597
 
598
-        $new_value = FrmAppHelper::get_param($atts['param'], '');
598
+        $new_value = FrmAppHelper::get_param( $atts['param'], '' );
599 599
         $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
600 600
 
601 601
         if ( $new_value == '' ) {
602
-            if ( ! isset($atts['prev_val']) ) {
602
+            if ( ! isset( $atts['prev_val'] ) ) {
603 603
                 $atts['prev_val'] = '';
604 604
             }
605 605
 
606
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
606
+            $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val'];
607 607
         }
608 608
 
609
-        if ( is_array($new_value) && ! $return_array ) {
610
-            $new_value = implode(', ', $new_value);
609
+        if ( is_array( $new_value ) && ! $return_array ) {
610
+            $new_value = implode( ', ', $new_value );
611 611
         }
612 612
 
613 613
         return $new_value;
@@ -644,9 +644,9 @@  discard block
 block discarded – undo
644 644
 			'blank' => false, 'link' => false, 'size' => 96
645 645
 		);
646 646
 
647
-		$args = wp_parse_args($args, $defaults);
647
+		$args = wp_parse_args( $args, $defaults );
648 648
 
649
-		$user = get_userdata($user_id);
649
+		$user = get_userdata( $user_id );
650 650
 		$info = '';
651 651
 
652 652
 		if ( $user ) {
@@ -655,16 +655,16 @@  discard block
 block discarded – undo
655 655
 			} elseif ( $user_info == 'author_link' ) {
656 656
 				$info = get_author_posts_url( $user_id );
657 657
 			} else {
658
-				$info = isset($user->$user_info) ? $user->$user_info : '';
658
+				$info = isset( $user->$user_info ) ? $user->$user_info : '';
659 659
 			}
660 660
 
661
-			if ( empty($info) && ! $args['blank'] ) {
661
+			if ( empty( $info ) && ! $args['blank'] ) {
662 662
 				$info = $user->user_login;
663 663
 			}
664 664
 		}
665 665
 
666 666
 		if ( $args['link'] ) {
667
-			$info = '<a href="' .  esc_url( admin_url('user-edit.php?user_id=' . $user_id ) ) . '">' . $info . '</a>';
667
+			$info = '<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $user_id ) ) . '">' . $info . '</a>';
668 668
 		}
669 669
 
670 670
 		return $info;
@@ -682,14 +682,14 @@  discard block
 block discarded – undo
682 682
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
683 683
 
684 684
         $field_types = array();
685
-        if ( in_array($type, $single_input) ) {
685
+        if ( in_array( $type, $single_input ) ) {
686 686
             self::field_types_for_input( $single_input, $field_selection, $field_types );
687
-        } else if ( in_array($type, $multiple_input) ) {
687
+        } else if ( in_array( $type, $multiple_input ) ) {
688 688
             self::field_types_for_input( $multiple_input, $field_selection, $field_types );
689
-        } else if ( in_array($type, $other_type) ) {
689
+        } else if ( in_array( $type, $other_type ) ) {
690 690
             self::field_types_for_input( $other_type, $field_selection, $field_types );
691
-		} else if ( isset( $field_selection[ $type ] ) ) {
692
-            $field_types[ $type ] = $field_selection[ $type ];
691
+		} else if ( isset( $field_selection[$type] ) ) {
692
+            $field_types[$type] = $field_selection[$type];
693 693
         }
694 694
 
695 695
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
@@ -698,8 +698,8 @@  discard block
 block discarded – undo
698 698
 
699 699
     private static function field_types_for_input( $inputs, $fields, &$field_types ) {
700 700
         foreach ( $inputs as $input ) {
701
-            $field_types[ $input ] = $fields[ $input ];
702
-            unset($input);
701
+            $field_types[$input] = $fields[$input];
702
+            unset( $input );
703 703
         }
704 704
     }
705 705
 
@@ -744,21 +744,21 @@  discard block
 block discarded – undo
744 744
 		// Check posted vals before checking saved values
745 745
 
746 746
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
747
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
747
+		if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) {
748 748
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
749
-				$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 ] ) : '';
749
+				$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] ) : '';
750 750
 			} else {
751
-				$other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] );
751
+				$other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] );
752 752
 			}
753 753
 			return $other_val;
754 754
 
755
-		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
755
+		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) {
756 756
 			// For normal fields
757 757
 
758 758
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
759
-				$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : '';
759
+				$other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : '';
760 760
 			} else {
761
-				$other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] );
761
+				$other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] );
762 762
 			}
763 763
 			return $other_val;
764 764
 		}
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
 		if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) {
768 768
 			// Check if there is an "other" val in saved value and make sure the
769 769
 			// "other" val is not equal to the Other checkbox option
770
-			if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
771
-				$other_val = $field['value'][ $opt_key ];
770
+			if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) {
771
+				$other_val = $field['value'][$opt_key];
772 772
 			}
773 773
 		} else {
774 774
 			/**
@@ -780,8 +780,8 @@  discard block
 block discarded – undo
780 780
 				// Multi-select dropdowns - key is not preserved
781 781
 				if ( is_array( $field['value'] ) ) {
782 782
 					$o_key = array_search( $temp_val, $field['value'] );
783
-					if ( isset( $field['value'][ $o_key ] ) ) {
784
-						unset( $field['value'][ $o_key ], $o_key );
783
+					if ( isset( $field['value'][$o_key] ) ) {
784
+						unset( $field['value'][$o_key], $o_key );
785 785
 					}
786 786
 				} else if ( $temp_val == $field['value'] ) {
787 787
 					// For radio and regular dropdowns
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 	private static function set_other_name( $args, &$other_args ) {
839 839
 		//Set up name for other field
840 840
 		$other_args['name'] = str_replace( '[]', '', $args['field_name'] );
841
-		$other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']);
841
+		$other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] );
842 842
 		$other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']';
843 843
 
844 844
 		//Converts item_meta[field_id] => item_meta[other][field_id] and
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 		// Count should only be greater than 3 if inside of a repeating section
866 866
 		if ( count( $temp_array ) > 3 ) {
867 867
 			$parent = str_replace( ']', '', $temp_array[1] );
868
-			$pointer = str_replace( ']', '', $temp_array[2]);
868
+			$pointer = str_replace( ']', '', $temp_array[2] );
869 869
 		}
870 870
 
871 871
 		// Get text for "other" text field
@@ -984,15 +984,15 @@  discard block
 block discarded – undo
984 984
 			$replace_with[] = '[' . $new . ']';
985 985
 			$replace[] = '[' . $old . ' ';
986 986
 			$replace_with[] = '[' . $new . ' ';
987
-            unset($old, $new);
987
+            unset( $old, $new );
988 988
         }
989 989
 		if ( is_array( $val ) ) {
990 990
 			foreach ( $val as $k => $v ) {
991
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
992
-                unset($k, $v);
991
+                $val[$k] = str_replace( $replace, $replace_with, $v );
992
+                unset( $k, $v );
993 993
             }
994 994
         } else {
995
-            $val = str_replace($replace, $replace_with, $val);
995
+            $val = str_replace( $replace, $replace_with, $val );
996 996
         }
997 997
 
998 998
         return $val;
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
             'DC' => 'District of Columbia',
1006 1006
             'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1007 1007
             'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1008
-            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1008
+            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland',
1009 1009
             'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1010 1010
             'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1011 1011
             'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
@@ -1096,35 +1096,35 @@  discard block
 block discarded – undo
1096 1096
     }
1097 1097
 
1098 1098
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1099
-		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1099
+		$prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries();
1100 1100
 
1101 1101
         $states = FrmFieldsHelper::get_us_states();
1102
-        $state_abv = array_keys($states);
1103
-        sort($state_abv);
1104
-		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1102
+        $state_abv = array_keys( $states );
1103
+        sort( $state_abv );
1104
+		$prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv;
1105 1105
 
1106
-        $states = array_values($states);
1107
-        sort($states);
1108
-		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1109
-        unset($state_abv, $states);
1106
+        $states = array_values( $states );
1107
+        sort( $states );
1108
+		$prepop[__( 'U.S. States', 'formidable' )] = $states;
1109
+        unset( $state_abv, $states );
1110 1110
 
1111
-		$prepop[ __( 'Age', 'formidable' ) ] = array(
1111
+		$prepop[__( 'Age', 'formidable' )] = array(
1112 1112
             __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1113 1113
             __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1114 1114
             __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1115 1115
         );
1116 1116
 
1117
-		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1117
+		$prepop[__( 'Satisfaction', 'formidable' )] = array(
1118 1118
             __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1119 1119
             __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1120 1120
         );
1121 1121
 
1122
-		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1122
+		$prepop[__( 'Importance', 'formidable' )] = array(
1123 1123
             __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1124 1124
             __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1125 1125
         );
1126 1126
 
1127
-		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1127
+		$prepop[__( 'Agreement', 'formidable' )] = array(
1128 1128
             __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1129 1129
             __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1130 1130
         );
Please login to merge, or discard this patch.
Indentation   +475 added lines, -475 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  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
-        }
10
+		if ( strpos($type, '|') ) {
11
+			list($type, $setting) = explode('|', $type);
12
+		}
13 13
 
14 14
 		$values = self::get_default_field( $type );
15 15
 
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
 			}
30 30
 		}
31 31
 
32
-        return $values;
33
-    }
32
+		return $values;
33
+	}
34 34
 
35 35
 	public static function get_html_id( $field, $plus = '' ) {
36 36
 		return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field );
37
-    }
37
+	}
38 38
 
39
-    public static function setup_edit_vars( $field, $doing_ajax = false ) {
39
+	public static function setup_edit_vars( $field, $doing_ajax = false ) {
40 40
 		$values = self::field_object_to_array( $field, $doing_ajax );
41 41
 		return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) );
42
-    }
42
+	}
43 43
 
44 44
 	public static function field_object_to_array( $field, $doing_ajax = false ) {
45 45
 		$values = (array) $field;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		}
85 85
 	}
86 86
 
87
-    public static function get_default_field_opts( $type, $field, $limit = false ) {
87
+	public static function get_default_field_opts( $type, $field, $limit = false ) {
88 88
 		if ( $limit ) {
89 89
 			_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldHelper::get_default_field_options' );
90 90
 			$field_options = self::get_default_field_options( $type );
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		}
95 95
 
96 96
 		return $field_options;
97
-    }
97
+	}
98 98
 
99 99
 	/**
100 100
 	 * @since 3.0
@@ -123,22 +123,22 @@  discard block
 block discarded – undo
123 123
 		return $field_type->get_new_field_defaults();
124 124
 	}
125 125
 
126
-    public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
127
-        global $wpdb;
126
+	public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
127
+		global $wpdb;
128 128
 
129 129
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
130
-        $values['form_id'] = $form_id;
131
-        $values['options'] = maybe_serialize($field->options);
132
-        $values['default_value'] = maybe_serialize($field->default_value);
133
-
134
-        foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
135
-            $values[ $col ] = $field->{$col};
136
-        }
137
-    }
138
-
139
-    /**
140
-     * @since 2.0
141
-     */
130
+		$values['form_id'] = $form_id;
131
+		$values['options'] = maybe_serialize($field->options);
132
+		$values['default_value'] = maybe_serialize($field->default_value);
133
+
134
+		foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
135
+			$values[ $col ] = $field->{$col};
136
+		}
137
+	}
138
+
139
+	/**
140
+	 * @since 2.0
141
+	 */
142 142
 	public static function get_error_msg( $field, $error ) {
143 143
 		$frm_settings = FrmAppHelper::get_settings();
144 144
 		$default_settings = $frm_settings->default_options();
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 
244 244
 	public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
245 245
 		_deprecated_function( __FUNCTION__, '3.0', 'FrmShortcodeHelper::get_shortcode_tag' );
246
-        return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args );
247
-    }
246
+		return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args );
247
+	}
248 248
 
249 249
 	public static function get_checkbox_id( $field, $opt_key ) {
250 250
 		$id = $field['id'];
@@ -256,37 +256,37 @@  discard block
 block discarded – undo
256 256
 
257 257
 	public static function display_recaptcha( $field ) {
258 258
 		_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldCaptcha::field_input' );
259
-    }
259
+	}
260 260
 
261 261
 	public static function show_single_option( $field ) {
262 262
 		if ( ! is_array( $field['options'] ) ) {
263 263
 			return;
264 264
 		}
265 265
 
266
-        $field_name = $field['name'];
267
-        $html_id = self::get_html_id($field);
266
+		$field_name = $field['name'];
267
+		$html_id = self::get_html_id($field);
268 268
 
269 269
 		foreach ( $field['options'] as $opt_key => $opt ) {
270
-		    $field_val = self::get_value_from_array( $opt, $opt_key, $field );
271
-		    $opt = self::get_label_from_array( $opt, $opt_key, $field );
270
+			$field_val = self::get_value_from_array( $opt, $opt_key, $field );
271
+			$opt = self::get_label_from_array( $opt, $opt_key, $field );
272 272
 
273 273
 			// Get string for Other text field, if needed
274 274
 			$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
275 275
 
276 276
 			$checked = ( $other_val || isset( $field['value'] ) && ( ( ! is_array( $field['value'] ) && $field['value'] == $field_val ) || ( is_array($field['value'] ) && in_array( $field_val, $field['value'] ) ) ) ) ? ' checked="checked"':'';
277 277
 
278
-		    // If this is an "Other" option, get the HTML for it
278
+			// If this is an "Other" option, get the HTML for it
279 279
 			if ( self::is_other_opt( $opt_key ) ) {
280 280
 				if ( FrmAppHelper::pro_is_installed() ) {
281 281
 					require( FrmProAppHelper::plugin_path() . '/classes/views/frmpro-fields/other-option.php' );
282 282
 				}
283
-		    } else {
283
+			} else {
284 284
 				require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
285
-		    }
285
+			}
286 286
 
287 287
 			unset( $checked, $other_val );
288 288
 		}
289
-    }
289
+	}
290 290
 
291 291
 	public static function get_value_from_array( $opt, $opt_key, $field ) {
292 292
 		$opt = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
@@ -299,47 +299,47 @@  discard block
 block discarded – undo
299 299
 	}
300 300
 
301 301
 	public static function get_term_link( $tax_id ) {
302
-        $tax = get_taxonomy($tax_id);
303
-        if ( ! $tax ) {
304
-            return;
305
-        }
302
+		$tax = get_taxonomy($tax_id);
303
+		if ( ! $tax ) {
304
+			return;
305
+		}
306 306
 
307
-        $link = sprintf(
308
-            __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
307
+		$link = sprintf(
308
+			__( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
309 309
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
310
-        );
311
-        unset($tax);
310
+		);
311
+		unset($tax);
312 312
 
313
-        return $link;
314
-    }
313
+		return $link;
314
+	}
315 315
 
316 316
 	public static function value_meets_condition( $observed_value, $cond, $hide_opt ) {
317 317
 		$hide_opt = self::get_value_for_comparision( $hide_opt );
318 318
 		$observed_value = self::get_value_for_comparision( $observed_value );
319 319
 
320
-        if ( is_array($observed_value) ) {
321
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
322
-        }
323
-
324
-        $m = false;
325
-        if ( $cond == '==' ) {
326
-            $m = $observed_value == $hide_opt;
327
-        } else if ( $cond == '!=' ) {
328
-            $m = $observed_value != $hide_opt;
329
-        } else if ( $cond == '>' ) {
330
-            $m = $observed_value > $hide_opt;
331
-        } else if ( $cond == '<' ) {
332
-            $m = $observed_value < $hide_opt;
333
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
334
-            $m = stripos($observed_value, $hide_opt);
335
-            if ( $cond == 'not LIKE' ) {
336
-                $m = ( $m === false ) ? true : false;
337
-            } else {
338
-                $m = ( $m === false ) ? false : true;
339
-            }
340
-        }
341
-        return $m;
342
-    }
320
+		if ( is_array($observed_value) ) {
321
+			return self::array_value_condition($observed_value, $cond, $hide_opt);
322
+		}
323
+
324
+		$m = false;
325
+		if ( $cond == '==' ) {
326
+			$m = $observed_value == $hide_opt;
327
+		} else if ( $cond == '!=' ) {
328
+			$m = $observed_value != $hide_opt;
329
+		} else if ( $cond == '>' ) {
330
+			$m = $observed_value > $hide_opt;
331
+		} else if ( $cond == '<' ) {
332
+			$m = $observed_value < $hide_opt;
333
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
334
+			$m = stripos($observed_value, $hide_opt);
335
+			if ( $cond == 'not LIKE' ) {
336
+				$m = ( $m === false ) ? true : false;
337
+			} else {
338
+				$m = ( $m === false ) ? false : true;
339
+			}
340
+		}
341
+		return $m;
342
+	}
343 343
 
344 344
 	/**
345 345
 	 * Trim and sanitize the values
@@ -355,174 +355,174 @@  discard block
 block discarded – undo
355 355
 	}
356 356
 
357 357
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
358
-        $m = false;
359
-        if ( $cond == '==' ) {
360
-            if ( is_array($hide_opt) ) {
361
-                $m = array_intersect($hide_opt, $observed_value);
362
-                $m = empty($m) ? false : true;
363
-            } else {
364
-                $m = in_array($hide_opt, $observed_value);
365
-            }
366
-        } else if ( $cond == '!=' ) {
367
-            $m = ! in_array($hide_opt, $observed_value);
368
-        } else if ( $cond == '>' ) {
369
-            $min = min($observed_value);
370
-            $m = $min > $hide_opt;
371
-        } else if ( $cond == '<' ) {
372
-            $max = max($observed_value);
373
-            $m = $max < $hide_opt;
374
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
375
-            foreach ( $observed_value as $ob ) {
376
-                $m = strpos($ob, $hide_opt);
377
-                if ( $m !== false ) {
378
-                    $m = true;
379
-                    break;
380
-                }
381
-            }
382
-
383
-            if ( $cond == 'not LIKE' ) {
384
-                $m = ( $m === false ) ? true : false;
385
-            }
386
-        }
387
-
388
-        return $m;
389
-    }
390
-
391
-    /**
392
-     * Replace a few basic shortcodes and field ids
393
-     * @since 2.0
394
-     * @return string
395
-     */
358
+		$m = false;
359
+		if ( $cond == '==' ) {
360
+			if ( is_array($hide_opt) ) {
361
+				$m = array_intersect($hide_opt, $observed_value);
362
+				$m = empty($m) ? false : true;
363
+			} else {
364
+				$m = in_array($hide_opt, $observed_value);
365
+			}
366
+		} else if ( $cond == '!=' ) {
367
+			$m = ! in_array($hide_opt, $observed_value);
368
+		} else if ( $cond == '>' ) {
369
+			$min = min($observed_value);
370
+			$m = $min > $hide_opt;
371
+		} else if ( $cond == '<' ) {
372
+			$max = max($observed_value);
373
+			$m = $max < $hide_opt;
374
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
375
+			foreach ( $observed_value as $ob ) {
376
+				$m = strpos($ob, $hide_opt);
377
+				if ( $m !== false ) {
378
+					$m = true;
379
+					break;
380
+				}
381
+			}
382
+
383
+			if ( $cond == 'not LIKE' ) {
384
+				$m = ( $m === false ) ? true : false;
385
+			}
386
+		}
387
+
388
+		return $m;
389
+	}
390
+
391
+	/**
392
+	 * Replace a few basic shortcodes and field ids
393
+	 * @since 2.0
394
+	 * @return string
395
+	 */
396 396
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
397
-        if ( strpos($value, '[sitename]') !== false ) {
398
-            $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
399
-            $value = str_replace('[sitename]', $new_value, $value);
400
-        }
397
+		if ( strpos($value, '[sitename]') !== false ) {
398
+			$new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
399
+			$value = str_replace('[sitename]', $new_value, $value);
400
+		}
401 401
 
402
-        $value = apply_filters('frm_content', $value, $form, $entry);
403
-        $value = do_shortcode($value);
402
+		$value = apply_filters('frm_content', $value, $form, $entry);
403
+		$value = do_shortcode($value);
404 404
 
405
-        return $value;
406
-    }
405
+		return $value;
406
+	}
407 407
 
408 408
 	public static function get_shortcodes( $content, $form_id ) {
409
-        if ( FrmAppHelper::pro_is_installed() ) {
410
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
411
-        }
409
+		if ( FrmAppHelper::pro_is_installed() ) {
410
+			return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
411
+		}
412 412
 
413
-        $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
413
+		$fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
414 414
 
415
-        $tagregexp = self::allowed_shortcodes($fields);
415
+		$tagregexp = self::allowed_shortcodes($fields);
416 416
 
417
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
417
+		preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
418 418
 
419
-        return $matches;
420
-    }
419
+		return $matches;
420
+	}
421 421
 
422 422
 	public static function allowed_shortcodes( $fields = array() ) {
423
-        $tagregexp = array(
424
-            'editlink', 'id', 'key', 'ip',
425
-            'siteurl', 'sitename', 'admin_email',
426
-            'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
423
+		$tagregexp = array(
424
+			'editlink', 'id', 'key', 'ip',
425
+			'siteurl', 'sitename', 'admin_email',
426
+			'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
427 427
 			'parent[-|_]id',
428
-        );
428
+		);
429 429
 
430
-        foreach ( $fields as $field ) {
431
-            $tagregexp[] = $field->id;
432
-            $tagregexp[] = $field->field_key;
433
-        }
430
+		foreach ( $fields as $field ) {
431
+			$tagregexp[] = $field->id;
432
+			$tagregexp[] = $field->field_key;
433
+		}
434 434
 
435
-        $tagregexp = implode('|', $tagregexp);
436
-        return $tagregexp;
437
-    }
435
+		$tagregexp = implode('|', $tagregexp);
436
+		return $tagregexp;
437
+	}
438 438
 
439 439
 	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
440
-        $shortcode_values = array(
441
-           'id'     => $entry->id,
442
-           'key'    => $entry->item_key,
443
-           'ip'     => $entry->ip,
444
-        );
440
+		$shortcode_values = array(
441
+		   'id'     => $entry->id,
442
+		   'key'    => $entry->item_key,
443
+		   'ip'     => $entry->ip,
444
+		);
445 445
 
446
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
446
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
447 447
 			if ( empty( $tag ) ) {
448 448
 				continue;
449 449
 			}
450 450
 
451
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
451
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
452 452
 
453
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
453
+			if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
454 454
 				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
455
-                $tags = explode(' ', $tag);
456
-                if ( is_array($tags) ) {
457
-                    $tag = $tags[0];
458
-                }
459
-            } else {
460
-                $tag = $shortcodes[2][ $short_key ];
461
-            }
462
-
463
-            switch ( $tag ) {
464
-                case 'id':
465
-                case 'key':
466
-                case 'ip':
467
-                    $replace_with = $shortcode_values[ $tag ];
468
-                break;
469
-
470
-                case 'user_agent':
471
-                case 'user-agent':
472
-                    $entry->description = maybe_unserialize($entry->description);
455
+				$tags = explode(' ', $tag);
456
+				if ( is_array($tags) ) {
457
+					$tag = $tags[0];
458
+				}
459
+			} else {
460
+				$tag = $shortcodes[2][ $short_key ];
461
+			}
462
+
463
+			switch ( $tag ) {
464
+				case 'id':
465
+				case 'key':
466
+				case 'ip':
467
+					$replace_with = $shortcode_values[ $tag ];
468
+				break;
469
+
470
+				case 'user_agent':
471
+				case 'user-agent':
472
+					$entry->description = maybe_unserialize($entry->description);
473 473
 					$replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] );
474
-                break;
475
-
476
-                case 'created_at':
477
-                case 'created-at':
478
-                case 'updated_at':
479
-                case 'updated-at':
480
-                    if ( isset($atts['format']) ) {
481
-                        $time_format = ' ';
482
-                    } else {
483
-                        $atts['format'] = get_option('date_format');
484
-                        $time_format = '';
485
-                    }
486
-
487
-                    $this_tag = str_replace('-', '_', $tag);
488
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
489
-                    unset($this_tag);
490
-                break;
491
-
492
-                case 'created_by':
493
-                case 'created-by':
494
-                case 'updated_by':
495
-                case 'updated-by':
496
-                    $this_tag = str_replace('-', '_', $tag);
474
+				break;
475
+
476
+				case 'created_at':
477
+				case 'created-at':
478
+				case 'updated_at':
479
+				case 'updated-at':
480
+					if ( isset($atts['format']) ) {
481
+						$time_format = ' ';
482
+					} else {
483
+						$atts['format'] = get_option('date_format');
484
+						$time_format = '';
485
+					}
486
+
487
+					$this_tag = str_replace('-', '_', $tag);
488
+					$replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
489
+					unset($this_tag);
490
+				break;
491
+
492
+				case 'created_by':
493
+				case 'created-by':
494
+				case 'updated_by':
495
+				case 'updated-by':
496
+					$this_tag = str_replace('-', '_', $tag);
497 497
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
498
-                    unset($this_tag);
499
-                break;
500
-
501
-                case 'admin_email':
502
-                case 'siteurl':
503
-                case 'frmurl':
504
-                case 'sitename':
505
-                case 'get':
506
-                    $replace_with = self::dynamic_default_values( $tag, $atts );
507
-                break;
508
-
509
-                default:
510
-                    $field = FrmField::getOne( $tag );
511
-                    if ( ! $field ) {
512
-                        break;
513
-                    }
514
-
515
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
516
-
517
-                    $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
518
-
519
-                    $atts['entry_id'] = $entry->id;
520
-                    $atts['entry_key'] = $entry->item_key;
521
-
522
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
523
-                        $replace_with = $field->name;
524
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
525
-                        $replace_with = $field->description;
498
+					unset($this_tag);
499
+				break;
500
+
501
+				case 'admin_email':
502
+				case 'siteurl':
503
+				case 'frmurl':
504
+				case 'sitename':
505
+				case 'get':
506
+					$replace_with = self::dynamic_default_values( $tag, $atts );
507
+				break;
508
+
509
+				default:
510
+					$field = FrmField::getOne( $tag );
511
+					if ( ! $field ) {
512
+						break;
513
+					}
514
+
515
+					$sep = isset($atts['sep']) ? $atts['sep'] : ', ';
516
+
517
+					$replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
518
+
519
+					$atts['entry_id'] = $entry->id;
520
+					$atts['entry_key'] = $entry->item_key;
521
+
522
+					if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
523
+						$replace_with = $field->name;
524
+					} else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
525
+						$replace_with = $field->description;
526 526
 					} else {
527 527
 						$string_value = $replace_with;
528 528
 						if ( is_array( $replace_with ) ) {
@@ -536,82 +536,82 @@  discard block
 block discarded – undo
536 536
 						}
537 537
 					}
538 538
 
539
-                    unset($field);
540
-                break;
541
-            }
539
+					unset($field);
540
+				break;
541
+			}
542 542
 
543
-            if ( isset($replace_with) ) {
544
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
545
-            }
543
+			if ( isset($replace_with) ) {
544
+				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
545
+			}
546 546
 
547
-            unset($atts, $conditional, $replace_with);
547
+			unset($atts, $conditional, $replace_with);
548 548
 		}
549 549
 
550 550
 		return $content;
551
-    }
552
-
553
-    /**
554
-     * Get the value to replace a few standard shortcodes
555
-     *
556
-     * @since 2.0
557
-     * @return string
558
-     */
559
-    public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
560
-        $new_value = '';
561
-        switch ( $tag ) {
562
-            case 'admin_email':
563
-                $new_value = get_option('admin_email');
564
-                break;
565
-            case 'siteurl':
566
-                $new_value = FrmAppHelper::site_url();
567
-                break;
568
-            case 'frmurl':
569
-                $new_value = FrmAppHelper::plugin_url();
570
-                break;
571
-            case 'sitename':
572
-                $new_value = FrmAppHelper::site_name();
573
-                break;
574
-            case 'get':
575
-                $new_value = self::process_get_shortcode( $atts, $return_array );
576
-                break;
577
-        }
578
-
579
-        return $new_value;
580
-    }
581
-
582
-    /**
583
-     * Process the [get] shortcode
584
-     *
585
-     * @since 2.0
586
-     * @return string|array
587
-     */
588
-    public static function process_get_shortcode( $atts, $return_array = false ) {
589
-        if ( ! isset($atts['param']) ) {
590
-            return '';
591
-        }
592
-
593
-        if ( strpos($atts['param'], '&#91;') ) {
594
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
595
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
596
-        }
597
-
598
-        $new_value = FrmAppHelper::get_param($atts['param'], '');
599
-        $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
600
-
601
-        if ( $new_value == '' ) {
602
-            if ( ! isset($atts['prev_val']) ) {
603
-                $atts['prev_val'] = '';
604
-            }
605
-
606
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
607
-        }
608
-
609
-        if ( is_array($new_value) && ! $return_array ) {
610
-            $new_value = implode(', ', $new_value);
611
-        }
612
-
613
-        return $new_value;
614
-    }
551
+	}
552
+
553
+	/**
554
+	 * Get the value to replace a few standard shortcodes
555
+	 *
556
+	 * @since 2.0
557
+	 * @return string
558
+	 */
559
+	public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
560
+		$new_value = '';
561
+		switch ( $tag ) {
562
+			case 'admin_email':
563
+				$new_value = get_option('admin_email');
564
+				break;
565
+			case 'siteurl':
566
+				$new_value = FrmAppHelper::site_url();
567
+				break;
568
+			case 'frmurl':
569
+				$new_value = FrmAppHelper::plugin_url();
570
+				break;
571
+			case 'sitename':
572
+				$new_value = FrmAppHelper::site_name();
573
+				break;
574
+			case 'get':
575
+				$new_value = self::process_get_shortcode( $atts, $return_array );
576
+				break;
577
+		}
578
+
579
+		return $new_value;
580
+	}
581
+
582
+	/**
583
+	 * Process the [get] shortcode
584
+	 *
585
+	 * @since 2.0
586
+	 * @return string|array
587
+	 */
588
+	public static function process_get_shortcode( $atts, $return_array = false ) {
589
+		if ( ! isset($atts['param']) ) {
590
+			return '';
591
+		}
592
+
593
+		if ( strpos($atts['param'], '&#91;') ) {
594
+			$atts['param'] = str_replace('&#91;', '[', $atts['param']);
595
+			$atts['param'] = str_replace('&#93;', ']', $atts['param']);
596
+		}
597
+
598
+		$new_value = FrmAppHelper::get_param($atts['param'], '');
599
+		$new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
600
+
601
+		if ( $new_value == '' ) {
602
+			if ( ! isset($atts['prev_val']) ) {
603
+				$atts['prev_val'] = '';
604
+			}
605
+
606
+			$new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
607
+		}
608
+
609
+		if ( is_array($new_value) && ! $return_array ) {
610
+			$new_value = implode(', ', $new_value);
611
+		}
612
+
613
+		return $new_value;
614
+	}
615 615
 
616 616
 	public static function get_display_value( $value, $field, $atts = array() ) {
617 617
 
@@ -671,37 +671,37 @@  discard block
 block discarded – undo
671 671
 	}
672 672
 
673 673
 	public static function get_field_types( $type ) {
674
-        $single_input = array(
675
-            'text', 'textarea', 'rte', 'number', 'email', 'url',
676
-            'image', 'file', 'date', 'phone', 'hidden', 'time',
677
-            'user_id', 'tag', 'password',
678
-        );
674
+		$single_input = array(
675
+			'text', 'textarea', 'rte', 'number', 'email', 'url',
676
+			'image', 'file', 'date', 'phone', 'hidden', 'time',
677
+			'user_id', 'tag', 'password',
678
+		);
679 679
 		$multiple_input = array( 'radio', 'checkbox', 'select', 'scale', 'lookup' );
680 680
 		$other_type = array( 'html', 'break' );
681 681
 
682 682
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
683 683
 
684
-        $field_types = array();
685
-        if ( in_array($type, $single_input) ) {
686
-            self::field_types_for_input( $single_input, $field_selection, $field_types );
687
-        } else if ( in_array($type, $multiple_input) ) {
688
-            self::field_types_for_input( $multiple_input, $field_selection, $field_types );
689
-        } else if ( in_array($type, $other_type) ) {
690
-            self::field_types_for_input( $other_type, $field_selection, $field_types );
684
+		$field_types = array();
685
+		if ( in_array($type, $single_input) ) {
686
+			self::field_types_for_input( $single_input, $field_selection, $field_types );
687
+		} else if ( in_array($type, $multiple_input) ) {
688
+			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
689
+		} else if ( in_array($type, $other_type) ) {
690
+			self::field_types_for_input( $other_type, $field_selection, $field_types );
691 691
 		} else if ( isset( $field_selection[ $type ] ) ) {
692
-            $field_types[ $type ] = $field_selection[ $type ];
693
-        }
692
+			$field_types[ $type ] = $field_selection[ $type ];
693
+		}
694 694
 
695 695
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
696
-        return $field_types;
697
-    }
696
+		return $field_types;
697
+	}
698 698
 
699
-    private static function field_types_for_input( $inputs, $fields, &$field_types ) {
700
-        foreach ( $inputs as $input ) {
701
-            $field_types[ $input ] = $fields[ $input ];
702
-            unset($input);
703
-        }
704
-    }
699
+	private static function field_types_for_input( $inputs, $fields, &$field_types ) {
700
+		foreach ( $inputs as $input ) {
701
+			$field_types[ $input ] = $fields[ $input ];
702
+			unset($input);
703
+		}
704
+	}
705 705
 
706 706
 	/**
707 707
 	 * Check if current field option is an "other" option
@@ -715,14 +715,14 @@  discard block
 block discarded – undo
715 715
 		return $opt_key && strpos( $opt_key, 'other_' ) === 0;
716 716
 	}
717 717
 
718
-    /**
719
-    * Get value that belongs in "Other" text box
720
-    *
721
-    * @since 2.0.6
722
-    *
723
-    * @param array $args
724
-    */
725
-    public static function get_other_val( $args ) {
718
+	/**
719
+	 * Get value that belongs in "Other" text box
720
+	 *
721
+	 * @since 2.0.6
722
+	 *
723
+	 * @param array $args
724
+	 */
725
+	public static function get_other_val( $args ) {
726 726
 		$defaults = array(
727 727
 			'opt_key' => 0, 'field' => array(),
728 728
 			'parent' => false, 'pointer' => false,
@@ -798,20 +798,20 @@  discard block
 block discarded – undo
798 798
 		}
799 799
 
800 800
 		return $other_val;
801
-    }
802
-
803
-    /**
804
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
805
-    * Intended for front-end use
806
-    *
807
-    * @since 2.0.6
808
-    *
809
-    * @param array $args should include field, opt_key and field name
810
-    * @param boolean $other_opt
811
-    * @param string $checked
812
-    * @return string $other_val
813
-    */
814
-    public static function prepare_other_input( $args, &$other_opt, &$checked ) {
801
+	}
802
+
803
+	/**
804
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
805
+	 * Intended for front-end use
806
+	 *
807
+	 * @since 2.0.6
808
+	 *
809
+	 * @param array $args should include field, opt_key and field name
810
+	 * @param boolean $other_opt
811
+	 * @param string $checked
812
+	 * @return string $other_val
813
+	 */
814
+	public static function prepare_other_input( $args, &$other_opt, &$checked ) {
815 815
 		//Check if this is an "Other" option
816 816
 		if ( ! self::is_other_opt( $args['opt_key'] ) ) {
817 817
 			return;
@@ -827,8 +827,8 @@  discard block
 block discarded – undo
827 827
 			$checked = 'checked="checked" ';
828 828
 		}
829 829
 
830
-        return $other_args;
831
-    }
830
+		return $other_args;
831
+	}
832 832
 
833 833
 	/**
834 834
 	 * @param array $args
@@ -878,8 +878,8 @@  discard block
 block discarded – undo
878 878
 	 * @since 2.0.6
879 879
 	 */
880 880
 	public static function include_other_input( $args ) {
881
-        if ( ! $args['other_opt'] ) {
882
-        	return;
881
+		if ( ! $args['other_opt'] ) {
882
+			return;
883 883
 		}
884 884
 
885 885
 		$classes = array( 'frm_other_input' );
@@ -900,15 +900,15 @@  discard block
 block discarded – undo
900 900
 	}
901 901
 
902 902
 	/**
903
-	* Get the HTML id for an "Other" text field
904
-	* Note: This does not affect fields in repeating sections
905
-	*
906
-	* @since 2.0.08
907
-	* @param string $type - field type
908
-	* @param string $html_id
909
-	* @param string|boolean $opt_key
910
-	* @return string $other_id
911
-	*/
903
+	 * Get the HTML id for an "Other" text field
904
+	 * Note: This does not affect fields in repeating sections
905
+	 *
906
+	 * @since 2.0.08
907
+	 * @param string $type - field type
908
+	 * @param string $html_id
909
+	 * @param string|boolean $opt_key
910
+	 * @return string $other_id
911
+	 */
912 912
 	public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) {
913 913
 		$other_id = $html_id;
914 914
 
@@ -966,10 +966,10 @@  discard block
 block discarded – undo
966 966
 	}
967 967
 
968 968
 	public static function switch_field_ids( $val ) {
969
-        global $frm_duplicate_ids;
970
-        $replace = array();
971
-        $replace_with = array();
972
-        foreach ( (array) $frm_duplicate_ids as $old => $new ) {
969
+		global $frm_duplicate_ids;
970
+		$replace = array();
971
+		$replace_with = array();
972
+		foreach ( (array) $frm_duplicate_ids as $old => $new ) {
973 973
 			$replace[] = '[if ' . $old . ']';
974 974
 			$replace_with[] = '[if ' . $new . ']';
975 975
 			$replace[] = '[if ' . $old . ' ';
@@ -984,153 +984,153 @@  discard block
 block discarded – undo
984 984
 			$replace_with[] = '[' . $new . ']';
985 985
 			$replace[] = '[' . $old . ' ';
986 986
 			$replace_with[] = '[' . $new . ' ';
987
-            unset($old, $new);
988
-        }
987
+			unset($old, $new);
988
+		}
989 989
 		if ( is_array( $val ) ) {
990 990
 			foreach ( $val as $k => $v ) {
991
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
992
-                unset($k, $v);
993
-            }
994
-        } else {
995
-            $val = str_replace($replace, $replace_with, $val);
996
-        }
997
-
998
-        return $val;
999
-    }
1000
-
1001
-    public static function get_us_states() {
1002
-        return apply_filters( 'frm_us_states', array(
1003
-            'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1004
-            'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1005
-            'DC' => 'District of Columbia',
1006
-            'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1007
-            'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1008
-            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1009
-            'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1010
-            'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1011
-            'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1012
-            'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1013
-            'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1014
-            'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1015
-            'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1016
-            'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1017
-        ) );
1018
-    }
1019
-
1020
-    public static function get_countries() {
1021
-        return apply_filters( 'frm_countries', array(
1022
-            __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1023
-            __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1024
-            __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1025
-            __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1026
-            __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1027
-            __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1028
-            __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1029
-            __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1030
-            __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1031
-            __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1032
-            __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1033
-            __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1034
-            __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1035
-            __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1036
-            __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1037
-            __( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1038
-            __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1039
-            __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1040
-            __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1041
-            __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1042
-            __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1043
-            __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1044
-            __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1045
-            __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1046
-            __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1047
-            __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1048
-            __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1049
-            __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1050
-            __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1051
-            __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1052
-            __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1053
-            __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1054
-            __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1055
-            __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1056
-            __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1057
-            __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1058
-            __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1059
-            __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1060
-            __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1061
-            __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1062
-            __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1063
-            __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1064
-            __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1065
-            __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1066
-            __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1067
-            __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1068
-            __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1069
-            __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1070
-            __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1071
-            __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1072
-            __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1073
-            __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1074
-            __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1075
-            __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1076
-            __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1077
-            __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1078
-            __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1079
-            __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1080
-            __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1081
-            __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1082
-            __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1083
-            __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1084
-            __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1085
-            __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1086
-            __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1087
-            __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1088
-            __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1089
-            __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1090
-            __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1091
-            __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1092
-            __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1093
-            __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1094
-            __( 'Zimbabwe', 'formidable' ),
1095
-        ) );
1096
-    }
991
+				$val[ $k ] = str_replace( $replace, $replace_with, $v );
992
+				unset($k, $v);
993
+			}
994
+		} else {
995
+			$val = str_replace($replace, $replace_with, $val);
996
+		}
997
+
998
+		return $val;
999
+	}
1000
+
1001
+	public static function get_us_states() {
1002
+		return apply_filters( 'frm_us_states', array(
1003
+			'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1004
+			'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1005
+			'DC' => 'District of Columbia',
1006
+			'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1007
+			'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1008
+			'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1009
+			'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1010
+			'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1011
+			'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1012
+			'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1013
+			'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1014
+			'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1015
+			'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1016
+			'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1017
+		) );
1018
+	}
1019
+
1020
+	public static function get_countries() {
1021
+		return apply_filters( 'frm_countries', array(
1022
+			__( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1023
+			__( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1024
+			__( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1025
+			__( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1026
+			__( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1027
+			__( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1028
+			__( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1029
+			__( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1030
+			__( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1031
+			__( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1032
+			__( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1033
+			__( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1034
+			__( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1035
+			__( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1036
+			__( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1037
+			__( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1038
+			__( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1039
+			__( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1040
+			__( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1041
+			__( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1042
+			__( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1043
+			__( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1044
+			__( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1045
+			__( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1046
+			__( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1047
+			__( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1048
+			__( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1049
+			__( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1050
+			__( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1051
+			__( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1052
+			__( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1053
+			__( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1054
+			__( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1055
+			__( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1056
+			__( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1057
+			__( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1058
+			__( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1059
+			__( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1060
+			__( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1061
+			__( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1062
+			__( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1063
+			__( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1064
+			__( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1065
+			__( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1066
+			__( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1067
+			__( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1068
+			__( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1069
+			__( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1070
+			__( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1071
+			__( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1072
+			__( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1073
+			__( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1074
+			__( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1075
+			__( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1076
+			__( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1077
+			__( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1078
+			__( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1079
+			__( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1080
+			__( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1081
+			__( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1082
+			__( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1083
+			__( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1084
+			__( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1085
+			__( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1086
+			__( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1087
+			__( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1088
+			__( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1089
+			__( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1090
+			__( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1091
+			__( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1092
+			__( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1093
+			__( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1094
+			__( 'Zimbabwe', 'formidable' ),
1095
+		) );
1096
+	}
1097 1097
 
1098 1098
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1099 1099
 		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1100 1100
 
1101
-        $states = FrmFieldsHelper::get_us_states();
1102
-        $state_abv = array_keys($states);
1103
-        sort($state_abv);
1101
+		$states = FrmFieldsHelper::get_us_states();
1102
+		$state_abv = array_keys($states);
1103
+		sort($state_abv);
1104 1104
 		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1105 1105
 
1106
-        $states = array_values($states);
1107
-        sort($states);
1106
+		$states = array_values($states);
1107
+		sort($states);
1108 1108
 		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1109
-        unset($state_abv, $states);
1109
+		unset($state_abv, $states);
1110 1110
 
1111 1111
 		$prepop[ __( 'Age', 'formidable' ) ] = array(
1112
-            __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1113
-            __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1114
-            __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1115
-        );
1112
+			__( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1113
+			__( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1114
+			__( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1115
+		);
1116 1116
 
1117 1117
 		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1118
-            __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1119
-            __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1120
-        );
1118
+			__( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1119
+			__( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1120
+		);
1121 1121
 
1122 1122
 		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1123
-            __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1124
-            __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1125
-        );
1123
+			__( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1124
+			__( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1125
+		);
1126 1126
 
1127 1127
 		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1128
-            __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1129
-            __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1130
-        );
1128
+			__( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1129
+			__( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1130
+		);
1131 1131
 
1132 1132
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1133
-    }
1133
+	}
1134 1134
 
1135 1135
 	/**
1136 1136
 	 * Display a field value selector
@@ -1140,10 +1140,10 @@  discard block
 block discarded – undo
1140 1140
 	 * @param int $selector_field_id
1141 1141
 	 * @param array $selector_args
1142 1142
 	 */
1143
-    public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1144
-	    $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1145
-	    $field_value_selector->display();
1146
-    }
1143
+	public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1144
+		$field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1145
+		$field_value_selector->display();
1146
+	}
1147 1147
 
1148 1148
 	/**
1149 1149
 	 * Convert a field object to a flat array
Please login to merge, or discard this patch.
classes/models/FrmFieldFormHtml.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 * @param array $atts
42 42
 	 */
43 43
 	private function _set( $param, $atts ) {
44
-		if ( isset( $atts[ $param ] ) ) {
45
-			$this->{$param} = $atts[ $param ];
44
+		if ( isset( $atts[$param] ) ) {
45
+			$this->{$param} = $atts[$param];
46 46
 		}
47 47
 	}
48 48
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 		$exclude = array( 'field_obj', 'html' );
75 75
 		
76 76
 		foreach ( $exclude as $ex ) {
77
-			if ( isset( $atts[ $ex ] ) ) {
78
-				unset( $this->pass_args[ $ex ] );
77
+			if ( isset( $atts[$ex] ) ) {
78
+				unset( $this->pass_args[$ex] );
79 79
 			}
80 80
 		}
81 81
 	}
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 * @param array $set
88 88
 	 */
89 89
 	private function set_from_field( $atts, $set ) {
90
-		if ( isset( $atts[ $set['param'] ] ) ) {
91
-			$this->{$set['param']} = $atts[ $set['param'] ];
90
+		if ( isset( $atts[$set['param']] ) ) {
91
+			$this->{$set['param']} = $atts[$set['param']];
92 92
 		} else {
93 93
 			$this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] );
94 94
 		}
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
 		$this->html = str_replace( 'field_[key]', $this->html_id, $this->html );
134 134
 
135 135
 		//replace [key]
136
-		$this->html = str_replace( '[key]', $this->field_obj->get_field_column('field_key'), $this->html );
136
+		$this->html = str_replace( '[key]', $this->field_obj->get_field_column( 'field_key' ), $this->html );
137 137
 
138 138
 		//replace [field_name]
139
-		$this->html = str_replace('[field_name]', $this->field_obj->get_field_column('name'), $this->html );
139
+		$this->html = str_replace( '[field_name]', $this->field_obj->get_field_column( 'name' ), $this->html );
140 140
 	}
141 141
 
142 142
 	/**
143 143
 	 * @since 3.0
144 144
 	 */
145 145
 	private function replace_required_label_shortcode() {
146
-		$required = FrmField::is_required( $this->field_obj->get_field() ) ? $this->field_obj->get_field_column('required_indicator') : '';
146
+		$required = FrmField::is_required( $this->field_obj->get_field() ) ? $this->field_obj->get_field_column( 'required_indicator' ) : '';
147 147
 		FrmShortcodeHelper::remove_inline_conditions( ! empty( $required ), 'required_label', $required, $this->html );
148 148
 	}
149 149
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since 3.0
152 152
 	 */
153 153
 	private function replace_description_shortcode() {
154
-		$description = $this->field_obj->get_field_column('description');
154
+		$description = $this->field_obj->get_field_column( 'description' );
155 155
 		FrmShortcodeHelper::remove_inline_conditions( ( $description && $description != '' ), 'description', $description, $this->html );
156 156
 	}
157 157
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @since 3.0
160 160
 	 */
161 161
 	private function replace_error_shortcode() {
162
-		$error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false;
162
+		$error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false;
163 163
 		FrmShortcodeHelper::remove_inline_conditions( ! empty( $error ), 'error', $error, $this->html );
164 164
 	}
165 165
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		$this->html .= "\n";
196 196
 
197 197
 		//Return html if conf_field to prevent loop
198
-		if ( $this->field_obj->get_field_column('conf_field') == 'stop' ) {
198
+		if ( $this->field_obj->get_field_column( 'conf_field' ) == 'stop' ) {
199 199
 			return;
200 200
 		}
201 201
 
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
 	 * @since 3.0
232 232
 	 */
233 233
 	private function replace_shortcodes_with_atts() {
234
-		preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER);
234
+		preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER );
235 235
 
236 236
 		foreach ( $shortcodes[0] as $short_key => $tag ) {
237
-			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
237
+			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
238 238
 			$tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) );
239 239
 
240 240
 			$replace_with = '';
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 				$replace_with = $this->replace_input_shortcode( $shortcode_atts );
246 246
 			}
247 247
 
248
-			$this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html );
248
+			$this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html );
249 249
 		}
250 250
 	}
251 251
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	private function prepare_input_shortcode_atts( $shortcode_atts ) {
268 268
 		if ( isset( $shortcode_atts['opt'] ) ) {
269
-			$shortcode_atts['opt']--;
269
+			$shortcode_atts['opt'] --;
270 270
 		}
271 271
 
272 272
 		$field_class = isset( $shortcode_atts['class'] ) ? $shortcode_atts['class'] : '';
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	private function add_class_to_label() {
291 291
 		$label_class = $this->field_obj->get_label_class();
292 292
 		$this->html = str_replace( '[label_position]', $label_class, $this->html );
293
-		if ( $this->field_obj->get_field_column('label') == 'inside' && $this->field_obj->get_field_column('value') != '' ) {
293
+		if ( $this->field_obj->get_field_column( 'label' ) == 'inside' && $this->field_obj->get_field_column( 'value' ) != '' ) {
294 294
 			$this->html = str_replace( 'frm_primary_label', 'frm_primary_label frm_visible', $this->html );
295 295
 		}
296 296
 	}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	private function add_field_div_classes() {
314 314
 		$classes = $this->get_field_div_classes();
315 315
 
316
-		if ( $this->field_obj->get_field_column('type') == 'html' && strpos( $this->html, '[error_class]' ) === false ) {
316
+		if ( $this->field_obj->get_field_column( 'type' ) == 'html' && strpos( $this->html, '[error_class]' ) === false ) {
317 317
 			// there is no error_class shortcode for HTML fields
318 318
 			$this->html = str_replace( 'class="frm_form_field', 'class="frm_form_field ' . $classes, $this->html );
319 319
 		}
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
 	 */
331 331
 	private function get_field_div_classes() {
332 332
 		// Add error class
333
-		$classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : '';
333
+		$classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : '';
334 334
 
335 335
 		// Add label position class
336
-		$classes .= ' frm_' . $this->field_obj->get_field_column('label') . '_container';
336
+		$classes .= ' frm_' . $this->field_obj->get_field_column( 'label' ) . '_container';
337 337
 
338 338
 		// Add CSS layout classes
339
-		$extra_classes = $this->field_obj->get_field_column('classes');
339
+		$extra_classes = $this->field_obj->get_field_column( 'classes' );
340 340
 		if ( ! empty( $extra_classes ) ) {
341
-			if ( ! strpos( $this->html, 'frm_form_field ') ) {
341
+			if ( ! strpos( $this->html, 'frm_form_field ' ) ) {
342 342
 				$classes .= ' frm_form_field';
343 343
 			}
344 344
 			$classes .= ' ' . $extra_classes;
Please login to merge, or discard this patch.