Completed
Push — master ( 43ef23...13c1c6 )
by Stephanie
02:35
created
classes/models/FrmAddon.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
 	}
39 39
 
40 40
 	public function insert_installed_addon( $plugins ) {
41
-		$plugins[ $this->plugin_slug ] = $this;
41
+		$plugins[$this->plugin_slug] = $this;
42 42
 		return $plugins;
43 43
 	}
44 44
 
45 45
 	public static function get_addon( $plugin_slug ) {
46 46
 		$plugins = apply_filters( 'frm_installed_addons', array() );
47 47
 		$plugin = false;
48
-		if ( isset( $plugins[ $plugin_slug ] ) ) {
49
-			$plugin = $plugins[ $plugin_slug ];
48
+		if ( isset( $plugins[$plugin_slug] ) ) {
49
+			$plugin = $plugins[$plugin_slug];
50 50
 		}
51 51
 		return $plugin;
52 52
 	}
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 		echo '<tr class="plugin-update-tr active"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message">';
152 152
 
153 153
 		/* translators: %1$s: Plugin name, %2$s: Start link HTML, %3$s: end link HTML */
154
-		printf( esc_html__( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), esc_html( $this->plugin_name ), '<a href="' . esc_url( admin_url('admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' );
154
+		printf( esc_html__( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), esc_html( $this->plugin_name ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' );
155 155
 		$id = sanitize_title( $plugin['Name'] );
156 156
 		echo '<script type="text/javascript">var d = document.getElementById("' . esc_attr( $id ) . '");if ( d !== null ){ d.className = d.className + " update"; }</script>';
157 157
 		echo '</div></td></tr>';
@@ -164,17 +164,17 @@  discard block
 block discarded – undo
164 164
 
165 165
 		if ( $this->is_current_version( $transient ) ) {
166 166
 			//make sure it doesn't show there is an update if plugin is up-to-date
167
-			if ( isset( $transient->response[ $this->plugin_folder ] ) ) {
168
-				unset( $transient->response[ $this->plugin_folder ] );
167
+			if ( isset( $transient->response[$this->plugin_folder] ) ) {
168
+				unset( $transient->response[$this->plugin_folder] );
169 169
 			}
170
-		} elseif ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) {
170
+		} elseif ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) {
171 171
 			$cache_key = $this->version_cache_key();
172 172
 			$version_info = get_transient( $cache_key );
173 173
 
174 174
 			$this->clear_old_plugin_version( $version_info );
175 175
 
176 176
 			if ( false !== $version_info && version_compare( $version_info->new_version, $this->version, '>' ) ) {
177
-				$transient->response[ $this->plugin_folder ] = $version_info;
177
+				$transient->response[$this->plugin_folder] = $version_info;
178 178
 			} else {
179 179
 				delete_transient( $cache_key );
180 180
 				if ( ! $this->has_been_cleared() ) {
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 					$this->manually_queue_update();
184 184
 				}
185 185
 
186
-				unset( $transient->response[ $this->plugin_folder ] );
186
+				unset( $transient->response[$this->plugin_folder] );
187 187
 			}
188 188
 		}
189 189
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	}
222 222
 
223 223
 	private function is_current_version( $transient ) {
224
-		if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) {
224
+		if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) {
225 225
 			return false;
226 226
 		}
227 227
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 			return true;
231 231
 		}
232 232
 
233
-		return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] === $transient->response[ $this->plugin_folder ]->new_version;
233
+		return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] === $transient->response[$this->plugin_folder]->new_version;
234 234
 	}
235 235
 
236 236
 	private function has_been_cleared() {
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 			$response['message'] = $response['status'];
296 296
 		} else {
297 297
 			$messages = $this->get_messages();
298
-			if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) {
299
-				$response['message'] = $messages[ $response['status'] ];
298
+			if ( is_string( $response['status'] ) && isset( $messages[$response['status']] ) ) {
299
+				$response['message'] = $messages[$response['status']];
300 300
 			} else {
301 301
 				$response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) );
302 302
 			}
Please login to merge, or discard this patch.
classes/views/xml/posts_xml.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,6 +89,6 @@
 block discarded – undo
89 89
 	if ( ! empty( $term->description ) ) {
90 90
 		?><term_description><?php echo FrmXMLHelper::cdata( $term->description ) ?></term_description><?php
91 91
 	}
92
-    ?><term_slug><?php echo esc_html( $term->slug ); ?></term_slug></term>
92
+	?><term_slug><?php echo esc_html( $term->slug ); ?></term_slug></term>
93 93
 <?php
94 94
 }
Please login to merge, or discard this patch.
classes/views/xml/xml.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
 <?php
8 8
 foreach ( $type as $tb_type ) {
9 9
 
10
-	if ( ! isset( $tables[ $tb_type ] ) ) {
10
+	if ( ! isset( $tables[$tb_type] ) ) {
11 11
 		do_action( 'frm_xml_import_' . $tb_type, $args );
12 12
 		continue;
13 13
 	}
14 14
 
15 15
 	//no records
16
-	if ( ! isset( $records[ $tb_type ] ) ) {
16
+	if ( ! isset( $records[$tb_type] ) ) {
17 17
 		continue;
18 18
 	}
19 19
 
20
-	$item_ids = $records[ $tb_type ];
20
+	$item_ids = $records[$tb_type];
21 21
 	if ( in_array( $tb_type, array( 'styles', 'actions' ), true ) ) {
22 22
 		include( dirname( __FILE__ ) . '/posts_xml.php' );
23 23
 	} elseif ( file_exists( dirname( __FILE__ ) . '/' . $tb_type . '_xml.php' ) ) {
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		include( FrmAppHelper::plugin_path() . '/pro/classes/views/xml/' . $tb_type . '_xml.php' );
27 27
 	}
28 28
 
29
-	unset( $item_ids, $records[ $tb_type ], $tb_type );
29
+	unset( $item_ids, $records[$tb_type], $tb_type );
30 30
 }
31 31
 
32 32
 ?>
Please login to merge, or discard this patch.
classes/views/xml/import_form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 			<p>
18 18
 				<label>
19 19
 					<?php echo esc_html( apply_filters( 'frm_upload_instructions2', __( 'Choose a Formidable XML file', 'formidable' ) ) ) ?>
20
-					(<?php echo esc_html( sprintf( __( 'Maximum size: %s', 'formidable' ), ini_get( 'upload_max_filesize') ) ) ?>)
20
+					(<?php echo esc_html( sprintf( __( 'Maximum size: %s', 'formidable' ), ini_get( 'upload_max_filesize' ) ) ) ?>)
21 21
 				</label>
22 22
 				<input type="file" name="frm_import_file" size="25" />
23 23
 			</p>
Please login to merge, or discard this patch.
classes/views/styles/manage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 						?>
34 34
 				<tr id="menu-locations-row">
35 35
 					<td class="menu-location-title">
36
-						<strong><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : $form->name ) ?></strong>
36
+						<strong><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : $form->name ) ?></strong>
37 37
 					</td>
38 38
 					<td class="menu-location-menus">
39 39
 					    <input type="hidden" name="prev_style[<?php echo esc_attr( $form->id ) ?>]" value="<?php echo esc_attr( $this_style ) ?>" />
Please login to merge, or discard this patch.
classes/controllers/FrmXMLController.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -361,14 +361,14 @@
 block discarded – undo
361 361
 	}
362 362
 
363 363
 	/**
364
-	* Get the fields that should be included in the CSV export
365
-	*
366
-	* @since 2.0.19
367
-	*
368
-	* @param int $form_id
369
-	* @param object $form
370
-	* @return array $csv_fields
371
-	*/
364
+	 * Get the fields that should be included in the CSV export
365
+	 *
366
+	 * @since 2.0.19
367
+	 *
368
+	 * @param int $form_id
369
+	 * @param object $form
370
+	 * @return array $csv_fields
371
+	 */
372 372
 	private static function get_fields_for_csv_export( $form_id, $form ) {
373 373
 		// Phase frm_csv_field_ids out by 2.01.05
374 374
 		$csv_field_ids = apply_filters( 'frm_csv_field_ids', '', $form_id, array(
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		) );
111 111
 
112 112
 		$file_type = strtolower( pathinfo( $_FILES['frm_import_file']['name'], PATHINFO_EXTENSION ) );
113
-		if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) {
113
+		if ( 'xml' !== $file_type && isset( $export_format[$file_type] ) ) {
114 114
 			// allow other file types to be imported
115 115
 			do_action( 'frm_before_import_' . $file_type );
116 116
 			return;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		foreach ( $type as $tb_type ) {
203 203
 			$where = array();
204 204
 			$join = '';
205
-			$table = $tables[ $tb_type ];
205
+			$table = $tables[$tb_type];
206 206
 
207 207
 			$select = $table . '.id';
208 208
 			$query_vars = array();
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 							$table . '.parent_form_id' => $args['ids'],
218 218
 						);
219 219
 					} else {
220
-						$where[ $table . '.status !' ] = 'draft';
220
+						$where[$table . '.status !'] = 'draft';
221 221
 					}
222 222
 				break;
223 223
 				case 'actions':
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 				case 'items':
231 231
 					//$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
232 232
 					if ( $args['ids'] ) {
233
-						$where[ $table . '.form_id' ] = $args['ids'];
233
+						$where[$table . '.form_id'] = $args['ids'];
234 234
 					}
235 235
 				break;
236 236
 				case 'styles':
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 				break;
273 273
 			}
274 274
 
275
-			$records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select );
275
+			$records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select );
276 276
 			unset( $tb_type );
277 277
 		}
278 278
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 			$no_export_fields = FrmField::no_save_fields();
399 399
 			foreach ( $csv_fields as $k => $f ) {
400 400
 				if ( in_array( $f->type, $no_export_fields, true ) ) {
401
-					unset( $csv_fields[ $k ] );
401
+					unset( $csv_fields[$k] );
402 402
 				}
403 403
 			}
404 404
 		}
Please login to merge, or discard this patch.
classes/helpers/FrmCSVExportHelper.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -336,7 +336,7 @@
 block discarded – undo
336 336
 		}
337 337
 
338 338
 		return self::escape_csv( $line );
339
-    }
339
+	}
340 340
 
341 341
 	/**
342 342
 	 * Escape a " in a csv with another "
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 		foreach ( self::$fields as $col ) {
105 105
 			$field_headings = array();
106 106
 			if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, array( 'user_id', 'file', 'data', 'date' ), true ) ) {
107
-				$field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
107
+				$field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
108 108
 			}
109 109
 
110
-			$field_headings[ $col->id ] = strip_tags( $col->name );
110
+			$field_headings[$col->id] = strip_tags( $col->name );
111 111
 			$field_headings = apply_filters( 'frm_csv_field_columns', $field_headings, array(
112 112
 				'field' => $col,
113 113
 			) );
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 		}
116 116
 
117 117
 		if ( self::$comment_count ) {
118
-			for ( $i = 0; $i < self::$comment_count; $i++ ) {
119
-				$headings[ 'comment' . $i ] = __( 'Comment', 'formidable' );
120
-				$headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' );
121
-				$headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' );
118
+			for ( $i = 0; $i < self::$comment_count; $i ++ ) {
119
+				$headings['comment' . $i] = __( 'Comment', 'formidable' );
120
+				$headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' );
121
+				$headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' );
122 122
 			}
123 123
 			unset( $i );
124 124
 		}
@@ -176,30 +176,30 @@  discard block
 block discarded – undo
176 176
 					continue;
177 177
 				}
178 178
 
179
-				if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) {
180
-					$entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array();
181
-				} elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) {
179
+				if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) {
180
+					$entries[self::$entry->parent_item_id]->metas[$meta_id] = array();
181
+				} elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) {
182 182
 					// if the data is here, it should be an array but if this field has collected data
183 183
 					// both while inside and outside of the repeating section, it's possible this is a string
184
-					$entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ];
184
+					$entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id];
185 185
 				}
186 186
 
187 187
 				//add the repeated values
188
-				$entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value;
188
+				$entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value;
189 189
 			}
190
-			$entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas;
190
+			$entries[self::$entry->parent_item_id]->metas += self::$entry->metas;
191 191
 		}
192 192
 
193 193
 		// add the embedded form id
194
-		if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) {
195
-			$entries[ self::$entry->parent_item_id ]->embedded_fields = array();
194
+		if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) {
195
+			$entries[self::$entry->parent_item_id]->embedded_fields = array();
196 196
 		}
197
-		$entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id;
197
+		$entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id;
198 198
 	}
199 199
 
200 200
 	private static function add_field_values_to_csv( &$row ) {
201 201
 		foreach ( self::$fields as $col ) {
202
-			$field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false;
202
+			$field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false;
203 203
 
204 204
 			$field_value = maybe_unserialize( $field_value );
205 205
 			self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) );
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
 					'show_icon' => false,
218 218
 					'entry_id'  => self::$entry->id,
219 219
 					'sep'       => self::$separator,
220
-					'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0,
220
+					'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0,
221 221
 				) );
222
-				$row[ $col->id . '_label' ] = $sep_value;
222
+				$row[$col->id . '_label'] = $sep_value;
223 223
 				unset( $sep_value );
224 224
 			}
225 225
 
226
-			$row[ $col->id ] = $field_value;
226
+			$row[$col->id] = $field_value;
227 227
 
228 228
 			unset( $col, $field_value );
229 229
 		}
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 		if ( is_array( $atts['field_value'] ) ) {
237 237
 			foreach ( $atts['field_value'] as $key => $sub_value ) {
238 238
 				$column_key = $atts['col']->id . '_' . $key;
239
-				if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) {
240
-					$row[ $column_key ] = $sub_value;
239
+				if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) {
240
+					$row[$column_key] = $sub_value;
241 241
 				}
242 242
 			}
243 243
 		}
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 		$sep = '';
259 259
 
260 260
 		foreach ( self::$headings as $k => $heading ) {
261
-			$row = isset( $rows[ $k ] ) ? $rows[ $k ] : '';
261
+			$row = isset( $rows[$k] ) ? $rows[$k] : '';
262 262
 			if ( is_array( $row ) ) {
263 263
 				// implode the repeated field values
264 264
 				$row = implode( self::$separator, FrmAppHelper::array_flatten( $row, 'reset' ) );
Please login to merge, or discard this patch.
classes/helpers/FrmAppHelper.php 2 patches
Indentation   +877 added lines, -877 removed lines patch added patch discarded remove patch
@@ -12,50 +12,50 @@  discard block
 block discarded – undo
12 12
 	 */
13 13
 	public static $plug_version = '2.05.07';
14 14
 
15
-    /**
16
-     * @since 1.07.02
17
-     *
18
-     * @param none
19
-     * @return string The version of this plugin
20
-     */
21
-    public static function plugin_version() {
22
-        return self::$plug_version;
23
-    }
24
-
25
-    public static function plugin_folder() {
26
-        return basename(self::plugin_path());
27
-    }
28
-
29
-    public static function plugin_path() {
30
-        return dirname(dirname(dirname(__FILE__)));
31
-    }
32
-
33
-    public static function plugin_url() {
34
-        //prevously FRM_URL constant
15
+	/**
16
+	 * @since 1.07.02
17
+	 *
18
+	 * @param none
19
+	 * @return string The version of this plugin
20
+	 */
21
+	public static function plugin_version() {
22
+		return self::$plug_version;
23
+	}
24
+
25
+	public static function plugin_folder() {
26
+		return basename(self::plugin_path());
27
+	}
28
+
29
+	public static function plugin_path() {
30
+		return dirname(dirname(dirname(__FILE__)));
31
+	}
32
+
33
+	public static function plugin_url() {
34
+		//prevously FRM_URL constant
35 35
 		return plugins_url( '', self::plugin_path() . '/formidable.php' );
36
-    }
36
+	}
37 37
 
38 38
 	public static function relative_plugin_url() {
39 39
 		return str_replace( array( 'https:', 'http:' ), '', self::plugin_url() );
40 40
 	}
41 41
 
42
-    /**
43
-     * @return string Site URL
44
-     */
45
-    public static function site_url() {
46
-        return site_url();
47
-    }
48
-
49
-    /**
50
-     * Get the name of this site
51
-     * Used for [sitename] shortcode
52
-     *
53
-     * @since 2.0
54
-     * @return string
55
-     */
56
-    public static function site_name() {
57
-        return get_option('blogname');
58
-    }
42
+	/**
43
+	 * @return string Site URL
44
+	 */
45
+	public static function site_url() {
46
+		return site_url();
47
+	}
48
+
49
+	/**
50
+	 * Get the name of this site
51
+	 * Used for [sitename] shortcode
52
+	 *
53
+	 * @since 2.0
54
+	 * @return string
55
+	 */
56
+	public static function site_name() {
57
+		return get_option('blogname');
58
+	}
59 59
 
60 60
 	public static function make_affiliate_url( $url ) {
61 61
 		$affiliate_id = self::get_affiliate();
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
 		return absint( apply_filters( 'frm_affiliate_id', 0 ) );
71 71
 	}
72 72
 
73
-    /**
74
-     * Get the Formidable settings
75
-     *
76
-     * @since 2.0
77
-     *
78
-     * @param None
79
-     * @return FrmSettings $frm_setings
80
-     */
81
-    public static function get_settings() {
82
-        global $frm_settings;
83
-        if ( empty($frm_settings) ) {
84
-            $frm_settings = new FrmSettings();
85
-        }
86
-        return $frm_settings;
87
-    }
73
+	/**
74
+	 * Get the Formidable settings
75
+	 *
76
+	 * @since 2.0
77
+	 *
78
+	 * @param None
79
+	 * @return FrmSettings $frm_setings
80
+	 */
81
+	public static function get_settings() {
82
+		global $frm_settings;
83
+		if ( empty($frm_settings) ) {
84
+			$frm_settings = new FrmSettings();
85
+		}
86
+		return $frm_settings;
87
+	}
88 88
 
89 89
 	public static function get_menu_name() {
90 90
 		$frm_settings = FrmAppHelper::get_settings();
@@ -99,62 +99,62 @@  discard block
 block discarded – undo
99 99
 		return ! $frm_settings->no_ips;
100 100
 	}
101 101
 
102
-    /**
103
-     * Show a message in place of pro features
104
-     *
105
-     * @since 2.0
106
-     */
102
+	/**
103
+	 * Show a message in place of pro features
104
+	 *
105
+	 * @since 2.0
106
+	 */
107 107
 	public static function update_message() {
108 108
 		_deprecated_function( __FUNCTION__, '2.0.19' );
109
-    }
110
-
111
-    public static function pro_is_installed() {
112
-        return apply_filters('frm_pro_installed', false);
113
-    }
114
-
115
-    /**
116
-     * Check for certain page in Formidable settings
117
-     *
118
-     * @since 2.0
119
-     *
120
-     * @param string $page The name of the page to check
121
-     * @return boolean
122
-     */
109
+	}
110
+
111
+	public static function pro_is_installed() {
112
+		return apply_filters('frm_pro_installed', false);
113
+	}
114
+
115
+	/**
116
+	 * Check for certain page in Formidable settings
117
+	 *
118
+	 * @since 2.0
119
+	 *
120
+	 * @param string $page The name of the page to check
121
+	 * @return boolean
122
+	 */
123 123
 	public static function is_admin_page( $page = 'formidable' ) {
124
-        global $pagenow;
124
+		global $pagenow;
125 125
 		$get_page = self::simple_get( 'page', 'sanitize_title' );
126
-        if ( $pagenow ) {
126
+		if ( $pagenow ) {
127 127
 			return $pagenow == 'admin.php' && $get_page == $page;
128
-        }
128
+		}
129 129
 
130 130
 		return is_admin() && $get_page == $page;
131
-    }
132
-
133
-    /**
134
-     * Check for the form preview page
135
-     *
136
-     * @since 2.0
137
-     *
138
-     * @param None
139
-     * @return boolean
140
-     */
141
-    public static function is_preview_page() {
142
-        global $pagenow;
131
+	}
132
+
133
+	/**
134
+	 * Check for the form preview page
135
+	 *
136
+	 * @since 2.0
137
+	 *
138
+	 * @param None
139
+	 * @return boolean
140
+	 */
141
+	public static function is_preview_page() {
142
+		global $pagenow;
143 143
 		$action = FrmAppHelper::simple_get( 'action', 'sanitize_title' );
144 144
 		return $pagenow && $pagenow == 'admin-ajax.php' && $action == 'frm_forms_preview';
145
-    }
145
+	}
146 146
 
147
-    /**
148
-     * Check for ajax except the form preview page
149
-     *
150
-     * @since 2.0
151
-     *
152
-     * @param None
153
-     * @return boolean
154
-     */
155
-    public static function doing_ajax() {
156
-        return self::wp_doing_ajax() && ! self::is_preview_page();
157
-    }
147
+	/**
148
+	 * Check for ajax except the form preview page
149
+	 *
150
+	 * @since 2.0
151
+	 *
152
+	 * @param None
153
+	 * @return boolean
154
+	 */
155
+	public static function doing_ajax() {
156
+		return self::wp_doing_ajax() && ! self::is_preview_page();
157
+	}
158 158
 
159 159
 	/**
160 160
 	 * Use the WP 4.7 wp_doing_ajax function
@@ -177,102 +177,102 @@  discard block
 block discarded – undo
177 177
 		return isset( $frm_vars['prevent_caching'] ) && $frm_vars['prevent_caching'];
178 178
 	}
179 179
 
180
-    /**
181
-     * Check if on an admin page
182
-     *
183
-     * @since 2.0
184
-     *
185
-     * @param None
186
-     * @return boolean
187
-     */
188
-    public static function is_admin() {
189
-        return is_admin() && ! self::wp_doing_ajax();
190
-    }
191
-
192
-    /**
193
-     * Check if value contains blank value or empty array
194
-     *
195
-     * @since 2.0
196
-     * @param mixed $value - value to check
180
+	/**
181
+	 * Check if on an admin page
182
+	 *
183
+	 * @since 2.0
184
+	 *
185
+	 * @param None
186
+	 * @return boolean
187
+	 */
188
+	public static function is_admin() {
189
+		return is_admin() && ! self::wp_doing_ajax();
190
+	}
191
+
192
+	/**
193
+	 * Check if value contains blank value or empty array
194
+	 *
195
+	 * @since 2.0
196
+	 * @param mixed $value - value to check
197 197
 	 * @param string
198
-     * @return boolean
199
-     */
200
-    public static function is_empty_value( $value, $empty = '' ) {
201
-        return ( is_array( $value ) && empty( $value ) ) || $value == $empty;
202
-    }
203
-
204
-    public static function is_not_empty_value( $value, $empty = '' ) {
205
-        return ! self::is_empty_value( $value, $empty );
206
-    }
207
-
208
-    /**
209
-     * Get any value from the $_SERVER
210
-     *
211
-     * @since 2.0
212
-     * @param string $value
213
-     * @return string
214
-     */
198
+	 * @return boolean
199
+	 */
200
+	public static function is_empty_value( $value, $empty = '' ) {
201
+		return ( is_array( $value ) && empty( $value ) ) || $value == $empty;
202
+	}
203
+
204
+	public static function is_not_empty_value( $value, $empty = '' ) {
205
+		return ! self::is_empty_value( $value, $empty );
206
+	}
207
+
208
+	/**
209
+	 * Get any value from the $_SERVER
210
+	 *
211
+	 * @since 2.0
212
+	 * @param string $value
213
+	 * @return string
214
+	 */
215 215
 	public static function get_server_value( $value ) {
216
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
217
-    }
218
-
219
-    /**
220
-     * Check for the IP address in several places
221
-     * Used by [ip] shortcode
222
-     *
223
-     * @return string The IP address of the current user
224
-     */
225
-    public static function get_ip_address() {
216
+		return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
217
+	}
218
+
219
+	/**
220
+	 * Check for the IP address in several places
221
+	 * Used by [ip] shortcode
222
+	 *
223
+	 * @return string The IP address of the current user
224
+	 */
225
+	public static function get_ip_address() {
226 226
 		$ip = '';
227
-        foreach ( array(
228
-            'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
229
-            'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
230
-        ) as $key ) {
231
-            if ( ! isset( $_SERVER[ $key ] ) ) {
232
-                continue;
233
-            }
234
-
235
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
236
-                $ip = trim($ip); // just to be safe
237
-
238
-                if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
239
-                    return sanitize_text_field( $ip );
240
-                }
241
-            }
242
-        }
227
+		foreach ( array(
228
+			'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
229
+			'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
230
+		) as $key ) {
231
+			if ( ! isset( $_SERVER[ $key ] ) ) {
232
+				continue;
233
+			}
234
+
235
+			foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
236
+				$ip = trim($ip); // just to be safe
237
+
238
+				if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
239
+					return sanitize_text_field( $ip );
240
+				}
241
+			}
242
+		}
243 243
 
244 244
 		return sanitize_text_field( $ip );
245
-    }
245
+	}
246 246
 
247
-    public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
248
-        if ( strpos($param, '[') ) {
249
-            $params = explode('[', $param);
250
-            $param = $params[0];
251
-        }
247
+	public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
248
+		if ( strpos($param, '[') ) {
249
+			$params = explode('[', $param);
250
+			$param = $params[0];
251
+		}
252 252
 
253 253
 		if ( $src == 'get' ) {
254
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
255
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
256
-                $value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
257
-            }
254
+			$value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
255
+			if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
256
+				$value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
257
+			}
258 258
 			self::sanitize_value( $sanitize, $value );
259 259
 		} else {
260
-            $value = self::get_simple_request( array( 'type' => $src, 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
261
-        }
260
+			$value = self::get_simple_request( array( 'type' => $src, 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
261
+		}
262 262
 
263 263
 		if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
264
-            foreach ( $params as $k => $p ) {
265
-                if ( ! $k || ! is_array($value) ) {
266
-                    continue;
267
-                }
264
+			foreach ( $params as $k => $p ) {
265
+				if ( ! $k || ! is_array($value) ) {
266
+					continue;
267
+				}
268 268
 
269
-                $p = trim($p, ']');
270
-                $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
271
-            }
272
-        }
269
+				$p = trim($p, ']');
270
+				$value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
271
+			}
272
+		}
273 273
 
274
-        return $value;
275
-    }
274
+		return $value;
275
+	}
276 276
 
277 277
 	public static function get_post_param( $param, $default = '', $sanitize = '' ) {
278 278
 		return self::get_simple_request( array( 'type' => 'post', 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	 */
289 289
 	public static function simple_get( $param, $sanitize = 'sanitize_text_field', $default = '' ) {
290 290
 		return self::get_simple_request( array( 'type' => 'get', 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
291
-    }
291
+	}
292 292
 
293 293
 	/**
294 294
 	 * Get a GET/POST/REQUEST value and sanitize it
@@ -324,12 +324,12 @@  discard block
 block discarded – undo
324 324
 	}
325 325
 
326 326
 	/**
327
-	* Preserve backslashes in a value, but make sure value doesn't get compounding slashes
328
-	*
329
-	* @since 2.0.8
330
-	* @param string $value
331
-	* @return string $value
332
-	*/
327
+	 * Preserve backslashes in a value, but make sure value doesn't get compounding slashes
328
+	 *
329
+	 * @since 2.0.8
330
+	 * @param string $value
331
+	 * @return string $value
332
+	 */
333 333
 	public static function preserve_backslashes( $value ) {
334 334
 		// If backslashes have already been added, don't add them again
335 335
 		if ( strpos( $value, '\\\\' ) === false ) {
@@ -351,14 +351,14 @@  discard block
 block discarded – undo
351 351
 		}
352 352
 	}
353 353
 
354
-    public static function sanitize_request( $sanitize_method, &$values ) {
355
-        $temp_values = $values;
356
-        foreach ( $temp_values as $k => $val ) {
357
-            if ( isset( $sanitize_method[ $k ] ) ) {
354
+	public static function sanitize_request( $sanitize_method, &$values ) {
355
+		$temp_values = $values;
356
+		foreach ( $temp_values as $k => $val ) {
357
+			if ( isset( $sanitize_method[ $k ] ) ) {
358 358
 				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
359
-            }
360
-        }
361
-    }
359
+			}
360
+		}
361
+	}
362 362
 
363 363
 	public static function sanitize_array( &$values ) {
364 364
 		$temp_values = $values;
@@ -482,80 +482,80 @@  discard block
 block discarded – undo
482 482
 		);
483 483
 	}
484 484
 
485
-    /**
486
-     * Used when switching the action for a bulk action
487
-     * @since 2.0
488
-     */
489
-    public static function remove_get_action() {
490
-        if ( ! isset($_GET) ) {
491
-            return;
492
-        }
485
+	/**
486
+	 * Used when switching the action for a bulk action
487
+	 * @since 2.0
488
+	 */
489
+	public static function remove_get_action() {
490
+		if ( ! isset($_GET) ) {
491
+			return;
492
+		}
493 493
 
494
-        $new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
495
-        if ( ! empty( $new_action ) ) {
494
+		$new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
495
+		if ( ! empty( $new_action ) ) {
496 496
 			$_SERVER['REQUEST_URI'] = str_replace( '&action=' . $new_action, '', FrmAppHelper::get_server_value( 'REQUEST_URI' ) );
497
-        }
498
-    }
499
-
500
-    /**
501
-     * Check the WP query for a parameter
502
-     *
503
-     * @since 2.0
504
-     * @return string|array
505
-     */
506
-    public static function get_query_var( $value, $param ) {
507
-        if ( $value != '' ) {
508
-            return $value;
509
-        }
510
-
511
-        global $wp_query;
512
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
513
-            $value = $wp_query->query_vars[ $param ];
514
-        }
515
-
516
-        return $value;
517
-    }
518
-
519
-    /**
520
-     * @param string $type
521
-     */
522
-    public static function trigger_hook_load( $type, $object = null ) {
523
-        // only load the form hooks once
497
+		}
498
+	}
499
+
500
+	/**
501
+	 * Check the WP query for a parameter
502
+	 *
503
+	 * @since 2.0
504
+	 * @return string|array
505
+	 */
506
+	public static function get_query_var( $value, $param ) {
507
+		if ( $value != '' ) {
508
+			return $value;
509
+		}
510
+
511
+		global $wp_query;
512
+		if ( isset( $wp_query->query_vars[ $param ] ) ) {
513
+			$value = $wp_query->query_vars[ $param ];
514
+		}
515
+
516
+		return $value;
517
+	}
518
+
519
+	/**
520
+	 * @param string $type
521
+	 */
522
+	public static function trigger_hook_load( $type, $object = null ) {
523
+		// only load the form hooks once
524 524
 		$hooks_loaded = apply_filters( 'frm_' . $type . '_hooks_loaded', false, $object );
525
-        if ( ! $hooks_loaded ) {
525
+		if ( ! $hooks_loaded ) {
526 526
 			do_action( 'frm_load_' . $type . '_hooks' );
527
-        }
528
-    }
529
-
530
-    /**
531
-     * Check a value from a shortcode to see if true or false.
532
-     * True when value is 1, true, 'true', 'yes'
533
-     *
534
-     * @since 1.07.10
535
-     *
536
-     * @param string $value The value to compare
537
-     * @return boolean True or False
538
-     */
527
+		}
528
+	}
529
+
530
+	/**
531
+	 * Check a value from a shortcode to see if true or false.
532
+	 * True when value is 1, true, 'true', 'yes'
533
+	 *
534
+	 * @since 1.07.10
535
+	 *
536
+	 * @param string $value The value to compare
537
+	 * @return boolean True or False
538
+	 */
539 539
 	public static function is_true( $value ) {
540
-        return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
541
-    }
540
+		return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
541
+	}
542 542
 
543
-    /**
544
-     * Used to filter shortcode in text widgets
545
-     */
546
-    public static function widget_text_filter_callback( $matches ) {
543
+	/**
544
+	 * Used to filter shortcode in text widgets
545
+	 */
546
+	public static function widget_text_filter_callback( $matches ) {
547 547
 		_deprecated_function( __METHOD__, '2.5.4' );
548
-        return do_shortcode( $matches[0] );
549
-    }
548
+		return do_shortcode( $matches[0] );
549
+	}
550 550
 
551
-    public static function get_pages() {
551
+	public static function get_pages() {
552 552
 		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
553
-    }
553
+	}
554 554
 
555
-    public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
556
-        $pages = self::get_pages();
555
+	public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
556
+		$pages = self::get_pages();
557 557
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
558
-    ?>
558
+	?>
559 559
         <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
560 560
             <option value=""> </option>
561 561
             <?php foreach ( $pages as $page ) { ?>
@@ -565,108 +565,108 @@  discard block
 block discarded – undo
565 565
             <?php } ?>
566 566
         </select>
567 567
     <?php
568
-    }
568
+	}
569 569
 
570 570
 	public static function post_edit_link( $post_id ) {
571
-        $post = get_post($post_id);
572
-        if ( $post ) {
571
+		$post = get_post($post_id);
572
+		if ( $post ) {
573 573
 			$post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
574 574
 			return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
575
-        }
576
-        return '';
577
-    }
575
+		}
576
+		return '';
577
+	}
578 578
 
579 579
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
580
-    ?>
580
+	?>
581 581
         <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" <?php
582
-            echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
583
-            ?> class="frm_multiselect">
582
+			echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
583
+			?> class="frm_multiselect">
584 584
             <?php self::roles_options($capability); ?>
585 585
         </select>
586 586
     <?php
587
-    }
587
+	}
588 588
 
589 589
 	public static function roles_options( $capability ) {
590
-        global $frm_vars;
591
-        if ( isset($frm_vars['editable_roles']) ) {
592
-            $editable_roles = $frm_vars['editable_roles'];
593
-        } else {
594
-            $editable_roles = get_editable_roles();
595
-            $frm_vars['editable_roles'] = $editable_roles;
596
-        }
597
-
598
-        foreach ( $editable_roles as $role => $details ) {
599
-            $name = translate_user_role($details['name'] ); ?>
590
+		global $frm_vars;
591
+		if ( isset($frm_vars['editable_roles']) ) {
592
+			$editable_roles = $frm_vars['editable_roles'];
593
+		} else {
594
+			$editable_roles = get_editable_roles();
595
+			$frm_vars['editable_roles'] = $editable_roles;
596
+		}
597
+
598
+		foreach ( $editable_roles as $role => $details ) {
599
+			$name = translate_user_role($details['name'] ); ?>
600 600
         <option value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, (array) $capability) ? ' selected="selected"' : ''; ?>><?php echo esc_attr($name) ?> </option>
601 601
 <?php
602
-            unset($role, $details);
603
-        }
604
-    }
602
+			unset($role, $details);
603
+		}
604
+	}
605 605
 
606 606
 	public static function frm_capabilities( $type = 'auto' ) {
607
-        $cap = array(
608
-            'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
609
-            'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
610
-            'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
611
-            'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
612
-            'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
613
-            'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
614
-        );
607
+		$cap = array(
608
+			'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
609
+			'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
610
+			'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
611
+			'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
612
+			'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
613
+			'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
614
+		);
615 615
 
616 616
 		if ( ! self::pro_is_installed() && 'pro' != $type ) {
617
-            return $cap;
618
-        }
617
+			return $cap;
618
+		}
619 619
 
620
-        $cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
621
-        $cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
622
-        $cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
623
-        $cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
620
+		$cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
621
+		$cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
622
+		$cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
623
+		$cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
624 624
 
625
-        return $cap;
626
-    }
625
+		return $cap;
626
+	}
627 627
 
628 628
 	public static function user_has_permission( $needed_role ) {
629
-        if ( $needed_role == '-1' ) {
630
-            return false;
629
+		if ( $needed_role == '-1' ) {
630
+			return false;
631 631
 		}
632 632
 
633
-        // $needed_role will be equal to blank if "Logged-in users" is selected
634
-        if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
635
-            return true;
636
-        }
633
+		// $needed_role will be equal to blank if "Logged-in users" is selected
634
+		if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
635
+			return true;
636
+		}
637 637
 
638
-        $roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
639
-        foreach ( $roles as $role ) {
638
+		$roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
639
+		foreach ( $roles as $role ) {
640 640
 			if ( current_user_can( $role ) ) {
641
-        		return true;
641
+				return true;
642 642
 			}
643
-        	if ( $role == $needed_role ) {
644
-        		break;
643
+			if ( $role == $needed_role ) {
644
+				break;
645 645
 			}
646
-        }
647
-        return false;
648
-    }
649
-
650
-    /**
651
-     * Make sure administrators can see Formidable menu
652
-     *
653
-     * @since 2.0
654
-     */
655
-    public static function maybe_add_permissions() {
646
+		}
647
+		return false;
648
+	}
649
+
650
+	/**
651
+	 * Make sure administrators can see Formidable menu
652
+	 *
653
+	 * @since 2.0
654
+	 */
655
+	public static function maybe_add_permissions() {
656 656
 		self::force_capability( 'frm_view_entries' );
657 657
 
658
-        if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
659
-            return;
660
-        }
658
+		if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
659
+			return;
660
+		}
661 661
 
662 662
 		$user_id = get_current_user_id();
663 663
 		$user = new WP_User( $user_id );
664
-        $frm_roles = self::frm_capabilities();
665
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
664
+		$frm_roles = self::frm_capabilities();
665
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
666 666
 			$user->add_cap( $frm_role );
667
-            unset($frm_role, $frm_role_description);
668
-        }
669
-    }
667
+			unset($frm_role, $frm_role_description);
668
+		}
669
+	}
670 670
 
671 671
 	/**
672 672
 	 * Make sure admins have permission to see the menu items
@@ -682,28 +682,28 @@  discard block
 block discarded – undo
682 682
 		}
683 683
 	}
684 684
 
685
-    /**
686
-     * Check if the user has permision for action.
687
-     * Return permission message and stop the action if no permission
688
-     * @since 2.0
689
-     * @param string $permission
690
-     */
685
+	/**
686
+	 * Check if the user has permision for action.
687
+	 * Return permission message and stop the action if no permission
688
+	 * @since 2.0
689
+	 * @param string $permission
690
+	 */
691 691
 	public static function permission_check( $permission, $show_message = 'show' ) {
692
-        $permission_error = self::permission_nonce_error($permission);
693
-        if ( $permission_error !== false ) {
694
-            if ( 'hide' == $show_message ) {
695
-                $permission_error = '';
696
-            }
697
-            wp_die($permission_error);
698
-        }
699
-    }
700
-
701
-    /**
702
-     * Check user permission and nonce
703
-     * @since 2.0
704
-     * @param string $permission
705
-     * @return false|string The permission message or false if allowed
706
-     */
692
+		$permission_error = self::permission_nonce_error($permission);
693
+		if ( $permission_error !== false ) {
694
+			if ( 'hide' == $show_message ) {
695
+				$permission_error = '';
696
+			}
697
+			wp_die($permission_error);
698
+		}
699
+	}
700
+
701
+	/**
702
+	 * Check user permission and nonce
703
+	 * @since 2.0
704
+	 * @param string $permission
705
+	 * @return false|string The permission message or false if allowed
706
+	 */
707 707
 	public static function permission_nonce_error( $permission, $nonce_name = '', $nonce = '' ) {
708 708
 		if ( ! empty( $permission ) && ! current_user_can( $permission ) && ! current_user_can( 'administrator' ) ) {
709 709
 			$frm_settings = self::get_settings();
@@ -711,23 +711,23 @@  discard block
 block discarded – undo
711 711
 		}
712 712
 
713 713
 		$error = false;
714
-        if ( empty($nonce_name) ) {
715
-            return $error;
716
-        }
714
+		if ( empty($nonce_name) ) {
715
+			return $error;
716
+		}
717 717
 
718
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
719
-            $frm_settings = self::get_settings();
720
-            $error = $frm_settings->admin_permission;
721
-        }
718
+		if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
719
+			$frm_settings = self::get_settings();
720
+			$error = $frm_settings->admin_permission;
721
+		}
722 722
 
723
-        return $error;
724
-    }
723
+		return $error;
724
+	}
725 725
 
726
-    public static function checked( $values, $current ) {
726
+	public static function checked( $values, $current ) {
727 727
 		if ( self::check_selected( $values, $current ) ) {
728
-            echo ' checked="checked"';
728
+			echo ' checked="checked"';
729 729
 		}
730
-    }
730
+	}
731 731
 
732 732
 	public static function check_selected( $values, $current ) {
733 733
 		$values = self::recursive_function_map( $values, 'trim' );
@@ -737,50 +737,50 @@  discard block
 block discarded – undo
737 737
 		return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current );
738 738
 	}
739 739
 
740
-    /**
741
-    * Check if current field option is an "other" option
742
-    *
743
-    * @since 2.0
744
-    *
745
-    * @param string $opt_key
746
-    * @return boolean Returns true if current field option is an "Other" option
747
-    */
748
-    public static function is_other_opt( $opt_key ) {
749
-        _deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::is_other_opt' );
750
-        return FrmFieldsHelper::is_other_opt( $opt_key );
751
-    }
752
-
753
-    /**
754
-    * Get value that belongs in "Other" text box
755
-    *
756
-    * @since 2.0
757
-    *
758
-    * @param string $opt_key
759
-    * @param array $field
760
-    * @return string $other_val
761
-    */
762
-    public static function get_other_val( $opt_key, $field, $parent = false, $pointer = false ) {
740
+	/**
741
+	 * Check if current field option is an "other" option
742
+	 *
743
+	 * @since 2.0
744
+	 *
745
+	 * @param string $opt_key
746
+	 * @return boolean Returns true if current field option is an "Other" option
747
+	 */
748
+	public static function is_other_opt( $opt_key ) {
749
+		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::is_other_opt' );
750
+		return FrmFieldsHelper::is_other_opt( $opt_key );
751
+	}
752
+
753
+	/**
754
+	 * Get value that belongs in "Other" text box
755
+	 *
756
+	 * @since 2.0
757
+	 *
758
+	 * @param string $opt_key
759
+	 * @param array $field
760
+	 * @return string $other_val
761
+	 */
762
+	public static function get_other_val( $opt_key, $field, $parent = false, $pointer = false ) {
763 763
 		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::get_other_val' );
764 764
 		return FrmFieldsHelper::get_other_val( compact( 'opt_key', 'field', 'parent', 'pointer' ) );
765
-    }
766
-
767
-    /**
768
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
769
-    * Intended for front-end use
770
-    *
771
-    * @since 2.0
772
-    *
773
-    * @param array $field
774
-    * @param boolean $other_opt
775
-    * @param string $checked
776
-    * @param array $args should include opt_key and field name
777
-    * @return string $other_val
778
-    */
779
-    public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
765
+	}
766
+
767
+	/**
768
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
769
+	 * Intended for front-end use
770
+	 *
771
+	 * @since 2.0
772
+	 *
773
+	 * @param array $field
774
+	 * @param boolean $other_opt
775
+	 * @param string $checked
776
+	 * @param array $args should include opt_key and field name
777
+	 * @return string $other_val
778
+	 */
779
+	public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
780 780
 		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::prepare_other_input' );
781 781
 		$args['field'] = $field;
782 782
 		return FrmFieldsHelper::prepare_other_input( $args, $other_opt, $checked );
783
-    }
783
+	}
784 784
 
785 785
 	public static function recursive_function_map( $value, $function ) {
786 786
 		if ( is_array( $value ) ) {
@@ -810,24 +810,24 @@  discard block
 block discarded – undo
810 810
 		return (bool) count( array_filter( array_keys( $array ), 'is_string' ) );
811 811
 	}
812 812
 
813
-    /**
814
-     * Flatten a multi-dimensional array
815
-     */
813
+	/**
814
+	 * Flatten a multi-dimensional array
815
+	 */
816 816
 	public static function array_flatten( $array, $keys = 'keep' ) {
817
-        $return = array();
818
-        foreach ( $array as $key => $value ) {
819
-            if ( is_array($value) ) {
817
+		$return = array();
818
+		foreach ( $array as $key => $value ) {
819
+			if ( is_array($value) ) {
820 820
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
821
-            } else {
821
+			} else {
822 822
 				if ( $keys == 'keep' ) {
823 823
 					$return[ $key ] = $value;
824 824
 				} else {
825 825
 					$return[] = $value;
826 826
 				}
827
-            }
828
-        }
829
-        return $return;
830
-    }
827
+			}
828
+		}
829
+		return $return;
830
+	}
831 831
 
832 832
 	public static function esc_textarea( $text, $is_rich_text = false ) {
833 833
 		$safe_text = str_replace( '&quot;', '"', $text );
@@ -838,38 +838,38 @@  discard block
 block discarded – undo
838 838
 		return apply_filters( 'esc_textarea', $safe_text, $text );
839 839
 	}
840 840
 
841
-    /**
842
-     * Add auto paragraphs to text areas
843
-     * @since 2.0
844
-     */
841
+	/**
842
+	 * Add auto paragraphs to text areas
843
+	 * @since 2.0
844
+	 */
845 845
 	public static function use_wpautop( $content ) {
846
-        if ( apply_filters('frm_use_wpautop', true) ) {
847
-            $content = wpautop(str_replace( '<br>', '<br />', $content));
848
-        }
849
-        return $content;
850
-    }
846
+		if ( apply_filters('frm_use_wpautop', true) ) {
847
+			$content = wpautop(str_replace( '<br>', '<br />', $content));
848
+		}
849
+		return $content;
850
+	}
851 851
 
852 852
 	public static function replace_quotes( $val ) {
853
-        //Replace double quotes
853
+		//Replace double quotes
854 854
 		$val = str_replace( array( '&#8220;', '&#8221;', '&#8243;' ), '"', $val );
855
-        //Replace single quotes
856
-        $val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
857
-        return $val;
858
-    }
859
-
860
-    /**
861
-     * @since 2.0
862
-     * @return string The base Google APIS url for the current version of jQuery UI
863
-     */
864
-    public static function jquery_ui_base_url() {
855
+		//Replace single quotes
856
+		$val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
857
+		return $val;
858
+	}
859
+
860
+	/**
861
+	 * @since 2.0
862
+	 * @return string The base Google APIS url for the current version of jQuery UI
863
+	 */
864
+	public static function jquery_ui_base_url() {
865 865
 		$url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core', '1.11.4' );
866
-        $url = apply_filters('frm_jquery_ui_base_url', $url);
867
-        return $url;
868
-    }
866
+		$url = apply_filters('frm_jquery_ui_base_url', $url);
867
+		return $url;
868
+	}
869 869
 
870
-    /**
871
-     * @param string $handle
872
-     */
870
+	/**
871
+	 * @param string $handle
872
+	 */
873 873
 	public static function script_version( $handle, $default = 0 ) {
874 874
 		global $wp_scripts;
875 875
 		if ( ! $wp_scripts ) {
@@ -891,242 +891,242 @@  discard block
 block discarded – undo
891 891
 
892 892
 	public static function js_redirect( $url ) {
893 893
 		return '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>';
894
-    }
894
+	}
895 895
 
896 896
 	public static function get_user_id_param( $user_id ) {
897
-        if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
898
-            return $user_id;
899
-        }
897
+		if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
898
+			return $user_id;
899
+		}
900 900
 
901 901
 		$user_id = sanitize_text_field( $user_id );
902 902
 		if ( $user_id == 'current' ) {
903 903
 			$user_id = get_current_user_id();
904 904
 		} else {
905
-            if ( is_email($user_id) ) {
906
-                $user = get_user_by('email', $user_id);
907
-            } else {
908
-                $user = get_user_by('login', $user_id);
909
-            }
905
+			if ( is_email($user_id) ) {
906
+				$user = get_user_by('email', $user_id);
907
+			} else {
908
+				$user = get_user_by('login', $user_id);
909
+			}
910 910
 
911
-            if ( $user ) {
912
-                $user_id = $user->ID;
913
-            }
914
-            unset($user);
915
-        }
911
+			if ( $user ) {
912
+				$user_id = $user->ID;
913
+			}
914
+			unset($user);
915
+		}
916 916
 
917
-        return $user_id;
918
-    }
917
+		return $user_id;
918
+	}
919 919
 
920 920
 	public static function get_file_contents( $filename, $atts = array() ) {
921
-        if ( ! is_file($filename) ) {
922
-            return false;
923
-        }
924
-
925
-        extract($atts);
926
-        ob_start();
927
-        include($filename);
928
-        $contents = ob_get_contents();
929
-        ob_end_clean();
930
-        return $contents;
931
-    }
932
-
933
-    /**
934
-     * @param string $table_name
935
-     * @param string $column
921
+		if ( ! is_file($filename) ) {
922
+			return false;
923
+		}
924
+
925
+		extract($atts);
926
+		ob_start();
927
+		include($filename);
928
+		$contents = ob_get_contents();
929
+		ob_end_clean();
930
+		return $contents;
931
+	}
932
+
933
+	/**
934
+	 * @param string $table_name
935
+	 * @param string $column
936 936
 	 * @param int $id
937 937
 	 * @param int $num_chars
938
-     */
939
-    public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
940
-        $key = '';
938
+	 */
939
+	public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
940
+		$key = '';
941 941
 
942
-        if ( ! empty( $name ) ) {
943
-            $key = sanitize_key($name);
944
-        }
942
+		if ( ! empty( $name ) ) {
943
+			$key = sanitize_key($name);
944
+		}
945 945
 
946 946
 		if ( empty( $key ) ) {
947
-            $max_slug_value = pow(36, $num_chars);
948
-            $min_slug_value = 37; // we want to have at least 2 characters in the slug
949
-            $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
950
-        }
947
+			$max_slug_value = pow(36, $num_chars);
948
+			$min_slug_value = 37; // we want to have at least 2 characters in the slug
949
+			$key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
950
+		}
951 951
 
952 952
 		if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
953 953
 			$key = $key . 'a';
954
-        }
954
+		}
955 955
 
956 956
 		$key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
957 957
 
958
-        if ( $key_check || is_numeric($key_check) ) {
959
-            $suffix = 2;
958
+		if ( $key_check || is_numeric($key_check) ) {
959
+			$suffix = 2;
960 960
 			do {
961 961
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
962 962
 				$key_check = FrmDb::get_var( $table_name, array( $column => $alt_post_name, 'ID !' => $id ), $column );
963 963
 				$suffix++;
964 964
 			} while ( $key_check || is_numeric( $key_check ) );
965 965
 			$key = $alt_post_name;
966
-        }
967
-        return $key;
968
-    }
969
-
970
-    /**
971
-     * Editing a Form or Entry
972
-     * @param string $table
973
-     * @return bool|array
974
-     */
975
-    public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
976
-        if ( ! $record ) {
977
-            return false;
978
-        }
979
-
980
-        if ( empty($post_values) ) {
981
-            $post_values = stripslashes_deep($_POST);
982
-        }
966
+		}
967
+		return $key;
968
+	}
969
+
970
+	/**
971
+	 * Editing a Form or Entry
972
+	 * @param string $table
973
+	 * @return bool|array
974
+	 */
975
+	public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
976
+		if ( ! $record ) {
977
+			return false;
978
+		}
979
+
980
+		if ( empty($post_values) ) {
981
+			$post_values = stripslashes_deep($_POST);
982
+		}
983 983
 
984 984
 		$values = array( 'id' => $record->id, 'fields' => array() );
985 985
 
986 986
 		foreach ( array( 'name', 'description' ) as $var ) {
987
-            $default_val = isset($record->{$var}) ? $record->{$var} : '';
987
+			$default_val = isset($record->{$var}) ? $record->{$var} : '';
988 988
 			$values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
989
-            unset($var, $default_val);
990
-        }
991
-
992
-        $values['description'] = self::use_wpautop($values['description']);
993
-        $frm_settings = self::get_settings();
994
-        $is_form_builder = self::is_admin_page('formidable' );
995
-
996
-        foreach ( (array) $fields as $field ) {
997
-            // Make sure to filter default values (for placeholder text), but not on the form builder page
998
-            if ( ! $is_form_builder ) {
999
-                $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
1000
-            }
989
+			unset($var, $default_val);
990
+		}
991
+
992
+		$values['description'] = self::use_wpautop($values['description']);
993
+		$frm_settings = self::get_settings();
994
+		$is_form_builder = self::is_admin_page('formidable' );
995
+
996
+		foreach ( (array) $fields as $field ) {
997
+			// Make sure to filter default values (for placeholder text), but not on the form builder page
998
+			if ( ! $is_form_builder ) {
999
+				$field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
1000
+			}
1001 1001
 			$parent_form_id = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
1002 1002
 			self::fill_field_defaults($field, $record, $values, compact('default', 'post_values', 'frm_settings', 'parent_form_id' ) );
1003
-        }
1003
+		}
1004 1004
 
1005
-        self::fill_form_opts($record, $table, $post_values, $values);
1005
+		self::fill_form_opts($record, $table, $post_values, $values);
1006 1006
 
1007
-        if ( $table == 'entries' ) {
1008
-            $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
1009
-        } else if ( $table == 'forms' ) {
1010
-            $values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
1011
-        }
1007
+		if ( $table == 'entries' ) {
1008
+			$values = FrmEntriesHelper::setup_edit_vars( $values, $record );
1009
+		} else if ( $table == 'forms' ) {
1010
+			$values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
1011
+		}
1012 1012
 
1013
-        return $values;
1014
-    }
1013
+		return $values;
1014
+	}
1015 1015
 
1016 1016
 	private static function fill_field_defaults( $field, $record, array &$values, $args ) {
1017
-        $post_values = $args['post_values'];
1018
-
1019
-        if ( $args['default'] ) {
1020
-            $meta_value = $field->default_value;
1021
-        } else {
1022
-            if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
1023
-                if ( ! isset($field->field_options['custom_field']) ) {
1024
-                    $field->field_options['custom_field'] = '';
1025
-                }
1017
+		$post_values = $args['post_values'];
1018
+
1019
+		if ( $args['default'] ) {
1020
+			$meta_value = $field->default_value;
1021
+		} else {
1022
+			if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
1023
+				if ( ! isset($field->field_options['custom_field']) ) {
1024
+					$field->field_options['custom_field'] = '';
1025
+				}
1026 1026
 				$meta_value = FrmProEntryMetaHelper::get_post_value( $record->post_id, $field->field_options['post_field'], $field->field_options['custom_field'], array( 'truncate' => false, 'type' => $field->type, 'form_id' => $field->form_id, 'field' => $field ) );
1027
-            } else {
1027
+			} else {
1028 1028
 				$meta_value = FrmEntryMeta::get_meta_value( $record, $field->id );
1029
-            }
1030
-        }
1029
+			}
1030
+		}
1031 1031
 
1032 1032
 		$field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type;
1033
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1034
-
1035
-        $field_array = array(
1036
-            'id'            => $field->id,
1037
-            'value'         => $new_value,
1038
-            'default_value' => $field->default_value,
1039
-            'name'          => $field->name,
1040
-            'description'   => $field->description,
1041
-            'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1042
-            'options'       => $field->options,
1043
-            'required'      => $field->required,
1044
-            'field_key'     => $field->field_key,
1045
-            'field_order'   => $field->field_order,
1046
-            'form_id'       => $field->form_id,
1033
+		$new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1034
+
1035
+		$field_array = array(
1036
+			'id'            => $field->id,
1037
+			'value'         => $new_value,
1038
+			'default_value' => $field->default_value,
1039
+			'name'          => $field->name,
1040
+			'description'   => $field->description,
1041
+			'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1042
+			'options'       => $field->options,
1043
+			'required'      => $field->required,
1044
+			'field_key'     => $field->field_key,
1045
+			'field_order'   => $field->field_order,
1046
+			'form_id'       => $field->form_id,
1047 1047
 			'parent_form_id' => $args['parent_form_id'],
1048
-        );
1048
+		);
1049 1049
 
1050
-        $args['field_type'] = $field_type;
1051
-        self::fill_field_opts($field, $field_array, $args);
1050
+		$args['field_type'] = $field_type;
1051
+		self::fill_field_opts($field, $field_array, $args);
1052 1052
 		// Track the original field's type
1053 1053
 		$field_array['original_type'] = isset( $field->field_options['original_type'] ) ? $field->field_options['original_type'] : $field->type;
1054 1054
 
1055
-        $field_array = apply_filters( 'frm_setup_edit_fields_vars', $field_array, $field, $values['id'], array() );
1055
+		$field_array = apply_filters( 'frm_setup_edit_fields_vars', $field_array, $field, $values['id'], array() );
1056 1056
 
1057
-        if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1058
-            $field_array['unique_msg'] = '';
1059
-        }
1057
+		if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1058
+			$field_array['unique_msg'] = '';
1059
+		}
1060 1060
 
1061
-        $field_array = array_merge( $field->field_options, $field_array );
1061
+		$field_array = array_merge( $field->field_options, $field_array );
1062 1062
 
1063
-        $values['fields'][ $field->id ] = $field_array;
1064
-    }
1063
+		$values['fields'][ $field->id ] = $field_array;
1064
+	}
1065 1065
 
1066 1066
 	private static function fill_field_opts( $field, array &$field_array, $args ) {
1067
-        $post_values = $args['post_values'];
1068
-        $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1067
+		$post_values = $args['post_values'];
1068
+		$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1069 1069
 
1070
-        foreach ( $opt_defaults as $opt => $default_opt ) {
1070
+		foreach ( $opt_defaults as $opt => $default_opt ) {
1071 1071
 			$field_array[ $opt ] = ( $post_values && isset( $post_values['field_options'][ $opt . '_' . $field->id ] ) ) ? maybe_unserialize( $post_values['field_options'][ $opt . '_' . $field->id ] ) : ( isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default_opt );
1072
-            if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1073
-                $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1074
-            } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1075
-                if ( $args['field_type'] == 'captcha' ) {
1076
-                    $field_array[ $opt ] = $args['frm_settings']->re_msg;
1077
-                } else {
1078
-                    $field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1079
-                }
1080
-            }
1081
-        }
1082
-
1083
-        if ( $field_array['custom_html'] == '' ) {
1084
-            $field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1085
-        }
1086
-    }
1087
-
1088
-    /**
1089
-     * @param string $table
1090
-     */
1072
+			if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1073
+				$field_array[ $opt ] = $args['frm_settings']->blank_msg;
1074
+			} else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1075
+				if ( $args['field_type'] == 'captcha' ) {
1076
+					$field_array[ $opt ] = $args['frm_settings']->re_msg;
1077
+				} else {
1078
+					$field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1079
+				}
1080
+			}
1081
+		}
1082
+
1083
+		if ( $field_array['custom_html'] == '' ) {
1084
+			$field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1085
+		}
1086
+	}
1087
+
1088
+	/**
1089
+	 * @param string $table
1090
+	 */
1091 1091
 	private static function fill_form_opts( $record, $table, $post_values, array &$values ) {
1092
-        if ( $table == 'entries' ) {
1093
-            $form = $record->form_id;
1092
+		if ( $table == 'entries' ) {
1093
+			$form = $record->form_id;
1094 1094
 			FrmForm::maybe_get_form( $form );
1095
-        } else {
1096
-            $form = $record;
1097
-        }
1095
+		} else {
1096
+			$form = $record;
1097
+		}
1098 1098
 
1099
-        if ( ! $form ) {
1100
-            return;
1101
-        }
1099
+		if ( ! $form ) {
1100
+			return;
1101
+		}
1102 1102
 
1103
-        $values['form_name'] = isset($record->form_id) ? $form->name : '';
1103
+		$values['form_name'] = isset($record->form_id) ? $form->name : '';
1104 1104
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1105 1105
 
1106
-        if ( ! is_array($form->options) ) {
1107
-            return;
1108
-        }
1106
+		if ( ! is_array($form->options) ) {
1107
+			return;
1108
+		}
1109 1109
 
1110
-        foreach ( $form->options as $opt => $value ) {
1111
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1112
-        }
1110
+		foreach ( $form->options as $opt => $value ) {
1111
+			$values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1112
+		}
1113 1113
 
1114
-        self::fill_form_defaults($post_values, $values);
1115
-    }
1114
+		self::fill_form_defaults($post_values, $values);
1115
+	}
1116 1116
 
1117
-    /**
1118
-     * Set to POST value or default
1119
-     */
1117
+	/**
1118
+	 * Set to POST value or default
1119
+	 */
1120 1120
 	private static function fill_form_defaults( $post_values, array &$values ) {
1121
-        $form_defaults = FrmFormsHelper::get_default_opts();
1121
+		$form_defaults = FrmFormsHelper::get_default_opts();
1122 1122
 
1123
-        foreach ( $form_defaults as $opt => $default ) {
1124
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1123
+		foreach ( $form_defaults as $opt => $default ) {
1124
+			if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1125 1125
 				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1126
-            }
1126
+			}
1127 1127
 
1128
-            unset($opt, $defaut);
1129
-        }
1128
+			unset($opt, $defaut);
1129
+		}
1130 1130
 
1131 1131
 		if ( ! isset( $values['custom_style'] ) ) {
1132 1132
 			$values['custom_style'] = self::custom_style_value( $post_values );
@@ -1135,10 +1135,10 @@  discard block
 block discarded – undo
1135 1135
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1136 1136
 			if ( ! isset( $values[ $h . '_html' ] ) ) {
1137 1137
 				$values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
1138
-            }
1139
-            unset($h);
1140
-        }
1141
-    }
1138
+			}
1139
+			unset($h);
1140
+		}
1141
+	}
1142 1142
 
1143 1143
 	/**
1144 1144
 	 * @since 2.2.10
@@ -1161,59 +1161,59 @@  discard block
 block discarded – undo
1161 1161
 	}
1162 1162
 
1163 1163
 	public static function insert_opt_html( $args ) {
1164
-        $class = '';
1165
-        if ( in_array( $args['type'], array( 'email', 'user_id', 'hidden', 'select', 'radio', 'checkbox', 'phone', 'text' ) ) ) {
1166
-            $class .= 'show_frm_not_email_to';
1167
-        }
1168
-    ?>
1164
+		$class = '';
1165
+		if ( in_array( $args['type'], array( 'email', 'user_id', 'hidden', 'select', 'radio', 'checkbox', 'phone', 'text' ) ) ) {
1166
+			$class .= 'show_frm_not_email_to';
1167
+		}
1168
+	?>
1169 1169
 <li>
1170 1170
     <a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['id']) ?>" >[<?php echo esc_attr( $args['id'] ) ?>]</a>
1171 1171
     <a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['key']) ?>" >[<?php echo esc_attr( self::truncate($args['key'], 10) ) ?>]</a>
1172 1172
     <a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr($args['id']) ?>" ><?php echo esc_attr( self::truncate($args['name'], 60) ) ?></a>
1173 1173
 </li>
1174 1174
     <?php
1175
-    }
1175
+	}
1176 1176
 
1177 1177
 	public static function truncate( $str, $length, $minword = 3, $continue = '...' ) {
1178
-        if ( is_array( $str ) ) {
1179
-            return '';
1178
+		if ( is_array( $str ) ) {
1179
+			return '';
1180 1180
 		}
1181 1181
 
1182
-        $length = (int) $length;
1182
+		$length = (int) $length;
1183 1183
 		$str = wp_strip_all_tags( $str );
1184 1184
 		$original_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $str ) );
1185 1185
 
1186 1186
 		if ( $length == 0 ) {
1187
-            return '';
1188
-        } else if ( $length <= 10 ) {
1187
+			return '';
1188
+		} else if ( $length <= 10 ) {
1189 1189
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1190
-            return $sub . (($length < $original_len) ? $continue : '');
1191
-        }
1190
+			return $sub . (($length < $original_len) ? $continue : '');
1191
+		}
1192 1192
 
1193
-        $sub = '';
1194
-        $len = 0;
1193
+		$sub = '';
1194
+		$len = 0;
1195 1195
 
1196 1196
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1197 1197
 
1198 1198
 		foreach ( $words as $word ) {
1199
-            $part = (($sub != '') ? ' ' : '') . $word;
1199
+			$part = (($sub != '') ? ' ' : '') . $word;
1200 1200
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1201
-            if ( $total_len > $length && str_word_count($sub) ) {
1202
-                break;
1203
-            }
1201
+			if ( $total_len > $length && str_word_count($sub) ) {
1202
+				break;
1203
+			}
1204 1204
 
1205
-            $sub .= $part;
1205
+			$sub .= $part;
1206 1206
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1207 1207
 
1208
-            if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1209
-                break;
1210
-            }
1208
+			if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1209
+				break;
1210
+			}
1211 1211
 
1212
-            unset($total_len, $word);
1213
-        }
1212
+			unset($total_len, $word);
1213
+		}
1214 1214
 
1215
-        return $sub . (($len < $original_len) ? $continue : '');
1216
-    }
1215
+		return $sub . (($len < $original_len) ? $continue : '');
1216
+	}
1217 1217
 
1218 1218
 	public static function mb_function( $function_names, $args ) {
1219 1219
 		$mb_function_name = $function_names[0];
@@ -1225,18 +1225,18 @@  discard block
 block discarded – undo
1225 1225
 	}
1226 1226
 
1227 1227
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1228
-        if ( empty($date) ) {
1229
-            return $date;
1230
-        }
1228
+		if ( empty($date) ) {
1229
+			return $date;
1230
+		}
1231 1231
 
1232
-        if ( empty($date_format) ) {
1233
-            $date_format = get_option('date_format');
1234
-        }
1232
+		if ( empty($date_format) ) {
1233
+			$date_format = get_option('date_format');
1234
+		}
1235 1235
 
1236
-        if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1237
-            $frmpro_settings = new FrmProSettings();
1238
-            $date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1239
-        }
1236
+		if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1237
+			$frmpro_settings = new FrmProSettings();
1238
+			$date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1239
+		}
1240 1240
 
1241 1241
 		$formatted = self::get_localized_date( $date_format, $date );
1242 1242
 
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
 			$formatted .= self::add_time_to_date( $time_format, $date );
1246 1246
 		}
1247 1247
 
1248
-        return $formatted;
1249
-    }
1248
+		return $formatted;
1249
+	}
1250 1250
 
1251 1251
 	private static function add_time_to_date( $time_format, $date ) {
1252 1252
 		if ( empty( $time_format ) ) {
@@ -1328,120 +1328,120 @@  discard block
 block discarded – undo
1328 1328
 		);
1329 1329
 	}
1330 1330
 
1331
-    // Pagination Methods
1331
+	// Pagination Methods
1332 1332
 
1333
-    /**
1334
-     * @param integer $current_p
1335
-     */
1333
+	/**
1334
+	 * @param integer $current_p
1335
+	 */
1336 1336
 	public static function get_last_record_num( $r_count, $current_p, $p_size ) {
1337 1337
 		return ( ( $r_count < ( $current_p * $p_size ) ) ? $r_count : ( $current_p * $p_size ) );
1338 1338
 	}
1339 1339
 
1340
-    /**
1341
-     * @param integer $current_p
1342
-     */
1343
-    public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1344
-        if ( $current_p == 1 ) {
1345
-            return 1;
1346
-        } else {
1347
-            return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1348
-        }
1349
-    }
1340
+	/**
1341
+	 * @param integer $current_p
1342
+	 */
1343
+	public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1344
+		if ( $current_p == 1 ) {
1345
+			return 1;
1346
+		} else {
1347
+			return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1348
+		}
1349
+	}
1350 1350
 
1351 1351
 	/**
1352 1352
 	 * @return array
1353 1353
 	 */
1354 1354
 	public static function json_to_array( $json_vars ) {
1355
-        $vars = array();
1356
-        foreach ( $json_vars as $jv ) {
1357
-            $jv_name = explode('[', $jv['name']);
1358
-            $last = count($jv_name) - 1;
1359
-            foreach ( $jv_name as $p => $n ) {
1360
-                $name = trim($n, ']');
1361
-                if ( ! isset($l1) ) {
1362
-                    $l1 = $name;
1363
-                }
1364
-
1365
-                if ( ! isset($l2) ) {
1366
-                    $l2 = $name;
1367
-                }
1368
-
1369
-                if ( ! isset($l3) ) {
1370
-                    $l3 = $name;
1371
-                }
1372
-
1373
-                $this_val = ( $p == $last ) ? $jv['value'] : array();
1374
-
1375
-                switch ( $p ) {
1376
-                    case 0:
1377
-                        $l1 = $name;
1378
-                        self::add_value_to_array( $name, $l1, $this_val, $vars );
1379
-                    break;
1380
-
1381
-                    case 1:
1382
-                        $l2 = $name;
1383
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1384
-                    break;
1385
-
1386
-                    case 2:
1387
-                        $l3 = $name;
1388
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1389
-                    break;
1390
-
1391
-                    case 3:
1392
-                        $l4 = $name;
1393
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1394
-                    break;
1395
-                }
1396
-
1397
-                unset($this_val, $n);
1398
-            }
1399
-
1400
-            unset($last, $jv);
1401
-        }
1402
-
1403
-        return $vars;
1404
-    }
1405
-
1406
-    /**
1407
-     * @param string $name
1408
-     * @param string $l1
1409
-     */
1410
-    public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1411
-        if ( $name == '' ) {
1412
-            $vars[] = $val;
1413
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1414
-            $vars[ $l1 ] = $val;
1415
-        }
1416
-    }
1355
+		$vars = array();
1356
+		foreach ( $json_vars as $jv ) {
1357
+			$jv_name = explode('[', $jv['name']);
1358
+			$last = count($jv_name) - 1;
1359
+			foreach ( $jv_name as $p => $n ) {
1360
+				$name = trim($n, ']');
1361
+				if ( ! isset($l1) ) {
1362
+					$l1 = $name;
1363
+				}
1364
+
1365
+				if ( ! isset($l2) ) {
1366
+					$l2 = $name;
1367
+				}
1368
+
1369
+				if ( ! isset($l3) ) {
1370
+					$l3 = $name;
1371
+				}
1372
+
1373
+				$this_val = ( $p == $last ) ? $jv['value'] : array();
1374
+
1375
+				switch ( $p ) {
1376
+					case 0:
1377
+						$l1 = $name;
1378
+						self::add_value_to_array( $name, $l1, $this_val, $vars );
1379
+					break;
1380
+
1381
+					case 1:
1382
+						$l2 = $name;
1383
+						self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1384
+					break;
1385
+
1386
+					case 2:
1387
+						$l3 = $name;
1388
+						self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1389
+					break;
1390
+
1391
+					case 3:
1392
+						$l4 = $name;
1393
+						self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1394
+					break;
1395
+				}
1396
+
1397
+				unset($this_val, $n);
1398
+			}
1399
+
1400
+			unset($last, $jv);
1401
+		}
1402
+
1403
+		return $vars;
1404
+	}
1405
+
1406
+	/**
1407
+	 * @param string $name
1408
+	 * @param string $l1
1409
+	 */
1410
+	public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1411
+		if ( $name == '' ) {
1412
+			$vars[] = $val;
1413
+		} else if ( ! isset( $vars[ $l1 ] ) ) {
1414
+			$vars[ $l1 ] = $val;
1415
+		}
1416
+	}
1417 1417
 
1418 1418
 	public static function maybe_add_tooltip( $name, $class = 'closed', $form_name = '' ) {
1419
-        $tooltips = array(
1420
-            'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1421
-            'email_to'      => __( 'Add one or more recipient addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].  [admin_email] is the address set in WP General Settings.', 'formidable' ),
1422
-            'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1423
-            'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1424
-            'reply_to'      => __( 'If you would like a different reply to address than the "from" address, add a single address here.  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1425
-            'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1426
-            'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1427
-        );
1428
-
1429
-        if ( ! isset( $tooltips[ $name ] ) ) {
1430
-            return;
1431
-        }
1432
-
1433
-        if ( 'open' == $class ) {
1434
-            echo ' frm_help"';
1435
-        } else {
1436
-            echo ' class="frm_help"';
1437
-        }
1419
+		$tooltips = array(
1420
+			'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1421
+			'email_to'      => __( 'Add one or more recipient addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].  [admin_email] is the address set in WP General Settings.', 'formidable' ),
1422
+			'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1423
+			'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1424
+			'reply_to'      => __( 'If you would like a different reply to address than the "from" address, add a single address here.  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1425
+			'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1426
+			'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1427
+		);
1428
+
1429
+		if ( ! isset( $tooltips[ $name ] ) ) {
1430
+			return;
1431
+		}
1432
+
1433
+		if ( 'open' == $class ) {
1434
+			echo ' frm_help"';
1435
+		} else {
1436
+			echo ' class="frm_help"';
1437
+		}
1438 1438
 
1439 1439
 		echo ' title="' . esc_attr( $tooltips[ $name ] );
1440 1440
 
1441
-        if ( 'open' != $class ) {
1442
-            echo '"';
1443
-        }
1444
-    }
1441
+		if ( 'open' != $class ) {
1442
+			echo '"';
1443
+		}
1444
+	}
1445 1445
 
1446 1446
 	/**
1447 1447
 	 * Add the current_page class to that page in the form nav
@@ -1457,35 +1457,35 @@  discard block
 block discarded – undo
1457 1457
 		}
1458 1458
 	}
1459 1459
 
1460
-    /**
1461
-     * Prepare and json_encode post content
1462
-     *
1463
-     * @since 2.0
1464
-     *
1465
-     * @param array $post_content
1466
-     * @return string $post_content ( json encoded array )
1467
-     */
1468
-    public static function prepare_and_encode( $post_content ) {
1469
-        //Loop through array to strip slashes and add only the needed ones
1460
+	/**
1461
+	 * Prepare and json_encode post content
1462
+	 *
1463
+	 * @since 2.0
1464
+	 *
1465
+	 * @param array $post_content
1466
+	 * @return string $post_content ( json encoded array )
1467
+	 */
1468
+	public static function prepare_and_encode( $post_content ) {
1469
+		//Loop through array to strip slashes and add only the needed ones
1470 1470
 		foreach ( $post_content as $key => $val ) {
1471 1471
 			// Replace problematic characters (like &quot;)
1472 1472
 			$val = str_replace( '&quot;', '"', $val );
1473 1473
 
1474 1474
 			self::prepare_action_slashes( $val, $key, $post_content );
1475
-            unset( $key, $val );
1476
-        }
1475
+			unset( $key, $val );
1476
+		}
1477 1477
 
1478
-        // json_encode the array
1479
-        $post_content = json_encode( $post_content );
1478
+		// json_encode the array
1479
+		$post_content = json_encode( $post_content );
1480 1480
 
1481
-	    // add extra slashes for \r\n since WP strips them
1481
+		// add extra slashes for \r\n since WP strips them
1482 1482
 		$post_content = str_replace( array( '\\r', '\\n', '\\u', '\\t' ), array( '\\\\r', '\\\\n', '\\\\u', '\\\\t' ), $post_content );
1483 1483
 
1484
-        // allow for &quot
1485
-	    $post_content = str_replace( '&quot;', '\\"', $post_content );
1484
+		// allow for &quot
1485
+		$post_content = str_replace( '&quot;', '\\"', $post_content );
1486 1486
 
1487
-        return $post_content;
1488
-    }
1487
+		return $post_content;
1488
+	}
1489 1489
 
1490 1490
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1491 1491
 		if ( ! isset( $post_content[ $key ] ) ) {
@@ -1507,64 +1507,64 @@  discard block
 block discarded – undo
1507 1507
 	}
1508 1508
 
1509 1509
 	public static function maybe_json_decode( $string ) {
1510
-        if ( is_array($string) ) {
1511
-            return $string;
1512
-        }
1510
+		if ( is_array($string) ) {
1511
+			return $string;
1512
+		}
1513 1513
 
1514
-        $new_string = json_decode($string, true);
1515
-        if ( function_exists('json_last_error') ) {
1514
+		$new_string = json_decode($string, true);
1515
+		if ( function_exists('json_last_error') ) {
1516 1516
 			// php 5.3+
1517
-            if ( json_last_error() == JSON_ERROR_NONE ) {
1518
-                $string = $new_string;
1519
-            }
1520
-        } else if ( isset($new_string) ) {
1517
+			if ( json_last_error() == JSON_ERROR_NONE ) {
1518
+				$string = $new_string;
1519
+			}
1520
+		} else if ( isset($new_string) ) {
1521 1521
 			// php < 5.3 fallback
1522
-            $string = $new_string;
1523
-        }
1524
-        return $string;
1525
-    }
1526
-
1527
-    /**
1528
-     * @since 1.07.10
1529
-     *
1530
-     * @param string $post_type The name of the post type that may need to be highlighted
1531
-     * echo The javascript to open and highlight the Formidable menu
1532
-     */
1522
+			$string = $new_string;
1523
+		}
1524
+		return $string;
1525
+	}
1526
+
1527
+	/**
1528
+	 * @since 1.07.10
1529
+	 *
1530
+	 * @param string $post_type The name of the post type that may need to be highlighted
1531
+	 * echo The javascript to open and highlight the Formidable menu
1532
+	 */
1533 1533
 	public static function maybe_highlight_menu( $post_type ) {
1534
-        global $post;
1534
+		global $post;
1535 1535
 
1536
-        if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1537
-            return;
1538
-        }
1536
+		if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1537
+			return;
1538
+		}
1539 1539
 
1540
-        if ( is_object($post) && $post->post_type != $post_type ) {
1541
-            return;
1542
-        }
1540
+		if ( is_object($post) && $post->post_type != $post_type ) {
1541
+			return;
1542
+		}
1543 1543
 
1544
-        self::load_admin_wide_js();
1545
-        echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1546
-    }
1544
+		self::load_admin_wide_js();
1545
+		echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1546
+	}
1547 1547
 
1548
-    /**
1549
-     * Load the JS file on non-Formidable pages in the admin area
1550
-     * @since 2.0
1551
-     */
1548
+	/**
1549
+	 * Load the JS file on non-Formidable pages in the admin area
1550
+	 * @since 2.0
1551
+	 */
1552 1552
 	public static function load_admin_wide_js( $load = true ) {
1553
-        $version = FrmAppHelper::plugin_version();
1553
+		$version = FrmAppHelper::plugin_version();
1554 1554
 		wp_register_script( 'formidable_admin_global', FrmAppHelper::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
1555 1555
 
1556
-        wp_localize_script( 'formidable_admin_global', 'frmGlobal', array(
1556
+		wp_localize_script( 'formidable_admin_global', 'frmGlobal', array(
1557 1557
 			'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
1558
-            'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1558
+			'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1559 1559
 			'url'          => FrmAppHelper::plugin_url(),
1560 1560
 			'loading'      => __( 'Loading&hellip;' ),
1561 1561
 			'nonce'        => wp_create_nonce( 'frm_ajax' ),
1562
-        ) );
1562
+		) );
1563 1563
 
1564 1564
 		if ( $load ) {
1565 1565
 			wp_enqueue_script( 'formidable_admin_global' );
1566 1566
 		}
1567
-    }
1567
+	}
1568 1568
 
1569 1569
 	/**
1570 1570
 	 * @since 2.0.9
@@ -1573,9 +1573,9 @@  discard block
 block discarded – undo
1573 1573
 		wp_enqueue_style( 'frm_fonts', self::plugin_url() . '/css/frm_fonts.css', array(), self::plugin_version() );
1574 1574
 	}
1575 1575
 
1576
-    /**
1577
-     * @param string $location
1578
-     */
1576
+	/**
1577
+	 * @param string $location
1578
+	 */
1579 1579
 	public static function localize_script( $location ) {
1580 1580
 		$ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
1581 1581
 		$ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
@@ -1631,83 +1631,83 @@  discard block
 block discarded – undo
1631 1631
 		}
1632 1632
 	}
1633 1633
 
1634
-    /**
1634
+	/**
1635 1635
 	 * echo the message on the plugins listing page
1636
-     * @since 1.07.10
1637
-     *
1638
-     * @param float $min_version The version the add-on requires
1639
-     */
1636
+	 * @since 1.07.10
1637
+	 *
1638
+	 * @param float $min_version The version the add-on requires
1639
+	 */
1640 1640
 	public static function min_version_notice( $min_version ) {
1641
-        $frm_version = self::plugin_version();
1641
+		$frm_version = self::plugin_version();
1642 1642
 
1643
-        // check if Formidable meets minimum requirements
1644
-        if ( version_compare($frm_version, $min_version, '>=') ) {
1645
-            return;
1646
-        }
1643
+		// check if Formidable meets minimum requirements
1644
+		if ( version_compare($frm_version, $min_version, '>=') ) {
1645
+			return;
1646
+		}
1647 1647
 
1648
-        $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1648
+		$wp_list_table = _get_list_table('WP_Plugins_List_Table');
1649 1649
 		echo '<tr class="plugin-update-tr active"><th colspan="' . absint( $wp_list_table->get_column_count() ) . '" class="check-column plugin-update colspanchange"><div class="update-message">' .
1650
-        __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1651
-        '</div></td></tr>';
1652
-    }
1653
-
1654
-    public static function locales( $type = 'date' ) {
1655
-        $locales = array(
1656
-            'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1657
-            'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1658
-            'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1659
-            'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1660
-            'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1661
-            'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1662
-            'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1663
-            'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1664
-            'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1665
-            'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1666
-            'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1667
-            'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1668
-            'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1669
-            'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1670
-            'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1671
-            'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1672
-            'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1673
-            'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1674
-            'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1675
-            'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1676
-            'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1677
-            'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1678
-            'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1679
-            'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1680
-            'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1681
-            'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1682
-            'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1683
-            'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1684
-            'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1685
-            'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1686
-            'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1687
-            'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1688
-        );
1689
-
1690
-        if ( $type == 'captcha' ) {
1691
-            // remove the languages unavailable for the captcha
1692
-            $unset = array(
1693
-                '', 'af', 'sq', 'hy', 'az', 'eu', 'bs',
1694
-                'zh-HK', 'eo', 'et', 'fo', 'fr-CH',
1695
-                'he', 'is', 'ms', 'sr-SR', 'ta', 'tu',
1696
-            );
1697
-        } else {
1698
-            // remove the languages unavailable for the datepicker
1699
-            $unset = array(
1700
-                'en', 'fil', 'fr-CA', 'de-AT', 'de-AT',
1701
-                'de-CH', 'iw', 'hi', 'pt', 'pt-PT',
1702
-                'es-419', 'tr',
1703
-            );
1704
-        }
1705
-
1706
-        $locales = array_diff_key($locales, array_flip($unset));
1707
-        $locales = apply_filters('frm_locales', $locales);
1708
-
1709
-        return $locales;
1710
-    }
1650
+		__( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1651
+		'</div></td></tr>';
1652
+	}
1653
+
1654
+	public static function locales( $type = 'date' ) {
1655
+		$locales = array(
1656
+			'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1657
+			'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1658
+			'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1659
+			'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1660
+			'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1661
+			'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1662
+			'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1663
+			'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1664
+			'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1665
+			'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1666
+			'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1667
+			'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1668
+			'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1669
+			'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1670
+			'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1671
+			'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1672
+			'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1673
+			'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1674
+			'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1675
+			'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1676
+			'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1677
+			'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1678
+			'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1679
+			'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1680
+			'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1681
+			'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1682
+			'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1683
+			'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1684
+			'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1685
+			'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1686
+			'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1687
+			'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1688
+		);
1689
+
1690
+		if ( $type == 'captcha' ) {
1691
+			// remove the languages unavailable for the captcha
1692
+			$unset = array(
1693
+				'', 'af', 'sq', 'hy', 'az', 'eu', 'bs',
1694
+				'zh-HK', 'eo', 'et', 'fo', 'fr-CH',
1695
+				'he', 'is', 'ms', 'sr-SR', 'ta', 'tu',
1696
+			);
1697
+		} else {
1698
+			// remove the languages unavailable for the datepicker
1699
+			$unset = array(
1700
+				'en', 'fil', 'fr-CA', 'de-AT', 'de-AT',
1701
+				'de-CH', 'iw', 'hi', 'pt', 'pt-PT',
1702
+				'es-419', 'tr',
1703
+			);
1704
+		}
1705
+
1706
+		$locales = array_diff_key($locales, array_flip($unset));
1707
+		$locales = apply_filters('frm_locales', $locales);
1708
+
1709
+		return $locales;
1710
+	}
1711 1711
 
1712 1712
 	/**
1713 1713
 	 * Prepare and save settings in styles and actions
Please login to merge, or discard this patch.
Spacing   +176 added lines, -176 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
 
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
     }
24 24
 
25 25
     public static function plugin_folder() {
26
-        return basename(self::plugin_path());
26
+        return basename( self::plugin_path() );
27 27
     }
28 28
 
29 29
     public static function plugin_path() {
30
-        return dirname(dirname(dirname(__FILE__)));
30
+        return dirname( dirname( dirname( __FILE__ ) ) );
31 31
     }
32 32
 
33 33
     public static function plugin_url() {
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
      * @return string
55 55
      */
56 56
     public static function site_name() {
57
-        return get_option('blogname');
57
+        return get_option( 'blogname' );
58 58
     }
59 59
 
60 60
 	public static function make_affiliate_url( $url ) {
61 61
 		$affiliate_id = self::get_affiliate();
62 62
 		if ( ! empty( $affiliate_id ) ) {
63 63
 			$url = str_replace( array( 'http://', 'https://' ), '', $url );
64
-			$url = 'http://www.shareasale.com/r.cfm?u='. absint( $affiliate_id ) .'&b=841990&m=64739&afftrack=plugin&urllink=' . urlencode( $url );
64
+			$url = 'http://www.shareasale.com/r.cfm?u=' . absint( $affiliate_id ) . '&b=841990&m=64739&afftrack=plugin&urllink=' . urlencode( $url );
65 65
 		}
66 66
 		return $url;
67 67
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public static function get_settings() {
82 82
         global $frm_settings;
83
-        if ( empty($frm_settings) ) {
83
+        if ( empty( $frm_settings ) ) {
84 84
             $frm_settings = new FrmSettings();
85 85
         }
86 86
         return $frm_settings;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     }
110 110
 
111 111
     public static function pro_is_installed() {
112
-        return apply_filters('frm_pro_installed', false);
112
+        return apply_filters( 'frm_pro_installed', false );
113 113
     }
114 114
 
115 115
     /**
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		if ( function_exists( 'wp_doing_ajax' ) ) {
165 165
 			$doing_ajax = wp_doing_ajax();
166 166
 		} else {
167
-			$doing_ajax = defined('DOING_AJAX') && DOING_AJAX;
167
+			$doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
168 168
 		}
169 169
 		return $doing_ajax;
170 170
 	}
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      * @return string
214 214
      */
215 215
 	public static function get_server_value( $value ) {
216
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
216
+        return isset( $_SERVER[$value] ) ? wp_strip_all_tags( $_SERVER[$value] ) : '';
217 217
     }
218 218
 
219 219
     /**
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
             'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
229 229
             'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
230 230
         ) as $key ) {
231
-            if ( ! isset( $_SERVER[ $key ] ) ) {
231
+            if ( ! isset( $_SERVER[$key] ) ) {
232 232
                 continue;
233 233
             }
234 234
 
235
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
236
-                $ip = trim($ip); // just to be safe
235
+            foreach ( explode( ',', $_SERVER[$key] ) as $ip ) {
236
+                $ip = trim( $ip ); // just to be safe
237 237
 
238
-                if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
238
+                if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
239 239
                     return sanitize_text_field( $ip );
240 240
                 }
241 241
             }
@@ -245,15 +245,15 @@  discard block
 block discarded – undo
245 245
     }
246 246
 
247 247
     public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
248
-        if ( strpos($param, '[') ) {
249
-            $params = explode('[', $param);
248
+        if ( strpos( $param, '[' ) ) {
249
+            $params = explode( '[', $param );
250 250
             $param = $params[0];
251 251
         }
252 252
 
253 253
 		if ( $src == 'get' ) {
254
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
255
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
256
-                $value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
254
+            $value = isset( $_POST[$param] ) ? stripslashes_deep( $_POST[$param] ) : ( isset( $_GET[$param] ) ? stripslashes_deep( $_GET[$param] ) : $default );
255
+            if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) {
256
+                $value = stripslashes_deep( htmlspecialchars_decode( $_GET[$param] ) );
257 257
             }
258 258
 			self::sanitize_value( $sanitize, $value );
259 259
 		} else {
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
 
263 263
 		if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
264 264
             foreach ( $params as $k => $p ) {
265
-                if ( ! $k || ! is_array($value) ) {
265
+                if ( ! $k || ! is_array( $value ) ) {
266 266
                     continue;
267 267
                 }
268 268
 
269
-                $p = trim($p, ']');
270
-                $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
269
+                $p = trim( $p, ']' );
270
+                $value = isset( $value[$p] ) ? $value[$p] : $default;
271 271
             }
272 272
         }
273 273
 
@@ -306,16 +306,16 @@  discard block
 block discarded – undo
306 306
 
307 307
 		$value = $args['default'];
308 308
 		if ( $args['type'] == 'get' ) {
309
-			if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
310
-				$value = $_GET[ $args['param'] ];
309
+			if ( $_GET && isset( $_GET[$args['param']] ) ) {
310
+				$value = $_GET[$args['param']];
311 311
 			}
312 312
 		} else if ( $args['type'] == 'post' ) {
313
-			if ( isset( $_POST[ $args['param'] ] ) ) {
314
-				$value = stripslashes_deep( maybe_unserialize( $_POST[ $args['param'] ] ) );
313
+			if ( isset( $_POST[$args['param']] ) ) {
314
+				$value = stripslashes_deep( maybe_unserialize( $_POST[$args['param']] ) );
315 315
 			}
316 316
 		} else {
317
-			if ( isset( $_REQUEST[ $args['param'] ] ) ) {
318
-				$value = $_REQUEST[ $args['param'] ];
317
+			if ( isset( $_REQUEST[$args['param']] ) ) {
318
+				$value = $_REQUEST[$args['param']];
319 319
 			}
320 320
 		}
321 321
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 			if ( is_array( $value ) ) {
344 344
 				$temp_values = $value;
345 345
 				foreach ( $temp_values as $k => $v ) {
346
-					FrmAppHelper::sanitize_value( $sanitize, $value[ $k ] );
346
+					FrmAppHelper::sanitize_value( $sanitize, $value[$k] );
347 347
 				}
348 348
 			} else {
349 349
 				$value = call_user_func( $sanitize, $value );
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
     public static function sanitize_request( $sanitize_method, &$values ) {
355 355
         $temp_values = $values;
356 356
         foreach ( $temp_values as $k => $val ) {
357
-            if ( isset( $sanitize_method[ $k ] ) ) {
358
-				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
357
+            if ( isset( $sanitize_method[$k] ) ) {
358
+				$values[$k] = call_user_func( $sanitize_method[$k], $val );
359 359
             }
360 360
         }
361 361
     }
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	public static function sanitize_array( &$values ) {
364 364
 		$temp_values = $values;
365 365
 		foreach ( $temp_values as $k => $val ) {
366
-			$values[ $k ] = wp_kses_post( $val );
366
+			$values[$k] = wp_kses_post( $val );
367 367
 		}
368 368
 	}
369 369
 
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 			$allowed_html = $html;
391 391
 		} else {
392 392
 			foreach ( $allowed as $a ) {
393
-				$allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array();
393
+				$allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array();
394 394
 			}
395 395
 		}
396 396
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
      * @since 2.0
488 488
      */
489 489
     public static function remove_get_action() {
490
-        if ( ! isset($_GET) ) {
490
+        if ( ! isset( $_GET ) ) {
491 491
             return;
492 492
         }
493 493
 
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
         }
510 510
 
511 511
         global $wp_query;
512
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
513
-            $value = $wp_query->query_vars[ $param ];
512
+        if ( isset( $wp_query->query_vars[$param] ) ) {
513
+            $value = $wp_query->query_vars[$param];
514 514
         }
515 515
 
516 516
         return $value;
@@ -549,17 +549,17 @@  discard block
 block discarded – undo
549 549
     }
550 550
 
551 551
     public static function get_pages() {
552
-		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
552
+		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => - 1, 'orderby' => 'title', 'order' => 'ASC' ) );
553 553
     }
554 554
 
555 555
     public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
556 556
         $pages = self::get_pages();
557 557
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
558 558
     ?>
559
-        <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
559
+        <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" class="frm-pages-dropdown">
560 560
             <option value=""> </option>
561 561
             <?php foreach ( $pages as $page ) { ?>
562
-				<option value="<?php echo esc_attr($page->ID); ?>" <?php selected( $selected, $page->ID ) ?>>
562
+				<option value="<?php echo esc_attr( $page->ID ); ?>" <?php selected( $selected, $page->ID ) ?>>
563 563
 					<?php echo esc_html( $truncate ? self::truncate( $page->post_title, $truncate ) : $page->post_title ); ?>
564 564
 				</option>
565 565
             <?php } ?>
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
     }
569 569
 
570 570
 	public static function post_edit_link( $post_id ) {
571
-        $post = get_post($post_id);
571
+        $post = get_post( $post_id );
572 572
         if ( $post ) {
573 573
 			$post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
574 574
 			return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
@@ -578,17 +578,17 @@  discard block
 block discarded – undo
578 578
 
579 579
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
580 580
     ?>
581
-        <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" <?php
581
+        <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" <?php
582 582
             echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
583 583
             ?> class="frm_multiselect">
584
-            <?php self::roles_options($capability); ?>
584
+            <?php self::roles_options( $capability ); ?>
585 585
         </select>
586 586
     <?php
587 587
     }
588 588
 
589 589
 	public static function roles_options( $capability ) {
590 590
         global $frm_vars;
591
-        if ( isset($frm_vars['editable_roles']) ) {
591
+        if ( isset( $frm_vars['editable_roles'] ) ) {
592 592
             $editable_roles = $frm_vars['editable_roles'];
593 593
         } else {
594 594
             $editable_roles = get_editable_roles();
@@ -596,10 +596,10 @@  discard block
 block discarded – undo
596 596
         }
597 597
 
598 598
         foreach ( $editable_roles as $role => $details ) {
599
-            $name = translate_user_role($details['name'] ); ?>
600
-        <option value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, (array) $capability) ? ' selected="selected"' : ''; ?>><?php echo esc_attr($name) ?> </option>
599
+            $name = translate_user_role( $details['name'] ); ?>
600
+        <option value="<?php echo esc_attr( $role ) ?>" <?php echo in_array( $role, (array) $capability ) ? ' selected="selected"' : ''; ?>><?php echo esc_attr( $name ) ?> </option>
601 601
 <?php
602
-            unset($role, $details);
602
+            unset( $role, $details );
603 603
         }
604 604
     }
605 605
 
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
     public static function maybe_add_permissions() {
656 656
 		self::force_capability( 'frm_view_entries' );
657 657
 
658
-        if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
658
+        if ( ! current_user_can( 'administrator' ) || current_user_can( 'frm_view_forms' ) ) {
659 659
             return;
660 660
         }
661 661
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
         $frm_roles = self::frm_capabilities();
665 665
         foreach ( $frm_roles as $frm_role => $frm_role_description ) {
666 666
 			$user->add_cap( $frm_role );
667
-            unset($frm_role, $frm_role_description);
667
+            unset( $frm_role, $frm_role_description );
668 668
         }
669 669
     }
670 670
 
@@ -689,12 +689,12 @@  discard block
 block discarded – undo
689 689
      * @param string $permission
690 690
      */
691 691
 	public static function permission_check( $permission, $show_message = 'show' ) {
692
-        $permission_error = self::permission_nonce_error($permission);
692
+        $permission_error = self::permission_nonce_error( $permission );
693 693
         if ( $permission_error !== false ) {
694 694
             if ( 'hide' == $show_message ) {
695 695
                 $permission_error = '';
696 696
             }
697
-            wp_die($permission_error);
697
+            wp_die( $permission_error );
698 698
         }
699 699
     }
700 700
 
@@ -711,11 +711,11 @@  discard block
 block discarded – undo
711 711
 		}
712 712
 
713 713
 		$error = false;
714
-        if ( empty($nonce_name) ) {
714
+        if ( empty( $nonce_name ) ) {
715 715
             return $error;
716 716
         }
717 717
 
718
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
718
+        if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $_REQUEST[$nonce_name], $nonce ) ) ) {
719 719
             $frm_settings = self::get_settings();
720 720
             $error = $frm_settings->admin_permission;
721 721
         }
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 			} else {
796 796
 				foreach ( $value as $k => $v ) {
797 797
 					if ( ! is_array( $v ) ) {
798
-						$value[ $k ] = call_user_func( $original_function, $v );
798
+						$value[$k] = call_user_func( $original_function, $v );
799 799
 					}
800 800
 				}
801 801
 			}
@@ -816,11 +816,11 @@  discard block
 block discarded – undo
816 816
 	public static function array_flatten( $array, $keys = 'keep' ) {
817 817
         $return = array();
818 818
         foreach ( $array as $key => $value ) {
819
-            if ( is_array($value) ) {
819
+            if ( is_array( $value ) ) {
820 820
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
821 821
             } else {
822 822
 				if ( $keys == 'keep' ) {
823
-					$return[ $key ] = $value;
823
+					$return[$key] = $value;
824 824
 				} else {
825 825
 					$return[] = $value;
826 826
 				}
@@ -843,8 +843,8 @@  discard block
 block discarded – undo
843 843
      * @since 2.0
844 844
      */
845 845
 	public static function use_wpautop( $content ) {
846
-        if ( apply_filters('frm_use_wpautop', true) ) {
847
-            $content = wpautop(str_replace( '<br>', '<br />', $content));
846
+        if ( apply_filters( 'frm_use_wpautop', true ) ) {
847
+            $content = wpautop( str_replace( '<br>', '<br />', $content ) );
848 848
         }
849 849
         return $content;
850 850
     }
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
      */
864 864
     public static function jquery_ui_base_url() {
865 865
 		$url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core', '1.11.4' );
866
-        $url = apply_filters('frm_jquery_ui_base_url', $url);
866
+        $url = apply_filters( 'frm_jquery_ui_base_url', $url );
867 867
         return $url;
868 868
     }
869 869
 
@@ -877,11 +877,11 @@  discard block
 block discarded – undo
877 877
 		}
878 878
 
879 879
 		$ver = $default;
880
-		if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
880
+		if ( ! isset( $wp_scripts->registered[$handle] ) ) {
881 881
 			return $ver;
882 882
 		}
883 883
 
884
-		$query = $wp_scripts->registered[ $handle ];
884
+		$query = $wp_scripts->registered[$handle];
885 885
 		if ( is_object( $query ) && ! empty( $query->ver ) ) {
886 886
 			$ver = $query->ver;
887 887
 		}
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
     }
895 895
 
896 896
 	public static function get_user_id_param( $user_id ) {
897
-        if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
897
+        if ( ! $user_id || empty( $user_id ) || is_numeric( $user_id ) ) {
898 898
             return $user_id;
899 899
         }
900 900
 
@@ -902,29 +902,29 @@  discard block
 block discarded – undo
902 902
 		if ( $user_id == 'current' ) {
903 903
 			$user_id = get_current_user_id();
904 904
 		} else {
905
-            if ( is_email($user_id) ) {
906
-                $user = get_user_by('email', $user_id);
905
+            if ( is_email( $user_id ) ) {
906
+                $user = get_user_by( 'email', $user_id );
907 907
             } else {
908
-                $user = get_user_by('login', $user_id);
908
+                $user = get_user_by( 'login', $user_id );
909 909
             }
910 910
 
911 911
             if ( $user ) {
912 912
                 $user_id = $user->ID;
913 913
             }
914
-            unset($user);
914
+            unset( $user );
915 915
         }
916 916
 
917 917
         return $user_id;
918 918
     }
919 919
 
920 920
 	public static function get_file_contents( $filename, $atts = array() ) {
921
-        if ( ! is_file($filename) ) {
921
+        if ( ! is_file( $filename ) ) {
922 922
             return false;
923 923
         }
924 924
 
925
-        extract($atts);
925
+        extract( $atts );
926 926
         ob_start();
927
-        include($filename);
927
+        include( $filename );
928 928
         $contents = ob_get_contents();
929 929
         ob_end_clean();
930 930
         return $contents;
@@ -940,27 +940,27 @@  discard block
 block discarded – undo
940 940
         $key = '';
941 941
 
942 942
         if ( ! empty( $name ) ) {
943
-            $key = sanitize_key($name);
943
+            $key = sanitize_key( $name );
944 944
         }
945 945
 
946 946
 		if ( empty( $key ) ) {
947
-            $max_slug_value = pow(36, $num_chars);
947
+            $max_slug_value = pow( 36, $num_chars );
948 948
             $min_slug_value = 37; // we want to have at least 2 characters in the slug
949
-            $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
949
+            $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
950 950
         }
951 951
 
952
-		if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
952
+		if ( is_numeric( $key ) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
953 953
 			$key = $key . 'a';
954 954
         }
955 955
 
956 956
 		$key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
957 957
 
958
-        if ( $key_check || is_numeric($key_check) ) {
958
+        if ( $key_check || is_numeric( $key_check ) ) {
959 959
             $suffix = 2;
960 960
 			do {
961 961
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
962 962
 				$key_check = FrmDb::get_var( $table_name, array( $column => $alt_post_name, 'ID !' => $id ), $column );
963
-				$suffix++;
963
+				$suffix ++;
964 964
 			} while ( $key_check || is_numeric( $key_check ) );
965 965
 			$key = $alt_post_name;
966 966
         }
@@ -977,32 +977,32 @@  discard block
 block discarded – undo
977 977
             return false;
978 978
         }
979 979
 
980
-        if ( empty($post_values) ) {
981
-            $post_values = stripslashes_deep($_POST);
980
+        if ( empty( $post_values ) ) {
981
+            $post_values = stripslashes_deep( $_POST );
982 982
         }
983 983
 
984 984
 		$values = array( 'id' => $record->id, 'fields' => array() );
985 985
 
986 986
 		foreach ( array( 'name', 'description' ) as $var ) {
987
-            $default_val = isset($record->{$var}) ? $record->{$var} : '';
988
-			$values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
989
-            unset($var, $default_val);
987
+            $default_val = isset( $record->{$var}) ? $record->{$var} : '';
988
+			$values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
989
+            unset( $var, $default_val );
990 990
         }
991 991
 
992
-        $values['description'] = self::use_wpautop($values['description']);
992
+        $values['description'] = self::use_wpautop( $values['description'] );
993 993
         $frm_settings = self::get_settings();
994
-        $is_form_builder = self::is_admin_page('formidable' );
994
+        $is_form_builder = self::is_admin_page( 'formidable' );
995 995
 
996 996
         foreach ( (array) $fields as $field ) {
997 997
             // Make sure to filter default values (for placeholder text), but not on the form builder page
998 998
             if ( ! $is_form_builder ) {
999
-                $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
999
+                $field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true );
1000 1000
             }
1001 1001
 			$parent_form_id = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
1002
-			self::fill_field_defaults($field, $record, $values, compact('default', 'post_values', 'frm_settings', 'parent_form_id' ) );
1002
+			self::fill_field_defaults( $field, $record, $values, compact( 'default', 'post_values', 'frm_settings', 'parent_form_id' ) );
1003 1003
         }
1004 1004
 
1005
-        self::fill_form_opts($record, $table, $post_values, $values);
1005
+        self::fill_form_opts( $record, $table, $post_values, $values );
1006 1006
 
1007 1007
         if ( $table == 'entries' ) {
1008 1008
             $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
@@ -1019,8 +1019,8 @@  discard block
 block discarded – undo
1019 1019
         if ( $args['default'] ) {
1020 1020
             $meta_value = $field->default_value;
1021 1021
         } else {
1022
-            if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
1023
-                if ( ! isset($field->field_options['custom_field']) ) {
1022
+            if ( $record->post_id && self::pro_is_installed() && isset( $field->field_options['post_field'] ) && $field->field_options['post_field'] ) {
1023
+                if ( ! isset( $field->field_options['custom_field'] ) ) {
1024 1024
                     $field->field_options['custom_field'] = '';
1025 1025
                 }
1026 1026
 				$meta_value = FrmProEntryMetaHelper::get_post_value( $record->post_id, $field->field_options['post_field'], $field->field_options['custom_field'], array( 'truncate' => false, 'type' => $field->type, 'form_id' => $field->form_id, 'field' => $field ) );
@@ -1029,8 +1029,8 @@  discard block
 block discarded – undo
1029 1029
             }
1030 1030
         }
1031 1031
 
1032
-		$field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type;
1033
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1032
+		$field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type;
1033
+        $new_value = isset( $post_values['item_meta'][$field->id] ) ? maybe_unserialize( $post_values['item_meta'][$field->id] ) : $meta_value;
1034 1034
 
1035 1035
         $field_array = array(
1036 1036
             'id'            => $field->id,
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
             'default_value' => $field->default_value,
1039 1039
             'name'          => $field->name,
1040 1040
             'description'   => $field->description,
1041
-            'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1041
+            'type'          => apply_filters( 'frm_field_type', $field_type, $field, $new_value ),
1042 1042
             'options'       => $field->options,
1043 1043
             'required'      => $field->required,
1044 1044
             'field_key'     => $field->field_key,
@@ -1048,40 +1048,40 @@  discard block
 block discarded – undo
1048 1048
         );
1049 1049
 
1050 1050
         $args['field_type'] = $field_type;
1051
-        self::fill_field_opts($field, $field_array, $args);
1051
+        self::fill_field_opts( $field, $field_array, $args );
1052 1052
 		// Track the original field's type
1053 1053
 		$field_array['original_type'] = isset( $field->field_options['original_type'] ) ? $field->field_options['original_type'] : $field->type;
1054 1054
 
1055 1055
         $field_array = apply_filters( 'frm_setup_edit_fields_vars', $field_array, $field, $values['id'], array() );
1056 1056
 
1057
-        if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1057
+        if ( ! isset( $field_array['unique'] ) || ! $field_array['unique'] ) {
1058 1058
             $field_array['unique_msg'] = '';
1059 1059
         }
1060 1060
 
1061 1061
         $field_array = array_merge( $field->field_options, $field_array );
1062 1062
 
1063
-        $values['fields'][ $field->id ] = $field_array;
1063
+        $values['fields'][$field->id] = $field_array;
1064 1064
     }
1065 1065
 
1066 1066
 	private static function fill_field_opts( $field, array &$field_array, $args ) {
1067 1067
         $post_values = $args['post_values'];
1068
-        $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1068
+        $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true );
1069 1069
 
1070 1070
         foreach ( $opt_defaults as $opt => $default_opt ) {
1071
-			$field_array[ $opt ] = ( $post_values && isset( $post_values['field_options'][ $opt . '_' . $field->id ] ) ) ? maybe_unserialize( $post_values['field_options'][ $opt . '_' . $field->id ] ) : ( isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default_opt );
1072
-            if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1073
-                $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1074
-            } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1071
+			$field_array[$opt] = ( $post_values && isset( $post_values['field_options'][$opt . '_' . $field->id] ) ) ? maybe_unserialize( $post_values['field_options'][$opt . '_' . $field->id] ) : ( isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default_opt );
1072
+            if ( $opt == 'blank' && $field_array[$opt] == '' ) {
1073
+                $field_array[$opt] = $args['frm_settings']->blank_msg;
1074
+            } else if ( $opt == 'invalid' && $field_array[$opt] == '' ) {
1075 1075
                 if ( $args['field_type'] == 'captcha' ) {
1076
-                    $field_array[ $opt ] = $args['frm_settings']->re_msg;
1076
+                    $field_array[$opt] = $args['frm_settings']->re_msg;
1077 1077
                 } else {
1078
-                    $field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1078
+                    $field_array[$opt] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1079 1079
                 }
1080 1080
             }
1081 1081
         }
1082 1082
 
1083 1083
         if ( $field_array['custom_html'] == '' ) {
1084
-            $field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1084
+            $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $args['field_type'] );
1085 1085
         }
1086 1086
     }
1087 1087
 
@@ -1100,18 +1100,18 @@  discard block
 block discarded – undo
1100 1100
             return;
1101 1101
         }
1102 1102
 
1103
-        $values['form_name'] = isset($record->form_id) ? $form->name : '';
1103
+        $values['form_name'] = isset( $record->form_id ) ? $form->name : '';
1104 1104
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1105 1105
 
1106
-        if ( ! is_array($form->options) ) {
1106
+        if ( ! is_array( $form->options ) ) {
1107 1107
             return;
1108 1108
         }
1109 1109
 
1110 1110
         foreach ( $form->options as $opt => $value ) {
1111
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1111
+            $values[$opt] = isset( $post_values[$opt] ) ? maybe_unserialize( $post_values[$opt] ) : $value;
1112 1112
         }
1113 1113
 
1114
-        self::fill_form_defaults($post_values, $values);
1114
+        self::fill_form_defaults( $post_values, $values );
1115 1115
     }
1116 1116
 
1117 1117
     /**
@@ -1121,11 +1121,11 @@  discard block
 block discarded – undo
1121 1121
         $form_defaults = FrmFormsHelper::get_default_opts();
1122 1122
 
1123 1123
         foreach ( $form_defaults as $opt => $default ) {
1124
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1125
-				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1124
+            if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) {
1125
+				$values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default;
1126 1126
             }
1127 1127
 
1128
-            unset($opt, $defaut);
1128
+            unset( $opt, $defaut );
1129 1129
         }
1130 1130
 
1131 1131
 		if ( ! isset( $values['custom_style'] ) ) {
@@ -1133,10 +1133,10 @@  discard block
 block discarded – undo
1133 1133
 		}
1134 1134
 
1135 1135
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1136
-			if ( ! isset( $values[ $h . '_html' ] ) ) {
1137
-				$values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
1136
+			if ( ! isset( $values[$h . '_html'] ) ) {
1137
+				$values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) );
1138 1138
             }
1139
-            unset($h);
1139
+            unset( $h );
1140 1140
         }
1141 1141
     }
1142 1142
 
@@ -1167,9 +1167,9 @@  discard block
 block discarded – undo
1167 1167
         }
1168 1168
     ?>
1169 1169
 <li>
1170
-    <a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['id']) ?>" >[<?php echo esc_attr( $args['id'] ) ?>]</a>
1171
-    <a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['key']) ?>" >[<?php echo esc_attr( self::truncate($args['key'], 10) ) ?>]</a>
1172
-    <a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr($args['id']) ?>" ><?php echo esc_attr( self::truncate($args['name'], 60) ) ?></a>
1170
+    <a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr( $args['id'] ) ?>" >[<?php echo esc_attr( $args['id'] ) ?>]</a>
1171
+    <a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr( $args['key'] ) ?>" >[<?php echo esc_attr( self::truncate( $args['key'], 10 ) ) ?>]</a>
1172
+    <a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr( $args['id'] ) ?>" ><?php echo esc_attr( self::truncate( $args['name'], 60 ) ) ?></a>
1173 1173
 </li>
1174 1174
     <?php
1175 1175
     }
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
             return '';
1188 1188
         } else if ( $length <= 10 ) {
1189 1189
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1190
-            return $sub . (($length < $original_len) ? $continue : '');
1190
+            return $sub . ( ( $length < $original_len ) ? $continue : '' );
1191 1191
         }
1192 1192
 
1193 1193
         $sub = '';
@@ -1196,23 +1196,23 @@  discard block
 block discarded – undo
1196 1196
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1197 1197
 
1198 1198
 		foreach ( $words as $word ) {
1199
-            $part = (($sub != '') ? ' ' : '') . $word;
1199
+            $part = ( ( $sub != '' ) ? ' ' : '' ) . $word;
1200 1200
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1201
-            if ( $total_len > $length && str_word_count($sub) ) {
1201
+            if ( $total_len > $length && str_word_count( $sub ) ) {
1202 1202
                 break;
1203 1203
             }
1204 1204
 
1205 1205
             $sub .= $part;
1206 1206
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1207 1207
 
1208
-            if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1208
+            if ( str_word_count( $sub ) > $minword && $total_len >= $length ) {
1209 1209
                 break;
1210 1210
             }
1211 1211
 
1212
-            unset($total_len, $word);
1212
+            unset( $total_len, $word );
1213 1213
         }
1214 1214
 
1215
-        return $sub . (($len < $original_len) ? $continue : '');
1215
+        return $sub . ( ( $len < $original_len ) ? $continue : '' );
1216 1216
     }
1217 1217
 
1218 1218
 	public static function mb_function( $function_names, $args ) {
@@ -1225,17 +1225,17 @@  discard block
 block discarded – undo
1225 1225
 	}
1226 1226
 
1227 1227
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1228
-        if ( empty($date) ) {
1228
+        if ( empty( $date ) ) {
1229 1229
             return $date;
1230 1230
         }
1231 1231
 
1232
-        if ( empty($date_format) ) {
1233
-            $date_format = get_option('date_format');
1232
+        if ( empty( $date_format ) ) {
1233
+            $date_format = get_option( 'date_format' );
1234 1234
         }
1235 1235
 
1236
-        if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1236
+        if ( preg_match( '/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {
1237 1237
             $frmpro_settings = new FrmProSettings();
1238
-            $date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1238
+            $date = FrmProAppHelper::convert_date( $date, $frmpro_settings->date_format, 'Y-m-d' );
1239 1239
         }
1240 1240
 
1241 1241
 		$formatted = self::get_localized_date( $date_format, $date );
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
 
1251 1251
 	private static function add_time_to_date( $time_format, $date ) {
1252 1252
 		if ( empty( $time_format ) ) {
1253
-			$time_format = get_option('time_format');
1253
+			$time_format = get_option( 'time_format' );
1254 1254
 		}
1255 1255
 
1256 1256
 		$trimmed_format = trim( $time_format );
@@ -1296,10 +1296,10 @@  discard block
 block discarded – undo
1296 1296
 		$time_strings = self::get_time_strings();
1297 1297
 
1298 1298
 		foreach ( $time_strings as $k => $v ) {
1299
-			if ( $diff[ $k ] ) {
1300
-				$time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] );
1299
+			if ( $diff[$k] ) {
1300
+				$time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] );
1301 1301
 			} else {
1302
-				unset( $time_strings[ $k ] );
1302
+				unset( $time_strings[$k] );
1303 1303
 			}
1304 1304
 		}
1305 1305
 
@@ -1354,19 +1354,19 @@  discard block
 block discarded – undo
1354 1354
 	public static function json_to_array( $json_vars ) {
1355 1355
         $vars = array();
1356 1356
         foreach ( $json_vars as $jv ) {
1357
-            $jv_name = explode('[', $jv['name']);
1358
-            $last = count($jv_name) - 1;
1357
+            $jv_name = explode( '[', $jv['name'] );
1358
+            $last = count( $jv_name ) - 1;
1359 1359
             foreach ( $jv_name as $p => $n ) {
1360
-                $name = trim($n, ']');
1361
-                if ( ! isset($l1) ) {
1360
+                $name = trim( $n, ']' );
1361
+                if ( ! isset( $l1 ) ) {
1362 1362
                     $l1 = $name;
1363 1363
                 }
1364 1364
 
1365
-                if ( ! isset($l2) ) {
1365
+                if ( ! isset( $l2 ) ) {
1366 1366
                     $l2 = $name;
1367 1367
                 }
1368 1368
 
1369
-                if ( ! isset($l3) ) {
1369
+                if ( ! isset( $l3 ) ) {
1370 1370
                     $l3 = $name;
1371 1371
                 }
1372 1372
 
@@ -1380,24 +1380,24 @@  discard block
 block discarded – undo
1380 1380
 
1381 1381
                     case 1:
1382 1382
                         $l2 = $name;
1383
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1383
+                        self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] );
1384 1384
                     break;
1385 1385
 
1386 1386
                     case 2:
1387 1387
                         $l3 = $name;
1388
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1388
+                        self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] );
1389 1389
                     break;
1390 1390
 
1391 1391
                     case 3:
1392 1392
                         $l4 = $name;
1393
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1393
+                        self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] );
1394 1394
                     break;
1395 1395
                 }
1396 1396
 
1397
-                unset($this_val, $n);
1397
+                unset( $this_val, $n );
1398 1398
             }
1399 1399
 
1400
-            unset($last, $jv);
1400
+            unset( $last, $jv );
1401 1401
         }
1402 1402
 
1403 1403
         return $vars;
@@ -1410,8 +1410,8 @@  discard block
 block discarded – undo
1410 1410
     public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1411 1411
         if ( $name == '' ) {
1412 1412
             $vars[] = $val;
1413
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1414
-            $vars[ $l1 ] = $val;
1413
+        } else if ( ! isset( $vars[$l1] ) ) {
1414
+            $vars[$l1] = $val;
1415 1415
         }
1416 1416
     }
1417 1417
 
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
             'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1427 1427
         );
1428 1428
 
1429
-        if ( ! isset( $tooltips[ $name ] ) ) {
1429
+        if ( ! isset( $tooltips[$name] ) ) {
1430 1430
             return;
1431 1431
         }
1432 1432
 
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
             echo ' class="frm_help"';
1437 1437
         }
1438 1438
 
1439
-		echo ' title="' . esc_attr( $tooltips[ $name ] );
1439
+		echo ' title="' . esc_attr( $tooltips[$name] );
1440 1440
 
1441 1441
         if ( 'open' != $class ) {
1442 1442
             echo '"';
@@ -1488,13 +1488,13 @@  discard block
 block discarded – undo
1488 1488
     }
1489 1489
 
1490 1490
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1491
-		if ( ! isset( $post_content[ $key ] ) ) {
1491
+		if ( ! isset( $post_content[$key] ) ) {
1492 1492
 			return;
1493 1493
 		}
1494 1494
 
1495 1495
 		if ( is_array( $val ) ) {
1496 1496
 			foreach ( $val as $k1 => $v1 ) {
1497
-				self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] );
1497
+				self::prepare_action_slashes( $v1, $k1, $post_content[$key] );
1498 1498
 				unset( $k1, $v1 );
1499 1499
 			}
1500 1500
 		} else {
@@ -1502,22 +1502,22 @@  discard block
 block discarded – undo
1502 1502
 			$val = stripslashes( $val );
1503 1503
 
1504 1504
 			// Add backslashes before double quotes and forward slashes only
1505
-			$post_content[ $key ] = addcslashes( $val, '"\\/' );
1505
+			$post_content[$key] = addcslashes( $val, '"\\/' );
1506 1506
 		}
1507 1507
 	}
1508 1508
 
1509 1509
 	public static function maybe_json_decode( $string ) {
1510
-        if ( is_array($string) ) {
1510
+        if ( is_array( $string ) ) {
1511 1511
             return $string;
1512 1512
         }
1513 1513
 
1514
-        $new_string = json_decode($string, true);
1515
-        if ( function_exists('json_last_error') ) {
1514
+        $new_string = json_decode( $string, true );
1515
+        if ( function_exists( 'json_last_error' ) ) {
1516 1516
 			// php 5.3+
1517 1517
             if ( json_last_error() == JSON_ERROR_NONE ) {
1518 1518
                 $string = $new_string;
1519 1519
             }
1520
-        } else if ( isset($new_string) ) {
1520
+        } else if ( isset( $new_string ) ) {
1521 1521
 			// php < 5.3 fallback
1522 1522
             $string = $new_string;
1523 1523
         }
@@ -1533,11 +1533,11 @@  discard block
 block discarded – undo
1533 1533
 	public static function maybe_highlight_menu( $post_type ) {
1534 1534
         global $post;
1535 1535
 
1536
-        if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1536
+        if ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] != $post_type ) {
1537 1537
             return;
1538 1538
         }
1539 1539
 
1540
-        if ( is_object($post) && $post->post_type != $post_type ) {
1540
+        if ( is_object( $post ) && $post->post_type != $post_type ) {
1541 1541
             return;
1542 1542
         }
1543 1543
 
@@ -1641,11 +1641,11 @@  discard block
 block discarded – undo
1641 1641
         $frm_version = self::plugin_version();
1642 1642
 
1643 1643
         // check if Formidable meets minimum requirements
1644
-        if ( version_compare($frm_version, $min_version, '>=') ) {
1644
+        if ( version_compare( $frm_version, $min_version, '>=' ) ) {
1645 1645
             return;
1646 1646
         }
1647 1647
 
1648
-        $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1648
+        $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
1649 1649
 		echo '<tr class="plugin-update-tr active"><th colspan="' . absint( $wp_list_table->get_column_count() ) . '" class="check-column plugin-update colspanchange"><div class="update-message">' .
1650 1650
         __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1651 1651
         '</div></td></tr>';
@@ -1653,38 +1653,38 @@  discard block
 block discarded – undo
1653 1653
 
1654 1654
     public static function locales( $type = 'date' ) {
1655 1655
         $locales = array(
1656
-            'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1657
-            'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1658
-            'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1656
+            'en' => __( 'English', 'formidable' ), '' => __( 'English/Western', 'formidable' ),
1657
+            'af' => __( 'Afrikaans', 'formidable' ), 'sq' => __( 'Albanian', 'formidable' ),
1658
+            'ar' => __( 'Arabic', 'formidable' ), 'hy' => __( 'Armenian', 'formidable' ),
1659 1659
             'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1660
-            'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1661
-            'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1660
+            'bs' => __( 'Bosnian', 'formidable' ), 'bg' => __( 'Bulgarian', 'formidable' ),
1661
+            'ca' => __( 'Catalan', 'formidable' ), 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1662 1662
             'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1663
-            'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1664
-            'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1663
+            'hr' => __( 'Croatian', 'formidable' ), 'cs' => __( 'Czech', 'formidable' ),
1664
+            'da' => __( 'Danish', 'formidable' ), 'nl' => __( 'Dutch', 'formidable' ),
1665 1665
             'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1666
-            'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1666
+            'et' => __( 'Estonian', 'formidable' ), 'fo' => __( 'Faroese', 'formidable' ),
1667 1667
             'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1668
-            'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1668
+            'fi' => __( 'Finnish', 'formidable' ), 'fr' => __( 'French', 'formidable' ),
1669 1669
             'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1670
-            'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1670
+            'de' => __( 'German', 'formidable' ), 'de-AT' => __( 'German/Austria', 'formidable' ),
1671 1671
             'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1672
-            'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1673
-            'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1674
-            'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1675
-            'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1676
-            'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1672
+            'he' => __( 'Hebrew', 'formidable' ), 'iw' => __( 'Hebrew', 'formidable' ),
1673
+            'hi' => __( 'Hindi', 'formidable' ), 'hu' => __( 'Hungarian', 'formidable' ),
1674
+            'is' => __( 'Icelandic', 'formidable' ), 'id' => __( 'Indonesian', 'formidable' ),
1675
+            'it' => __( 'Italian', 'formidable' ), 'ja' => __( 'Japanese', 'formidable' ),
1676
+            'ko' => __( 'Korean', 'formidable' ), 'lv' => __( 'Latvian', 'formidable' ),
1677 1677
             'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1678
-            'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1678
+            'no' => __( 'Norwegian', 'formidable' ), 'pl' => __( 'Polish', 'formidable' ),
1679 1679
             'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1680 1680
             'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1681
-            'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1681
+            'ru' => __( 'Russian', 'formidable' ), 'sr' => __( 'Serbian', 'formidable' ),
1682 1682
             'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1683
-            'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1683
+            'sl' => __( 'Slovenian', 'formidable' ), 'es' => __( 'Spanish', 'formidable' ),
1684 1684
             'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1685
-            'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1686
-            'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1687
-            'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1685
+            'ta' => __( 'Tamil', 'formidable' ), 'th' => __( 'Thai', 'formidable' ),
1686
+            'tu' => __( 'Turkish', 'formidable' ), 'tr' => __( 'Turkish', 'formidable' ),
1687
+            'uk' => __( 'Ukranian', 'formidable' ), 'vi' => __( 'Vietnamese', 'formidable' ),
1688 1688
         );
1689 1689
 
1690 1690
         if ( $type == 'captcha' ) {
@@ -1703,8 +1703,8 @@  discard block
 block discarded – undo
1703 1703
             );
1704 1704
         }
1705 1705
 
1706
-        $locales = array_diff_key($locales, array_flip($unset));
1707
-        $locales = apply_filters('frm_locales', $locales);
1706
+        $locales = array_diff_key( $locales, array_flip( $unset ) );
1707
+        $locales = apply_filters( 'frm_locales', $locales );
1708 1708
 
1709 1709
         return $locales;
1710 1710
     }
Please login to merge, or discard this patch.