Completed
Push — master ( e08879...5d9c9e )
by Stephanie
08:11
created
classes/helpers/FrmAppHelper.php 2 patches
Indentation   +1114 added lines, -1114 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.0.23b1';
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
35
-        return plugins_url( '', self::plugin_path() .'/formidable.php' );
36
-    }
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
+		return plugins_url( '', self::plugin_path() .'/formidable.php' );
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();
@@ -75,21 +75,21 @@  discard block
 block discarded – undo
75 75
 		return $affiliate_id;
76 76
 	}
77 77
 
78
-    /**
79
-     * Get the Formidable settings
80
-     *
81
-     * @since 2.0
82
-     *
83
-     * @param None
84
-     * @return FrmSettings $frm_setings
85
-     */
86
-    public static function get_settings() {
87
-        global $frm_settings;
88
-        if ( empty($frm_settings) ) {
89
-            $frm_settings = new FrmSettings();
90
-        }
91
-        return $frm_settings;
92
-    }
78
+	/**
79
+	 * Get the Formidable settings
80
+	 *
81
+	 * @since 2.0
82
+	 *
83
+	 * @param None
84
+	 * @return FrmSettings $frm_setings
85
+	 */
86
+	public static function get_settings() {
87
+		global $frm_settings;
88
+		if ( empty($frm_settings) ) {
89
+			$frm_settings = new FrmSettings();
90
+		}
91
+		return $frm_settings;
92
+	}
93 93
 
94 94
 	public static function get_menu_name() {
95 95
 		$frm_settings = FrmAppHelper::get_settings();
@@ -97,62 +97,62 @@  discard block
 block discarded – undo
97 97
 		return empty( $menu_name ) ? __( 'Forms', 'formidable' ) : $menu_name;
98 98
 	}
99 99
 
100
-    /**
101
-     * Show a message in place of pro features
102
-     *
103
-     * @since 2.0
104
-     */
100
+	/**
101
+	 * Show a message in place of pro features
102
+	 *
103
+	 * @since 2.0
104
+	 */
105 105
 	public static function update_message( $features, $class = '' ) {
106 106
 		_deprecated_function( __FUNCTION__, '2.0.19' );
107
-    }
108
-
109
-    public static function pro_is_installed() {
110
-        return apply_filters('frm_pro_installed', false);
111
-    }
112
-
113
-    /**
114
-     * Check for certain page in Formidable settings
115
-     *
116
-     * @since 2.0
117
-     *
118
-     * @param string $page The name of the page to check
119
-     * @return boolean
120
-     */
107
+	}
108
+
109
+	public static function pro_is_installed() {
110
+		return apply_filters('frm_pro_installed', false);
111
+	}
112
+
113
+	/**
114
+	 * Check for certain page in Formidable settings
115
+	 *
116
+	 * @since 2.0
117
+	 *
118
+	 * @param string $page The name of the page to check
119
+	 * @return boolean
120
+	 */
121 121
 	public static function is_admin_page( $page = 'formidable' ) {
122
-        global $pagenow;
122
+		global $pagenow;
123 123
 		$get_page = self::simple_get( 'page', 'sanitize_title' );
124
-        if ( $pagenow ) {
124
+		if ( $pagenow ) {
125 125
 			return $pagenow == 'admin.php' && $get_page == $page;
126
-        }
126
+		}
127 127
 
128 128
 		return is_admin() && $get_page == $page;
129
-    }
130
-
131
-    /**
132
-     * Check for the form preview page
133
-     *
134
-     * @since 2.0
135
-     *
136
-     * @param None
137
-     * @return boolean
138
-     */
139
-    public static function is_preview_page() {
140
-        global $pagenow;
129
+	}
130
+
131
+	/**
132
+	 * Check for the form preview page
133
+	 *
134
+	 * @since 2.0
135
+	 *
136
+	 * @param None
137
+	 * @return boolean
138
+	 */
139
+	public static function is_preview_page() {
140
+		global $pagenow;
141 141
 		$action = FrmAppHelper::simple_get( 'action', 'sanitize_title' );
142 142
 		return $pagenow && $pagenow == 'admin-ajax.php' && $action == 'frm_forms_preview';
143
-    }
143
+	}
144 144
 
145
-    /**
146
-     * Check for ajax except the form preview page
147
-     *
148
-     * @since 2.0
149
-     *
150
-     * @param None
151
-     * @return boolean
152
-     */
153
-    public static function doing_ajax() {
154
-        return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
155
-    }
145
+	/**
146
+	 * Check for ajax except the form preview page
147
+	 *
148
+	 * @since 2.0
149
+	 *
150
+	 * @param None
151
+	 * @return boolean
152
+	 */
153
+	public static function doing_ajax() {
154
+		return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
155
+	}
156 156
 
157 157
 	/**
158 158
 	 * @since 2.0.8
@@ -162,101 +162,101 @@  discard block
 block discarded – undo
162 162
 		return isset( $frm_vars['prevent_caching'] ) && $frm_vars['prevent_caching'];
163 163
 	}
164 164
 
165
-    /**
166
-     * Check if on an admin page
167
-     *
168
-     * @since 2.0
169
-     *
170
-     * @param None
171
-     * @return boolean
172
-     */
173
-    public static function is_admin() {
174
-        return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
175
-    }
176
-
177
-    /**
178
-     * Check if value contains blank value or empty array
179
-     *
180
-     * @since 2.0
181
-     * @param $value - value to check
182
-     * @return boolean
183
-     */
184
-    public static function is_empty_value( $value, $empty = '' ) {
185
-        return ( is_array( $value ) && empty( $value ) ) || $value == $empty;
186
-    }
187
-
188
-    public static function is_not_empty_value( $value, $empty = '' ) {
189
-        return ! self::is_empty_value( $value, $empty );
190
-    }
191
-
192
-    /**
193
-     * Get any value from the $_SERVER
194
-     *
195
-     * @since 2.0
196
-     * @param string $value
197
-     * @return string
198
-     */
165
+	/**
166
+	 * Check if on an admin page
167
+	 *
168
+	 * @since 2.0
169
+	 *
170
+	 * @param None
171
+	 * @return boolean
172
+	 */
173
+	public static function is_admin() {
174
+		return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
175
+	}
176
+
177
+	/**
178
+	 * Check if value contains blank value or empty array
179
+	 *
180
+	 * @since 2.0
181
+	 * @param $value - value to check
182
+	 * @return boolean
183
+	 */
184
+	public static function is_empty_value( $value, $empty = '' ) {
185
+		return ( is_array( $value ) && empty( $value ) ) || $value == $empty;
186
+	}
187
+
188
+	public static function is_not_empty_value( $value, $empty = '' ) {
189
+		return ! self::is_empty_value( $value, $empty );
190
+	}
191
+
192
+	/**
193
+	 * Get any value from the $_SERVER
194
+	 *
195
+	 * @since 2.0
196
+	 * @param string $value
197
+	 * @return string
198
+	 */
199 199
 	public static function get_server_value( $value ) {
200
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
201
-    }
202
-
203
-    /**
204
-     * Check for the IP address in several places
205
-     * Used by [ip] shortcode
206
-     *
207
-     * @return string The IP address of the current user
208
-     */
209
-    public static function get_ip_address() {
200
+		return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
201
+	}
202
+
203
+	/**
204
+	 * Check for the IP address in several places
205
+	 * Used by [ip] shortcode
206
+	 *
207
+	 * @return string The IP address of the current user
208
+	 */
209
+	public static function get_ip_address() {
210 210
 		$ip = '';
211
-        foreach ( array(
212
-            'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
213
-            'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
214
-        ) as $key ) {
215
-            if ( ! isset( $_SERVER[ $key ] ) ) {
216
-                continue;
217
-            }
218
-
219
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
220
-                $ip = trim($ip); // just to be safe
221
-
222
-                if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
223
-                    return $ip;
224
-                }
225
-            }
226
-        }
211
+		foreach ( array(
212
+			'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
213
+			'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
214
+		) as $key ) {
215
+			if ( ! isset( $_SERVER[ $key ] ) ) {
216
+				continue;
217
+			}
218
+
219
+			foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
220
+				$ip = trim($ip); // just to be safe
221
+
222
+				if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
223
+					return $ip;
224
+				}
225
+			}
226
+		}
227 227
 
228 228
 		return sanitize_text_field( $ip );
229
-    }
229
+	}
230 230
 
231
-    public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
232
-        if ( strpos($param, '[') ) {
233
-            $params = explode('[', $param);
234
-            $param = $params[0];
235
-        }
231
+	public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
232
+		if ( strpos($param, '[') ) {
233
+			$params = explode('[', $param);
234
+			$param = $params[0];
235
+		}
236 236
 
237 237
 		if ( $src == 'get' ) {
238
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
239
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
240
-                $value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[ $param ] ) ) );
241
-            }
238
+			$value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
239
+			if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
240
+				$value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[ $param ] ) ) );
241
+			}
242 242
 			self::sanitize_value( $sanitize, $value );
243 243
 		} else {
244
-            $value = self::get_simple_request( array( 'type' => $src, 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
245
-        }
244
+			$value = self::get_simple_request( array( 'type' => $src, 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
245
+		}
246 246
 
247 247
 		if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
248
-            foreach ( $params as $k => $p ) {
249
-                if ( ! $k || ! is_array($value) ) {
250
-                    continue;
251
-                }
248
+			foreach ( $params as $k => $p ) {
249
+				if ( ! $k || ! is_array($value) ) {
250
+					continue;
251
+				}
252 252
 
253
-                $p = trim($p, ']');
254
-                $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
255
-            }
256
-        }
253
+				$p = trim($p, ']');
254
+				$value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
255
+			}
256
+		}
257 257
 
258
-        return $value;
259
-    }
258
+		return $value;
259
+	}
260 260
 
261 261
 	/**
262 262
 	 *
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	public static function simple_get( $param, $sanitize = 'sanitize_text_field', $default = '' ) {
279 279
 		return self::get_simple_request( array( 'type' => 'get', 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
280
-    }
280
+	}
281 281
 
282 282
 	/**
283 283
 	 * Get a GET/POST/REQUEST value and sanitize it
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
 	}
312 312
 
313 313
 	/**
314
-	* Preserve backslashes in a value, but make sure value doesn't get compounding slashes
315
-	*
316
-	* @since 2.0.8
317
-	* @param string $value
318
-	* @return string $value
319
-	*/
314
+	 * Preserve backslashes in a value, but make sure value doesn't get compounding slashes
315
+	 *
316
+	 * @since 2.0.8
317
+	 * @param string $value
318
+	 * @return string $value
319
+	 */
320 320
 	public static function preserve_backslashes( $value ) {
321 321
 		// If backslashes have already been added, don't add them again
322 322
 		if ( strpos( $value, '\\\\' ) === false ) {
@@ -335,14 +335,14 @@  discard block
 block discarded – undo
335 335
 		}
336 336
 	}
337 337
 
338
-    public static function sanitize_request( $sanitize_method, &$values ) {
339
-        $temp_values = $values;
340
-        foreach ( $temp_values as $k => $val ) {
341
-            if ( isset( $sanitize_method[ $k ] ) ) {
338
+	public static function sanitize_request( $sanitize_method, &$values ) {
339
+		$temp_values = $values;
340
+		foreach ( $temp_values as $k => $val ) {
341
+			if ( isset( $sanitize_method[ $k ] ) ) {
342 342
 				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
343
-            }
344
-        }
345
-    }
343
+			}
344
+		}
345
+	}
346 346
 
347 347
 	public static function sanitize_array( &$values ) {
348 348
 		$temp_values = $values;
@@ -357,12 +357,12 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	public static function kses( $value, $allowed = array() ) {
359 359
 		$html = array(
360
-		    'a' => array(
360
+			'a' => array(
361 361
 				'href'  => array(),
362 362
 				'title' => array(),
363 363
 				'id'    => array(),
364 364
 				'class' => array(),
365
-		    ),
365
+			),
366 366
 		);
367 367
 
368 368
 		$allowed_html = array();
@@ -373,176 +373,176 @@  discard block
 block discarded – undo
373 373
 		return wp_kses( $value, $allowed_html );
374 374
 	}
375 375
 
376
-    /**
377
-     * Used when switching the action for a bulk action
378
-     * @since 2.0
379
-     */
380
-    public static function remove_get_action() {
381
-        if ( ! isset($_GET) ) {
382
-            return;
383
-        }
376
+	/**
377
+	 * Used when switching the action for a bulk action
378
+	 * @since 2.0
379
+	 */
380
+	public static function remove_get_action() {
381
+		if ( ! isset($_GET) ) {
382
+			return;
383
+		}
384 384
 
385
-        $new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
386
-        if ( ! empty( $new_action ) ) {
385
+		$new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
386
+		if ( ! empty( $new_action ) ) {
387 387
 			$_SERVER['REQUEST_URI'] = str_replace( '&action=' . $new_action, '', FrmAppHelper::get_server_value( 'REQUEST_URI' ) );
388
-        }
389
-    }
390
-
391
-    /**
392
-     * Check the WP query for a parameter
393
-     *
394
-     * @since 2.0
395
-     * @return string|array
396
-     */
397
-    public static function get_query_var( $value, $param ) {
398
-        if ( $value != '' ) {
399
-            return $value;
400
-        }
401
-
402
-        global $wp_query;
403
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
404
-            $value = $wp_query->query_vars[ $param ];
405
-        }
406
-
407
-        return $value;
408
-    }
409
-
410
-    /**
411
-     * @param string $type
412
-     */
413
-    public static function trigger_hook_load( $type, $object = null ) {
414
-        // only load the form hooks once
415
-        $hooks_loaded = apply_filters('frm_'. $type .'_hooks_loaded', false, $object);
416
-        if ( ! $hooks_loaded ) {
417
-            do_action('frm_load_'. $type .'_hooks');
418
-        }
419
-    }
420
-
421
-    /**
422
-     * Check cache before fetching values and saving to cache
423
-     *
424
-     * @since 2.0
425
-     *
426
-     * @param string $cache_key The unique name for this cache
427
-     * @param string $group The name of the cache group
428
-     * @param string $query If blank, don't run a db call
429
-     * @param string $type The wpdb function to use with this query
430
-     * @return mixed $results The cache or query results
431
-     */
432
-    public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
433
-        $results = wp_cache_get($cache_key, $group);
434
-        if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
435
-            return $results;
436
-        }
437
-
438
-        if ( 'get_posts' == $type ) {
439
-            $results = get_posts($query);
440
-        } else {
441
-            global $wpdb;
442
-            $results = $wpdb->{$type}($query);
443
-        }
388
+		}
389
+	}
390
+
391
+	/**
392
+	 * Check the WP query for a parameter
393
+	 *
394
+	 * @since 2.0
395
+	 * @return string|array
396
+	 */
397
+	public static function get_query_var( $value, $param ) {
398
+		if ( $value != '' ) {
399
+			return $value;
400
+		}
401
+
402
+		global $wp_query;
403
+		if ( isset( $wp_query->query_vars[ $param ] ) ) {
404
+			$value = $wp_query->query_vars[ $param ];
405
+		}
406
+
407
+		return $value;
408
+	}
409
+
410
+	/**
411
+	 * @param string $type
412
+	 */
413
+	public static function trigger_hook_load( $type, $object = null ) {
414
+		// only load the form hooks once
415
+		$hooks_loaded = apply_filters('frm_'. $type .'_hooks_loaded', false, $object);
416
+		if ( ! $hooks_loaded ) {
417
+			do_action('frm_load_'. $type .'_hooks');
418
+		}
419
+	}
420
+
421
+	/**
422
+	 * Check cache before fetching values and saving to cache
423
+	 *
424
+	 * @since 2.0
425
+	 *
426
+	 * @param string $cache_key The unique name for this cache
427
+	 * @param string $group The name of the cache group
428
+	 * @param string $query If blank, don't run a db call
429
+	 * @param string $type The wpdb function to use with this query
430
+	 * @return mixed $results The cache or query results
431
+	 */
432
+	public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
433
+		$results = wp_cache_get($cache_key, $group);
434
+		if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
435
+			return $results;
436
+		}
437
+
438
+		if ( 'get_posts' == $type ) {
439
+			$results = get_posts($query);
440
+		} else {
441
+			global $wpdb;
442
+			$results = $wpdb->{$type}($query);
443
+		}
444 444
 
445 445
 		if ( ! self::prevent_caching() ) {
446 446
 			wp_cache_set( $cache_key, $results, $group, $time );
447 447
 		}
448 448
 
449
-        return $results;
450
-    }
449
+		return $results;
450
+	}
451 451
 
452
-    /**
453
-     * Data that should be stored for a long time can be stored in a transient.
454
-     * First check the cache, then check the transient
455
-     * @since 2.0
456
-     * @return mixed The cached value or false
457
-     */
452
+	/**
453
+	 * Data that should be stored for a long time can be stored in a transient.
454
+	 * First check the cache, then check the transient
455
+	 * @since 2.0
456
+	 * @return mixed The cached value or false
457
+	 */
458 458
 	public static function check_cache_and_transient( $cache_key ) {
459
-        // check caching layer first
460
-        $results = self::check_cache( $cache_key );
461
-        if ( $results ) {
462
-            return $results;
463
-        }
464
-
465
-        // then check the transient
466
-        $results = get_transient($cache_key);
467
-        if ( $results ) {
468
-            wp_cache_set($cache_key, $results);
469
-        }
470
-
471
-        return $results;
472
-    }
473
-
474
-    /**
475
-     * @since 2.0
476
-     * @param string $cache_key
477
-     */
459
+		// check caching layer first
460
+		$results = self::check_cache( $cache_key );
461
+		if ( $results ) {
462
+			return $results;
463
+		}
464
+
465
+		// then check the transient
466
+		$results = get_transient($cache_key);
467
+		if ( $results ) {
468
+			wp_cache_set($cache_key, $results);
469
+		}
470
+
471
+		return $results;
472
+	}
473
+
474
+	/**
475
+	 * @since 2.0
476
+	 * @param string $cache_key
477
+	 */
478 478
 	public static function delete_cache_and_transient( $cache_key ) {
479
-        delete_transient($cache_key);
480
-        wp_cache_delete($cache_key);
481
-    }
482
-
483
-    /**
484
-     * Delete all caching in a single group
485
-     *
486
-     * @since 2.0
487
-     *
488
-     * @param string $group The name of the cache group
489
-     * @return boolean True or False
490
-     */
479
+		delete_transient($cache_key);
480
+		wp_cache_delete($cache_key);
481
+	}
482
+
483
+	/**
484
+	 * Delete all caching in a single group
485
+	 *
486
+	 * @since 2.0
487
+	 *
488
+	 * @param string $group The name of the cache group
489
+	 * @return boolean True or False
490
+	 */
491 491
 	public static function cache_delete_group( $group ) {
492
-    	global $wp_object_cache;
493
-
494
-        if ( isset( $wp_object_cache->cache[ $group ] ) ) {
495
-            foreach ( $wp_object_cache->cache[ $group ] as $k => $v ) {
496
-                wp_cache_delete($k, $group);
497
-            }
498
-            return true;
499
-        }
500
-
501
-    	return false;
502
-    }
503
-
504
-    /**
505
-     * Check a value from a shortcode to see if true or false.
506
-     * True when value is 1, true, 'true', 'yes'
507
-     *
508
-     * @since 1.07.10
509
-     *
510
-     * @param string $value The value to compare
511
-     * @return boolean True or False
512
-     */
492
+		global $wp_object_cache;
493
+
494
+		if ( isset( $wp_object_cache->cache[ $group ] ) ) {
495
+			foreach ( $wp_object_cache->cache[ $group ] as $k => $v ) {
496
+				wp_cache_delete($k, $group);
497
+			}
498
+			return true;
499
+		}
500
+
501
+		return false;
502
+	}
503
+
504
+	/**
505
+	 * Check a value from a shortcode to see if true or false.
506
+	 * True when value is 1, true, 'true', 'yes'
507
+	 *
508
+	 * @since 1.07.10
509
+	 *
510
+	 * @param string $value The value to compare
511
+	 * @return boolean True or False
512
+	 */
513 513
 	public static function is_true( $value ) {
514
-        return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
515
-    }
514
+		return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
515
+	}
516 516
 
517
-    /**
518
-     * Used to filter shortcode in text widgets
519
-     */
520
-    public static function widget_text_filter_callback( $matches ) {
521
-        return do_shortcode( $matches[0] );
522
-    }
517
+	/**
518
+	 * Used to filter shortcode in text widgets
519
+	 */
520
+	public static function widget_text_filter_callback( $matches ) {
521
+		return do_shortcode( $matches[0] );
522
+	}
523 523
 
524 524
 	public static function load_scripts( $scripts ) {
525
-        _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_script' );
526
-        foreach ( (array) $scripts as $s ) {
527
-            wp_enqueue_script($s);
528
-        }
529
-    }
525
+		_deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_script' );
526
+		foreach ( (array) $scripts as $s ) {
527
+			wp_enqueue_script($s);
528
+		}
529
+	}
530 530
 
531 531
 	public static function load_styles( $styles ) {
532
-        _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_style' );
533
-        foreach ( (array) $styles as $s ) {
534
-            wp_enqueue_style($s);
535
-        }
536
-    }
532
+		_deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_style' );
533
+		foreach ( (array) $styles as $s ) {
534
+			wp_enqueue_style($s);
535
+		}
536
+	}
537 537
 
538
-    public static function get_pages() {
538
+	public static function get_pages() {
539 539
 		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
540
-    }
540
+	}
541 541
 
542
-    public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
543
-        $pages = self::get_pages();
542
+	public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
543
+		$pages = self::get_pages();
544 544
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
545
-    ?>
545
+	?>
546 546
         <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
547 547
             <option value=""> </option>
548 548
             <?php foreach ( $pages as $page ) { ?>
@@ -552,107 +552,107 @@  discard block
 block discarded – undo
552 552
             <?php } ?>
553 553
         </select>
554 554
     <?php
555
-    }
555
+	}
556 556
 
557 557
 	public static function post_edit_link( $post_id ) {
558
-        $post = get_post($post_id);
559
-        if ( $post ) {
558
+		$post = get_post($post_id);
559
+		if ( $post ) {
560 560
 			return '<a href="'. esc_url( admin_url('post.php?post='. $post_id .'&action=edit') ) .'">'. self::truncate( $post->post_title, 50 ) .'</a>';
561
-        }
562
-        return '';
563
-    }
561
+		}
562
+		return '';
563
+	}
564 564
 
565 565
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
566
-    ?>
566
+	?>
567 567
         <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" <?php
568
-            echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
569
-            ?> class="frm_multiselect">
568
+			echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
569
+			?> class="frm_multiselect">
570 570
             <?php self::roles_options($capability); ?>
571 571
         </select>
572 572
     <?php
573
-    }
573
+	}
574 574
 
575 575
 	public static function roles_options( $capability ) {
576
-        global $frm_vars;
577
-        if ( isset($frm_vars['editable_roles']) ) {
578
-            $editable_roles = $frm_vars['editable_roles'];
579
-        } else {
580
-            $editable_roles = get_editable_roles();
581
-            $frm_vars['editable_roles'] = $editable_roles;
582
-        }
583
-
584
-        foreach ( $editable_roles as $role => $details ) {
585
-            $name = translate_user_role($details['name'] ); ?>
576
+		global $frm_vars;
577
+		if ( isset($frm_vars['editable_roles']) ) {
578
+			$editable_roles = $frm_vars['editable_roles'];
579
+		} else {
580
+			$editable_roles = get_editable_roles();
581
+			$frm_vars['editable_roles'] = $editable_roles;
582
+		}
583
+
584
+		foreach ( $editable_roles as $role => $details ) {
585
+			$name = translate_user_role($details['name'] ); ?>
586 586
         <option value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, (array) $capability) ? ' selected="selected"' : ''; ?>><?php echo esc_attr($name) ?> </option>
587 587
 <?php
588
-            unset($role, $details);
589
-        }
590
-    }
588
+			unset($role, $details);
589
+		}
590
+	}
591 591
 
592 592
 	public static function frm_capabilities( $type = 'auto' ) {
593
-        $cap = array(
594
-            'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
595
-            'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
596
-            'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
597
-            'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
598
-            'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
599
-            'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
600
-        );
593
+		$cap = array(
594
+			'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
595
+			'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
596
+			'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
597
+			'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
598
+			'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
599
+			'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
600
+		);
601 601
 
602 602
 		if ( ! self::pro_is_installed() && 'pro' != $type ) {
603
-            return $cap;
604
-        }
603
+			return $cap;
604
+		}
605 605
 
606
-        $cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
607
-        $cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
608
-        $cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
609
-        $cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
606
+		$cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
607
+		$cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
608
+		$cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
609
+		$cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
610 610
 
611
-        return $cap;
612
-    }
611
+		return $cap;
612
+	}
613 613
 
614 614
 	public static function user_has_permission( $needed_role ) {
615
-        if ( $needed_role == '-1' ) {
616
-            return false;
615
+		if ( $needed_role == '-1' ) {
616
+			return false;
617 617
 		}
618 618
 
619
-        // $needed_role will be equal to blank if "Logged-in users" is selected
620
-        if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
621
-            return true;
622
-        }
619
+		// $needed_role will be equal to blank if "Logged-in users" is selected
620
+		if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
621
+			return true;
622
+		}
623 623
 
624
-        $roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
625
-        foreach ( $roles as $role ) {
624
+		$roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
625
+		foreach ( $roles as $role ) {
626 626
 			if ( current_user_can( $role ) ) {
627
-        		return true;
627
+				return true;
628 628
 			}
629
-        	if ( $role == $needed_role ) {
630
-        		break;
629
+			if ( $role == $needed_role ) {
630
+				break;
631 631
 			}
632
-        }
633
-        return false;
634
-    }
635
-
636
-    /**
637
-     * Make sure administrators can see Formidable menu
638
-     *
639
-     * @since 2.0
640
-     */
641
-    public static function maybe_add_permissions() {
632
+		}
633
+		return false;
634
+	}
635
+
636
+	/**
637
+	 * Make sure administrators can see Formidable menu
638
+	 *
639
+	 * @since 2.0
640
+	 */
641
+	public static function maybe_add_permissions() {
642 642
 		self::force_capability( 'frm_view_entries' );
643 643
 
644
-        if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
645
-            return;
646
-        }
644
+		if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
645
+			return;
646
+		}
647 647
 
648 648
 		$user_id = get_current_user_id();
649 649
 		$user = new WP_User( $user_id );
650
-        $frm_roles = self::frm_capabilities();
651
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
650
+		$frm_roles = self::frm_capabilities();
651
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
652 652
 			$user->add_cap( $frm_role );
653
-            unset($frm_role, $frm_role_description);
654
-        }
655
-    }
653
+			unset($frm_role, $frm_role_description);
654
+		}
655
+	}
656 656
 
657 657
 	/**
658 658
 	 * Make sure admins have permission to see the menu items
@@ -668,28 +668,28 @@  discard block
 block discarded – undo
668 668
 		}
669 669
 	}
670 670
 
671
-    /**
672
-     * Check if the user has permision for action.
673
-     * Return permission message and stop the action if no permission
674
-     * @since 2.0
675
-     * @param string $permission
676
-     */
671
+	/**
672
+	 * Check if the user has permision for action.
673
+	 * Return permission message and stop the action if no permission
674
+	 * @since 2.0
675
+	 * @param string $permission
676
+	 */
677 677
 	public static function permission_check( $permission, $show_message = 'show' ) {
678
-        $permission_error = self::permission_nonce_error($permission);
679
-        if ( $permission_error !== false ) {
680
-            if ( 'hide' == $show_message ) {
681
-                $permission_error = '';
682
-            }
683
-            wp_die($permission_error);
684
-        }
685
-    }
686
-
687
-    /**
688
-     * Check user permission and nonce
689
-     * @since 2.0
690
-     * @param string $permission
691
-     * @return false|string The permission message or false if allowed
692
-     */
678
+		$permission_error = self::permission_nonce_error($permission);
679
+		if ( $permission_error !== false ) {
680
+			if ( 'hide' == $show_message ) {
681
+				$permission_error = '';
682
+			}
683
+			wp_die($permission_error);
684
+		}
685
+	}
686
+
687
+	/**
688
+	 * Check user permission and nonce
689
+	 * @since 2.0
690
+	 * @param string $permission
691
+	 * @return false|string The permission message or false if allowed
692
+	 */
693 693
 	public static function permission_nonce_error( $permission, $nonce_name = '', $nonce = '' ) {
694 694
 		if ( ! empty( $permission ) && ! current_user_can( $permission ) && ! current_user_can( 'administrator' ) ) {
695 695
 			$frm_settings = self::get_settings();
@@ -697,23 +697,23 @@  discard block
 block discarded – undo
697 697
 		}
698 698
 
699 699
 		$error = false;
700
-        if ( empty($nonce_name) ) {
701
-            return $error;
702
-        }
700
+		if ( empty($nonce_name) ) {
701
+			return $error;
702
+		}
703 703
 
704
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
705
-            $frm_settings = self::get_settings();
706
-            $error = $frm_settings->admin_permission;
707
-        }
704
+		if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
705
+			$frm_settings = self::get_settings();
706
+			$error = $frm_settings->admin_permission;
707
+		}
708 708
 
709
-        return $error;
710
-    }
709
+		return $error;
710
+	}
711 711
 
712
-    public static function checked( $values, $current ) {
712
+	public static function checked( $values, $current ) {
713 713
 		if ( self::check_selected( $values, $current ) ) {
714
-            echo ' checked="checked"';
714
+			echo ' checked="checked"';
715 715
 		}
716
-    }
716
+	}
717 717
 
718 718
 	public static function check_selected( $values, $current ) {
719 719
 		$values = self::recursive_function_map( $values, 'trim' );
@@ -723,50 +723,50 @@  discard block
 block discarded – undo
723 723
 		return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current );
724 724
 	}
725 725
 
726
-    /**
727
-    * Check if current field option is an "other" option
728
-    *
729
-    * @since 2.0
730
-    *
731
-    * @param string $opt_key
732
-    * @return boolean Returns true if current field option is an "Other" option
733
-    */
734
-    public static function is_other_opt( $opt_key ) {
735
-        _deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::is_other_opt' );
736
-        return FrmFieldsHelper::is_other_opt( $opt_key );
737
-    }
738
-
739
-    /**
740
-    * Get value that belongs in "Other" text box
741
-    *
742
-    * @since 2.0
743
-    *
744
-    * @param string $opt_key
745
-    * @param array $field
746
-    * @return string $other_val
747
-    */
748
-    public static function get_other_val( $opt_key, $field, $parent = false, $pointer = false ) {
726
+	/**
727
+	 * Check if current field option is an "other" option
728
+	 *
729
+	 * @since 2.0
730
+	 *
731
+	 * @param string $opt_key
732
+	 * @return boolean Returns true if current field option is an "Other" option
733
+	 */
734
+	public static function is_other_opt( $opt_key ) {
735
+		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::is_other_opt' );
736
+		return FrmFieldsHelper::is_other_opt( $opt_key );
737
+	}
738
+
739
+	/**
740
+	 * Get value that belongs in "Other" text box
741
+	 *
742
+	 * @since 2.0
743
+	 *
744
+	 * @param string $opt_key
745
+	 * @param array $field
746
+	 * @return string $other_val
747
+	 */
748
+	public static function get_other_val( $opt_key, $field, $parent = false, $pointer = false ) {
749 749
 		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::get_other_val' );
750 750
 		return FrmFieldsHelper::get_other_val( compact( 'opt_key', 'field', 'parent', 'pointer' ) );
751
-    }
752
-
753
-    /**
754
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
755
-    * Intended for front-end use
756
-    *
757
-    * @since 2.0
758
-    *
759
-    * @param array $field
760
-    * @param boolean $other_opt
761
-    * @param string $checked
762
-    * @param array $args should include opt_key and field name
763
-    * @return string $other_val
764
-    */
765
-    public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
751
+	}
752
+
753
+	/**
754
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
755
+	 * Intended for front-end use
756
+	 *
757
+	 * @since 2.0
758
+	 *
759
+	 * @param array $field
760
+	 * @param boolean $other_opt
761
+	 * @param string $checked
762
+	 * @param array $args should include opt_key and field name
763
+	 * @return string $other_val
764
+	 */
765
+	public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
766 766
 		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::prepare_other_input' );
767 767
 		$args['field'] = $field;
768 768
 		return FrmFieldsHelper::prepare_other_input( $args, $other_opt, $checked );
769
-    }
769
+	}
770 770
 
771 771
 	public static function recursive_function_map( $value, $function ) {
772 772
 		if ( is_array( $value ) ) {
@@ -796,331 +796,331 @@  discard block
 block discarded – undo
796 796
 		return (bool) count( array_filter( array_keys( $array ), 'is_string' ) );
797 797
 	}
798 798
 
799
-    /**
800
-     * Flatten a multi-dimensional array
801
-     */
799
+	/**
800
+	 * Flatten a multi-dimensional array
801
+	 */
802 802
 	public static function array_flatten( $array, $keys = 'keep' ) {
803
-        $return = array();
804
-        foreach ( $array as $key => $value ) {
805
-            if ( is_array($value) ) {
803
+		$return = array();
804
+		foreach ( $array as $key => $value ) {
805
+			if ( is_array($value) ) {
806 806
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
807
-            } else {
807
+			} else {
808 808
 				if ( $keys == 'keep' ) {
809 809
 					$return[ $key ] = $value;
810 810
 				} else {
811 811
 					$return[] = $value;
812 812
 				}
813
-            }
814
-        }
815
-        return $return;
816
-    }
817
-
818
-    public static function esc_textarea( $text ) {
819
-        $safe_text = str_replace('&quot;', '"', $text);
820
-        $safe_text = htmlspecialchars( $safe_text, ENT_NOQUOTES );
821
-    	return apply_filters( 'esc_textarea', $safe_text, $text );
822
-    }
823
-
824
-    /**
825
-     * Add auto paragraphs to text areas
826
-     * @since 2.0
827
-     */
813
+			}
814
+		}
815
+		return $return;
816
+	}
817
+
818
+	public static function esc_textarea( $text ) {
819
+		$safe_text = str_replace('&quot;', '"', $text);
820
+		$safe_text = htmlspecialchars( $safe_text, ENT_NOQUOTES );
821
+		return apply_filters( 'esc_textarea', $safe_text, $text );
822
+	}
823
+
824
+	/**
825
+	 * Add auto paragraphs to text areas
826
+	 * @since 2.0
827
+	 */
828 828
 	public static function use_wpautop( $content ) {
829
-        if ( apply_filters('frm_use_wpautop', true) ) {
830
-            $content = wpautop(str_replace( '<br>', '<br />', $content));
831
-        }
832
-        return $content;
833
-    }
829
+		if ( apply_filters('frm_use_wpautop', true) ) {
830
+			$content = wpautop(str_replace( '<br>', '<br />', $content));
831
+		}
832
+		return $content;
833
+	}
834 834
 
835 835
 	public static function replace_quotes( $val ) {
836
-        //Replace double quotes
836
+		//Replace double quotes
837 837
 		$val = str_replace( array( '&#8220;', '&#8221;', '&#8243;' ), '"', $val );
838
-        //Replace single quotes
839
-        $val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
840
-        return $val;
841
-    }
842
-
843
-    /**
844
-     * @since 2.0
845
-     * @return string The base Google APIS url for the current version of jQuery UI
846
-     */
847
-    public static function jquery_ui_base_url() {
848
-        $url = 'http'. ( is_ssl() ? 's' : '' ) .'://ajax.googleapis.com/ajax/libs/jqueryui/'. self::script_version('jquery-ui-core');
849
-        $url = apply_filters('frm_jquery_ui_base_url', $url);
850
-        return $url;
851
-    }
852
-
853
-    /**
854
-     * @param string $handle
855
-     */
838
+		//Replace single quotes
839
+		$val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
840
+		return $val;
841
+	}
842
+
843
+	/**
844
+	 * @since 2.0
845
+	 * @return string The base Google APIS url for the current version of jQuery UI
846
+	 */
847
+	public static function jquery_ui_base_url() {
848
+		$url = 'http'. ( is_ssl() ? 's' : '' ) .'://ajax.googleapis.com/ajax/libs/jqueryui/'. self::script_version('jquery-ui-core');
849
+		$url = apply_filters('frm_jquery_ui_base_url', $url);
850
+		return $url;
851
+	}
852
+
853
+	/**
854
+	 * @param string $handle
855
+	 */
856 856
 	public static function script_version( $handle ) {
857
-        global $wp_scripts;
858
-    	if ( ! $wp_scripts ) {
859
-    	    return false;
860
-    	}
857
+		global $wp_scripts;
858
+		if ( ! $wp_scripts ) {
859
+			return false;
860
+		}
861 861
 
862
-        $ver = 0;
862
+		$ver = 0;
863 863
 
864
-        if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
865
-            return $ver;
866
-        }
864
+		if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
865
+			return $ver;
866
+		}
867 867
 
868
-        $query = $wp_scripts->registered[ $handle ];
869
-    	if ( is_object( $query ) ) {
870
-    	    $ver = $query->ver;
871
-    	}
868
+		$query = $wp_scripts->registered[ $handle ];
869
+		if ( is_object( $query ) ) {
870
+			$ver = $query->ver;
871
+		}
872 872
 
873
-    	return $ver;
874
-    }
873
+		return $ver;
874
+	}
875 875
 
876 876
 	public static function js_redirect( $url ) {
877 877
 		return '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>';
878
-    }
878
+	}
879 879
 
880 880
 	public static function get_user_id_param( $user_id ) {
881
-        if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
882
-            return $user_id;
883
-        }
881
+		if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
882
+			return $user_id;
883
+		}
884 884
 
885 885
 		if ( $user_id == 'current' ) {
886 886
 			$user_id = get_current_user_id();
887 887
 		} else {
888
-            if ( is_email($user_id) ) {
889
-                $user = get_user_by('email', $user_id);
890
-            } else {
891
-                $user = get_user_by('login', $user_id);
892
-            }
888
+			if ( is_email($user_id) ) {
889
+				$user = get_user_by('email', $user_id);
890
+			} else {
891
+				$user = get_user_by('login', $user_id);
892
+			}
893 893
 
894
-            if ( $user ) {
895
-                $user_id = $user->ID;
896
-            }
897
-            unset($user);
898
-        }
894
+			if ( $user ) {
895
+				$user_id = $user->ID;
896
+			}
897
+			unset($user);
898
+		}
899 899
 
900
-        return $user_id;
901
-    }
900
+		return $user_id;
901
+	}
902 902
 
903 903
 	public static function get_file_contents( $filename, $atts = array() ) {
904
-        if ( ! is_file($filename) ) {
905
-            return false;
906
-        }
907
-
908
-        extract($atts);
909
-        ob_start();
910
-        include($filename);
911
-        $contents = ob_get_contents();
912
-        ob_end_clean();
913
-        return $contents;
914
-    }
915
-
916
-    /**
917
-     * @param string $table_name
918
-     * @param string $column
904
+		if ( ! is_file($filename) ) {
905
+			return false;
906
+		}
907
+
908
+		extract($atts);
909
+		ob_start();
910
+		include($filename);
911
+		$contents = ob_get_contents();
912
+		ob_end_clean();
913
+		return $contents;
914
+	}
915
+
916
+	/**
917
+	 * @param string $table_name
918
+	 * @param string $column
919 919
 	 * @param int $id
920 920
 	 * @param int $num_chars
921
-     */
922
-    public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
923
-        $key = '';
921
+	 */
922
+	public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
923
+		$key = '';
924 924
 
925
-        if ( ! empty( $name ) ) {
926
-            $key = sanitize_key($name);
927
-        }
925
+		if ( ! empty( $name ) ) {
926
+			$key = sanitize_key($name);
927
+		}
928 928
 
929 929
 		if ( empty( $key ) ) {
930
-            $max_slug_value = pow(36, $num_chars);
931
-            $min_slug_value = 37; // we want to have at least 2 characters in the slug
932
-            $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
933
-        }
930
+			$max_slug_value = pow(36, $num_chars);
931
+			$min_slug_value = 37; // we want to have at least 2 characters in the slug
932
+			$key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
933
+		}
934 934
 
935 935
 		if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
936
-            $key = $key .'a';
937
-        }
936
+			$key = $key .'a';
937
+		}
938 938
 
939 939
 		$key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
940 940
 
941
-        if ( $key_check || is_numeric($key_check) ) {
942
-            $suffix = 2;
941
+		if ( $key_check || is_numeric($key_check) ) {
942
+			$suffix = 2;
943 943
 			do {
944 944
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
945 945
 				$key_check = FrmDb::get_var( $table_name, array( $column => $alt_post_name, 'ID !' => $id ), $column );
946 946
 				$suffix++;
947 947
 			} while ($key_check || is_numeric($key_check));
948 948
 			$key = $alt_post_name;
949
-        }
950
-        return $key;
951
-    }
952
-
953
-    /**
954
-     * Editing a Form or Entry
955
-     * @param string $table
956
-     * @return bool|array
957
-     */
958
-    public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
959
-        if ( ! $record ) {
960
-            return false;
961
-        }
962
-
963
-        if ( empty($post_values) ) {
964
-            $post_values = stripslashes_deep($_POST);
965
-        }
949
+		}
950
+		return $key;
951
+	}
952
+
953
+	/**
954
+	 * Editing a Form or Entry
955
+	 * @param string $table
956
+	 * @return bool|array
957
+	 */
958
+	public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
959
+		if ( ! $record ) {
960
+			return false;
961
+		}
962
+
963
+		if ( empty($post_values) ) {
964
+			$post_values = stripslashes_deep($_POST);
965
+		}
966 966
 
967 967
 		$values = array( 'id' => $record->id, 'fields' => array() );
968 968
 
969 969
 		foreach ( array( 'name', 'description' ) as $var ) {
970
-            $default_val = isset($record->{$var}) ? $record->{$var} : '';
971
-            $values[ $var ] = self::get_param( $var, $default_val );
972
-            unset($var, $default_val);
973
-        }
974
-
975
-        $values['description'] = self::use_wpautop($values['description']);
976
-        $frm_settings = self::get_settings();
977
-        $is_form_builder = self::is_admin_page('formidable' );
978
-
979
-        foreach ( (array) $fields as $field ) {
980
-            // Make sure to filter default values (for placeholder text), but not on the form builder page
981
-            if ( ! $is_form_builder ) {
982
-                $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
983
-            }
970
+			$default_val = isset($record->{$var}) ? $record->{$var} : '';
971
+			$values[ $var ] = self::get_param( $var, $default_val );
972
+			unset($var, $default_val);
973
+		}
974
+
975
+		$values['description'] = self::use_wpautop($values['description']);
976
+		$frm_settings = self::get_settings();
977
+		$is_form_builder = self::is_admin_page('formidable' );
978
+
979
+		foreach ( (array) $fields as $field ) {
980
+			// Make sure to filter default values (for placeholder text), but not on the form builder page
981
+			if ( ! $is_form_builder ) {
982
+				$field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
983
+			}
984 984
 			$parent_form_id = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
985 985
 			self::fill_field_defaults($field, $record, $values, compact('default', 'post_values', 'frm_settings', 'parent_form_id' ) );
986
-        }
986
+		}
987 987
 
988
-        self::fill_form_opts($record, $table, $post_values, $values);
988
+		self::fill_form_opts($record, $table, $post_values, $values);
989 989
 
990
-        if ( $table == 'entries' ) {
991
-            $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
992
-        } else if ( $table == 'forms' ) {
993
-            $values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
994
-        }
990
+		if ( $table == 'entries' ) {
991
+			$values = FrmEntriesHelper::setup_edit_vars( $values, $record );
992
+		} else if ( $table == 'forms' ) {
993
+			$values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
994
+		}
995 995
 
996
-        return $values;
997
-    }
996
+		return $values;
997
+	}
998 998
 
999 999
 	private static function fill_field_defaults( $field, $record, array &$values, $args ) {
1000
-        $post_values = $args['post_values'];
1001
-
1002
-        if ( $args['default'] ) {
1003
-            $meta_value = $field->default_value;
1004
-        } else {
1005
-            if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
1006
-                if ( ! isset($field->field_options['custom_field']) ) {
1007
-                    $field->field_options['custom_field'] = '';
1008
-                }
1000
+		$post_values = $args['post_values'];
1001
+
1002
+		if ( $args['default'] ) {
1003
+			$meta_value = $field->default_value;
1004
+		} else {
1005
+			if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
1006
+				if ( ! isset($field->field_options['custom_field']) ) {
1007
+					$field->field_options['custom_field'] = '';
1008
+				}
1009 1009
 				$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 ) );
1010
-            } else {
1010
+			} else {
1011 1011
 				$meta_value = FrmEntryMeta::get_meta_value( $record, $field->id );
1012
-            }
1013
-        }
1014
-
1015
-        $field_type = isset( $post_values['field_options'][ 'type_'. $field->id ] ) ? $post_values['field_options'][ 'type_'. $field->id ] : $field->type;
1016
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1017
-
1018
-        $field_array = array(
1019
-            'id'            => $field->id,
1020
-            'value'         => $new_value,
1021
-            'default_value' => $field->default_value,
1022
-            'name'          => $field->name,
1023
-            'description'   => $field->description,
1024
-            'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1025
-            'options'       => $field->options,
1026
-            'required'      => $field->required,
1027
-            'field_key'     => $field->field_key,
1028
-            'field_order'   => $field->field_order,
1029
-            'form_id'       => $field->form_id,
1012
+			}
1013
+		}
1014
+
1015
+		$field_type = isset( $post_values['field_options'][ 'type_'. $field->id ] ) ? $post_values['field_options'][ 'type_'. $field->id ] : $field->type;
1016
+		$new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1017
+
1018
+		$field_array = array(
1019
+			'id'            => $field->id,
1020
+			'value'         => $new_value,
1021
+			'default_value' => $field->default_value,
1022
+			'name'          => $field->name,
1023
+			'description'   => $field->description,
1024
+			'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1025
+			'options'       => $field->options,
1026
+			'required'      => $field->required,
1027
+			'field_key'     => $field->field_key,
1028
+			'field_order'   => $field->field_order,
1029
+			'form_id'       => $field->form_id,
1030 1030
 			'parent_form_id' => $args['parent_form_id'],
1031
-        );
1031
+		);
1032 1032
 
1033
-        $args['field_type'] = $field_type;
1034
-        self::fill_field_opts($field, $field_array, $args);
1033
+		$args['field_type'] = $field_type;
1034
+		self::fill_field_opts($field, $field_array, $args);
1035 1035
 
1036
-        $field_array = apply_filters('frm_setup_edit_fields_vars', $field_array, $field, $values['id']);
1036
+		$field_array = apply_filters('frm_setup_edit_fields_vars', $field_array, $field, $values['id']);
1037 1037
 
1038
-        if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1039
-            $field_array['unique_msg'] = '';
1040
-        }
1038
+		if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1039
+			$field_array['unique_msg'] = '';
1040
+		}
1041 1041
 
1042
-        $field_array = array_merge( $field->field_options, $field_array );
1042
+		$field_array = array_merge( $field->field_options, $field_array );
1043 1043
 
1044
-        $values['fields'][ $field->id ] = $field_array;
1045
-    }
1044
+		$values['fields'][ $field->id ] = $field_array;
1045
+	}
1046 1046
 
1047 1047
 	private static function fill_field_opts( $field, array &$field_array, $args ) {
1048
-        $post_values = $args['post_values'];
1049
-        $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1050
-
1051
-        foreach ( $opt_defaults as $opt => $default_opt ) {
1052
-            $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 );
1053
-            if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1054
-                $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1055
-            } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1056
-                if ( $args['field_type'] == 'captcha' ) {
1057
-                    $field_array[ $opt ] = $args['frm_settings']->re_msg;
1058
-                } else {
1059
-                    $field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1060
-                }
1061
-            }
1062
-        }
1063
-
1064
-        if ( $field_array['custom_html'] == '' ) {
1065
-            $field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1066
-        }
1067
-    }
1068
-
1069
-    /**
1070
-     * @param string $table
1071
-     */
1048
+		$post_values = $args['post_values'];
1049
+		$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1050
+
1051
+		foreach ( $opt_defaults as $opt => $default_opt ) {
1052
+			$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 );
1053
+			if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1054
+				$field_array[ $opt ] = $args['frm_settings']->blank_msg;
1055
+			} else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1056
+				if ( $args['field_type'] == 'captcha' ) {
1057
+					$field_array[ $opt ] = $args['frm_settings']->re_msg;
1058
+				} else {
1059
+					$field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1060
+				}
1061
+			}
1062
+		}
1063
+
1064
+		if ( $field_array['custom_html'] == '' ) {
1065
+			$field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1066
+		}
1067
+	}
1068
+
1069
+	/**
1070
+	 * @param string $table
1071
+	 */
1072 1072
 	private static function fill_form_opts( $record, $table, $post_values, array &$values ) {
1073
-        if ( $table == 'entries' ) {
1074
-            $form = $record->form_id;
1073
+		if ( $table == 'entries' ) {
1074
+			$form = $record->form_id;
1075 1075
 			FrmForm::maybe_get_form( $form );
1076
-        } else {
1077
-            $form = $record;
1078
-        }
1076
+		} else {
1077
+			$form = $record;
1078
+		}
1079 1079
 
1080
-        if ( ! $form ) {
1081
-            return;
1082
-        }
1080
+		if ( ! $form ) {
1081
+			return;
1082
+		}
1083 1083
 
1084
-        $values['form_name'] = isset($record->form_id) ? $form->name : '';
1084
+		$values['form_name'] = isset($record->form_id) ? $form->name : '';
1085 1085
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1086 1086
 
1087
-        if ( ! is_array($form->options) ) {
1088
-            return;
1089
-        }
1087
+		if ( ! is_array($form->options) ) {
1088
+			return;
1089
+		}
1090 1090
 
1091
-        foreach ( $form->options as $opt => $value ) {
1092
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1093
-        }
1091
+		foreach ( $form->options as $opt => $value ) {
1092
+			$values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1093
+		}
1094 1094
 
1095
-        self::fill_form_defaults($post_values, $values);
1096
-    }
1095
+		self::fill_form_defaults($post_values, $values);
1096
+	}
1097 1097
 
1098
-    /**
1099
-     * Set to POST value or default
1100
-     */
1098
+	/**
1099
+	 * Set to POST value or default
1100
+	 */
1101 1101
 	private static function fill_form_defaults( $post_values, array &$values ) {
1102
-        $form_defaults = FrmFormsHelper::get_default_opts();
1102
+		$form_defaults = FrmFormsHelper::get_default_opts();
1103 1103
 
1104
-        foreach ( $form_defaults as $opt => $default ) {
1105
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1104
+		foreach ( $form_defaults as $opt => $default ) {
1105
+			if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1106 1106
 				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1107
-            }
1107
+			}
1108 1108
 
1109
-            unset($opt, $defaut);
1110
-        }
1109
+			unset($opt, $defaut);
1110
+		}
1111 1111
 
1112
-        if ( ! isset($values['custom_style']) ) {
1113
-            $frm_settings = self::get_settings();
1112
+		if ( ! isset($values['custom_style']) ) {
1113
+			$frm_settings = self::get_settings();
1114 1114
 			$values['custom_style'] = ( $post_values && isset( $post_values['options']['custom_style'] ) ) ? absint( $_POST['options']['custom_style'] ) : ( $frm_settings->load_style != 'none' );
1115
-        }
1115
+		}
1116 1116
 
1117 1117
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1118
-            if ( ! isset( $values[ $h .'_html' ] ) ) {
1119
-                $values[ $h .'_html' ] = ( isset( $post_values['options'][ $h .'_html' ] ) ? $post_values['options'][ $h .'_html' ] : FrmFormsHelper::get_default_html( $h ) );
1120
-            }
1121
-            unset($h);
1122
-        }
1123
-    }
1118
+			if ( ! isset( $values[ $h .'_html' ] ) ) {
1119
+				$values[ $h .'_html' ] = ( isset( $post_values['options'][ $h .'_html' ] ) ? $post_values['options'][ $h .'_html' ] : FrmFormsHelper::get_default_html( $h ) );
1120
+			}
1121
+			unset($h);
1122
+		}
1123
+	}
1124 1124
 
1125 1125
 	public static function get_meta_value( $field_id, $entry ) {
1126 1126
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntryMeta::get_meta_value' );
@@ -1128,69 +1128,69 @@  discard block
 block discarded – undo
1128 1128
 	}
1129 1129
 
1130 1130
 	public static function insert_opt_html( $args ) {
1131
-        $class = '';
1132
-        if ( in_array( $args['type'], array( 'email', 'user_id', 'hidden', 'select', 'radio', 'checkbox', 'phone', 'text' ) ) ) {
1133
-            $class .= 'show_frm_not_email_to';
1134
-        }
1135
-    ?>
1131
+		$class = '';
1132
+		if ( in_array( $args['type'], array( 'email', 'user_id', 'hidden', 'select', 'radio', 'checkbox', 'phone', 'text' ) ) ) {
1133
+			$class .= 'show_frm_not_email_to';
1134
+		}
1135
+	?>
1136 1136
 <li>
1137 1137
     <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>
1138 1138
     <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>
1139 1139
     <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>
1140 1140
 </li>
1141 1141
     <?php
1142
-    }
1142
+	}
1143 1143
 
1144
-    public static function get_us_states() {
1145
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmFieldsHelper::get_us_states' );
1146
-        return FrmFieldsHelper::get_us_states();
1147
-    }
1144
+	public static function get_us_states() {
1145
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmFieldsHelper::get_us_states' );
1146
+		return FrmFieldsHelper::get_us_states();
1147
+	}
1148 1148
 
1149
-    public static function get_countries() {
1150
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmFieldsHelper::get_countries' );
1151
-        return FrmFieldsHelper::get_countries();
1152
-    }
1149
+	public static function get_countries() {
1150
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmFieldsHelper::get_countries' );
1151
+		return FrmFieldsHelper::get_countries();
1152
+	}
1153 1153
 
1154 1154
 	public static function truncate( $str, $length, $minword = 3, $continue = '...' ) {
1155
-        if ( is_array( $str ) ) {
1156
-            return;
1155
+		if ( is_array( $str ) ) {
1156
+			return;
1157 1157
 		}
1158 1158
 
1159
-        $length = (int) $length;
1159
+		$length = (int) $length;
1160 1160
 		$str = wp_strip_all_tags( $str );
1161 1161
 		$original_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $str ) );
1162 1162
 
1163 1163
 		if ( $length == 0 ) {
1164
-            return '';
1165
-        } else if ( $length <= 10 ) {
1164
+			return '';
1165
+		} else if ( $length <= 10 ) {
1166 1166
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1167
-            return $sub . (($length < $original_len) ? $continue : '');
1168
-        }
1167
+			return $sub . (($length < $original_len) ? $continue : '');
1168
+		}
1169 1169
 
1170
-        $sub = '';
1171
-        $len = 0;
1170
+		$sub = '';
1171
+		$len = 0;
1172 1172
 
1173 1173
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1174 1174
 
1175 1175
 		foreach ( $words as $word ) {
1176
-            $part = (($sub != '') ? ' ' : '') . $word;
1176
+			$part = (($sub != '') ? ' ' : '') . $word;
1177 1177
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1178
-            if ( $total_len > $length && str_word_count($sub) ) {
1179
-                break;
1180
-            }
1178
+			if ( $total_len > $length && str_word_count($sub) ) {
1179
+				break;
1180
+			}
1181 1181
 
1182
-            $sub .= $part;
1182
+			$sub .= $part;
1183 1183
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1184 1184
 
1185
-            if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1186
-                break;
1187
-            }
1185
+			if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1186
+				break;
1187
+			}
1188 1188
 
1189
-            unset($total_len, $word);
1190
-        }
1189
+			unset($total_len, $word);
1190
+		}
1191 1191
 
1192
-        return $sub . (($len < $original_len) ? $continue : '');
1193
-    }
1192
+		return $sub . (($len < $original_len) ? $continue : '');
1193
+	}
1194 1194
 
1195 1195
 	public static function mb_function( $function_names, $args ) {
1196 1196
 		$mb_function_name = $function_names[0];
@@ -1202,18 +1202,18 @@  discard block
 block discarded – undo
1202 1202
 	}
1203 1203
 
1204 1204
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1205
-        if ( empty($date) ) {
1206
-            return $date;
1207
-        }
1205
+		if ( empty($date) ) {
1206
+			return $date;
1207
+		}
1208 1208
 
1209
-        if ( empty($date_format) ) {
1210
-            $date_format = get_option('date_format');
1211
-        }
1209
+		if ( empty($date_format) ) {
1210
+			$date_format = get_option('date_format');
1211
+		}
1212 1212
 
1213
-        if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1214
-            $frmpro_settings = new FrmProSettings();
1215
-            $date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1216
-        }
1213
+		if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1214
+			$frmpro_settings = new FrmProSettings();
1215
+			$date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1216
+		}
1217 1217
 
1218 1218
 		$formatted = self::get_localized_date( $date_format, $date );
1219 1219
 
@@ -1222,8 +1222,8 @@  discard block
 block discarded – undo
1222 1222
 			$formatted .= self::add_time_to_date( $time_format, $date );
1223 1223
 		}
1224 1224
 
1225
-        return $formatted;
1226
-    }
1225
+		return $formatted;
1226
+	}
1227 1227
 
1228 1228
 	private static function add_time_to_date( $time_format, $date ) {
1229 1229
 		if ( empty( $time_format ) ) {
@@ -1304,61 +1304,61 @@  discard block
 block discarded – undo
1304 1304
 		);
1305 1305
 	}
1306 1306
 
1307
-    /**
1308
-     * Added for < WP 4.0 compatability
1309
-     *
1310
-     * @since 1.07.10
1311
-     *
1312
-     * @param string $term The value to escape
1313
-     * @return string The escaped value
1314
-     */
1307
+	/**
1308
+	 * Added for < WP 4.0 compatability
1309
+	 *
1310
+	 * @since 1.07.10
1311
+	 *
1312
+	 * @param string $term The value to escape
1313
+	 * @return string The escaped value
1314
+	 */
1315 1315
 	public static function esc_like( $term ) {
1316
-        global $wpdb;
1317
-        if ( method_exists($wpdb, 'esc_like') ) {
1316
+		global $wpdb;
1317
+		if ( method_exists($wpdb, 'esc_like') ) {
1318 1318
 			// WP 4.0
1319
-            $term = $wpdb->esc_like( $term );
1320
-        } else {
1321
-            $term = like_escape( $term );
1322
-        }
1319
+			$term = $wpdb->esc_like( $term );
1320
+		} else {
1321
+			$term = like_escape( $term );
1322
+		}
1323 1323
 
1324
-        return $term;
1325
-    }
1324
+		return $term;
1325
+	}
1326 1326
 
1327
-    /**
1328
-     * @param string $order_query
1329
-     */
1327
+	/**
1328
+	 * @param string $order_query
1329
+	 */
1330 1330
 	public static function esc_order( $order_query ) {
1331
-        if ( empty($order_query) ) {
1332
-            return '';
1333
-        }
1334
-
1335
-        // remove ORDER BY before santizing
1336
-        $order_query = strtolower($order_query);
1337
-        if ( strpos($order_query, 'order by') !== false ) {
1338
-            $order_query = str_replace('order by', '', $order_query);
1339
-        }
1340
-
1341
-        $order_query = explode(' ', trim($order_query));
1342
-
1343
-        $order_fields = array(
1344
-            'id', 'form_key', 'name', 'description',
1345
-            'parent_form_id', 'logged_in', 'is_template',
1346
-            'default_template', 'status', 'created_at',
1347
-        );
1348
-
1349
-        $order = trim(trim(reset($order_query), ','));
1350
-        if ( ! in_array($order, $order_fields) ) {
1351
-            return '';
1352
-        }
1353
-
1354
-        $order_by = '';
1355
-        if ( count($order_query) > 1 ) {
1331
+		if ( empty($order_query) ) {
1332
+			return '';
1333
+		}
1334
+
1335
+		// remove ORDER BY before santizing
1336
+		$order_query = strtolower($order_query);
1337
+		if ( strpos($order_query, 'order by') !== false ) {
1338
+			$order_query = str_replace('order by', '', $order_query);
1339
+		}
1340
+
1341
+		$order_query = explode(' ', trim($order_query));
1342
+
1343
+		$order_fields = array(
1344
+			'id', 'form_key', 'name', 'description',
1345
+			'parent_form_id', 'logged_in', 'is_template',
1346
+			'default_template', 'status', 'created_at',
1347
+		);
1348
+
1349
+		$order = trim(trim(reset($order_query), ','));
1350
+		if ( ! in_array($order, $order_fields) ) {
1351
+			return '';
1352
+		}
1353
+
1354
+		$order_by = '';
1355
+		if ( count($order_query) > 1 ) {
1356 1356
 			$order_by = end( $order_query );
1357 1357
 			self::esc_order_by( $order_by );
1358
-        }
1358
+		}
1359 1359
 
1360
-        return ' ORDER BY '. $order . ' '. $order_by;
1361
-    }
1360
+		return ' ORDER BY '. $order . ' '. $order_by;
1361
+	}
1362 1362
 
1363 1363
 	/**
1364 1364
 	 * Make sure this is ordering by either ASC or DESC
@@ -1370,183 +1370,183 @@  discard block
 block discarded – undo
1370 1370
 		}
1371 1371
 	}
1372 1372
 
1373
-    /**
1374
-     * @param string $limit
1375
-     */
1373
+	/**
1374
+	 * @param string $limit
1375
+	 */
1376 1376
 	public static function esc_limit( $limit ) {
1377
-        if ( empty($limit) ) {
1378
-            return '';
1379
-        }
1380
-
1381
-        $limit = trim(str_replace(' limit', '', strtolower($limit)));
1382
-        if ( is_numeric($limit) ) {
1383
-            return ' LIMIT '. $limit;
1384
-        }
1385
-
1386
-        $limit = explode(',', trim($limit));
1387
-        foreach ( $limit as $k => $l ) {
1388
-            if ( is_numeric( $l ) ) {
1389
-                $limit[ $k ] = $l;
1390
-            }
1391
-        }
1392
-
1393
-        $limit = implode(',', $limit);
1394
-        return ' LIMIT '. $limit;
1395
-    }
1396
-
1397
-    /**
1398
-     * Get an array of values ready to go through $wpdb->prepare
1399
-     * @since 2.0
1400
-     */
1401
-    public static function prepare_array_values( $array, $type = '%s' ) {
1402
-        $placeholders = array_fill(0, count($array), $type);
1403
-        return implode(', ', $placeholders);
1404
-    }
1405
-
1406
-    public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1407
-        if ( empty($where) ) {
1408
-            return '';
1409
-        }
1377
+		if ( empty($limit) ) {
1378
+			return '';
1379
+		}
1380
+
1381
+		$limit = trim(str_replace(' limit', '', strtolower($limit)));
1382
+		if ( is_numeric($limit) ) {
1383
+			return ' LIMIT '. $limit;
1384
+		}
1385
+
1386
+		$limit = explode(',', trim($limit));
1387
+		foreach ( $limit as $k => $l ) {
1388
+			if ( is_numeric( $l ) ) {
1389
+				$limit[ $k ] = $l;
1390
+			}
1391
+		}
1392
+
1393
+		$limit = implode(',', $limit);
1394
+		return ' LIMIT '. $limit;
1395
+	}
1396
+
1397
+	/**
1398
+	 * Get an array of values ready to go through $wpdb->prepare
1399
+	 * @since 2.0
1400
+	 */
1401
+	public static function prepare_array_values( $array, $type = '%s' ) {
1402
+		$placeholders = array_fill(0, count($array), $type);
1403
+		return implode(', ', $placeholders);
1404
+	}
1405
+
1406
+	public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1407
+		if ( empty($where) ) {
1408
+			return '';
1409
+		}
1410 1410
 
1411 1411
 		if ( is_array( $where ) ) {
1412
-            global $wpdb;
1413
-            FrmDb::get_where_clause_and_values( $where, $starts_with );
1412
+			global $wpdb;
1413
+			FrmDb::get_where_clause_and_values( $where, $starts_with );
1414 1414
 			$where = $wpdb->prepare( $where['where'], $where['values'] );
1415 1415
 		} else {
1416
-            $where = $starts_with . $where;
1417
-        }
1416
+			$where = $starts_with . $where;
1417
+		}
1418 1418
 
1419
-        return $where;
1420
-    }
1419
+		return $where;
1420
+	}
1421 1421
 
1422
-    // Pagination Methods
1422
+	// Pagination Methods
1423 1423
 
1424
-    /**
1425
-     * @param integer $current_p
1426
-     */
1424
+	/**
1425
+	 * @param integer $current_p
1426
+	 */
1427 1427
 	public static function get_last_record_num( $r_count, $current_p, $p_size ) {
1428 1428
 		return ( ( $r_count < ( $current_p * $p_size ) ) ? $r_count : ( $current_p * $p_size ) );
1429 1429
 	}
1430 1430
 
1431
-    /**
1432
-     * @param integer $current_p
1433
-     */
1434
-    public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1435
-        if ( $current_p == 1 ) {
1436
-            return 1;
1437
-        } else {
1438
-            return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1439
-        }
1440
-    }
1441
-
1442
-    /**
1443
-     * @param string $table_name
1444
-     */
1445
-    public static function &getRecordCount( $where = '', $table_name ) {
1446
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_count' );
1447
-        $count = FrmDb::get_count( $table_name, $where );
1448
-        return $count;
1449
-    }
1450
-
1451
-    public static function get_referer_info() {
1452
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::get_server_value' );
1453
-        return self::get_server_value('HTTP_REFERER');
1454
-    }
1431
+	/**
1432
+	 * @param integer $current_p
1433
+	 */
1434
+	public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1435
+		if ( $current_p == 1 ) {
1436
+			return 1;
1437
+		} else {
1438
+			return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1439
+		}
1440
+	}
1441
+
1442
+	/**
1443
+	 * @param string $table_name
1444
+	 */
1445
+	public static function &getRecordCount( $where = '', $table_name ) {
1446
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_count' );
1447
+		$count = FrmDb::get_count( $table_name, $where );
1448
+		return $count;
1449
+	}
1450
+
1451
+	public static function get_referer_info() {
1452
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::get_server_value' );
1453
+		return self::get_server_value('HTTP_REFERER');
1454
+	}
1455 1455
 
1456 1456
 	/**
1457 1457
 	 * @return array
1458 1458
 	 */
1459 1459
 	public static function json_to_array( $json_vars ) {
1460
-        $vars = array();
1461
-        foreach ( $json_vars as $jv ) {
1462
-            $jv_name = explode('[', $jv['name']);
1463
-            $last = count($jv_name) - 1;
1464
-            foreach ( $jv_name as $p => $n ) {
1465
-                $name = trim($n, ']');
1466
-                if ( ! isset($l1) ) {
1467
-                    $l1 = $name;
1468
-                }
1469
-
1470
-                if ( ! isset($l2) ) {
1471
-                    $l2 = $name;
1472
-                }
1473
-
1474
-                if ( ! isset($l3) ) {
1475
-                    $l3 = $name;
1476
-                }
1477
-
1478
-                $this_val = ( $p == $last ) ? $jv['value'] : array();
1479
-
1480
-                switch ( $p ) {
1481
-                    case 0:
1482
-                        $l1 = $name;
1483
-                        self::add_value_to_array( $name, $l1, $this_val, $vars );
1484
-                    break;
1485
-
1486
-                    case 1:
1487
-                        $l2 = $name;
1488
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1489
-                    break;
1490
-
1491
-                    case 2:
1492
-                        $l3 = $name;
1493
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1494
-                    break;
1495
-
1496
-                    case 3:
1497
-                        $l4 = $name;
1498
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1499
-                    break;
1500
-                }
1501
-
1502
-                unset($this_val, $n);
1503
-            }
1504
-
1505
-            unset($last, $jv);
1506
-        }
1507
-
1508
-        return $vars;
1509
-    }
1510
-
1511
-    /**
1512
-     * @param string $name
1513
-     * @param string $l1
1514
-     */
1515
-    public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1516
-        if ( $name == '' ) {
1517
-            $vars[] = $val;
1518
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1519
-            $vars[ $l1 ] = $val;
1520
-        }
1521
-    }
1460
+		$vars = array();
1461
+		foreach ( $json_vars as $jv ) {
1462
+			$jv_name = explode('[', $jv['name']);
1463
+			$last = count($jv_name) - 1;
1464
+			foreach ( $jv_name as $p => $n ) {
1465
+				$name = trim($n, ']');
1466
+				if ( ! isset($l1) ) {
1467
+					$l1 = $name;
1468
+				}
1469
+
1470
+				if ( ! isset($l2) ) {
1471
+					$l2 = $name;
1472
+				}
1473
+
1474
+				if ( ! isset($l3) ) {
1475
+					$l3 = $name;
1476
+				}
1477
+
1478
+				$this_val = ( $p == $last ) ? $jv['value'] : array();
1479
+
1480
+				switch ( $p ) {
1481
+					case 0:
1482
+						$l1 = $name;
1483
+						self::add_value_to_array( $name, $l1, $this_val, $vars );
1484
+					break;
1485
+
1486
+					case 1:
1487
+						$l2 = $name;
1488
+						self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1489
+					break;
1490
+
1491
+					case 2:
1492
+						$l3 = $name;
1493
+						self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1494
+					break;
1495
+
1496
+					case 3:
1497
+						$l4 = $name;
1498
+						self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1499
+					break;
1500
+				}
1501
+
1502
+				unset($this_val, $n);
1503
+			}
1504
+
1505
+			unset($last, $jv);
1506
+		}
1507
+
1508
+		return $vars;
1509
+	}
1510
+
1511
+	/**
1512
+	 * @param string $name
1513
+	 * @param string $l1
1514
+	 */
1515
+	public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1516
+		if ( $name == '' ) {
1517
+			$vars[] = $val;
1518
+		} else if ( ! isset( $vars[ $l1 ] ) ) {
1519
+			$vars[ $l1 ] = $val;
1520
+		}
1521
+	}
1522 1522
 
1523 1523
 	public static function maybe_add_tooltip( $name, $class = 'closed', $form_name = '' ) {
1524
-        $tooltips = array(
1525
-            'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1526
-            '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' ),
1527
-            'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1528
-            'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1529
-            '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' ),
1530
-            'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1531
-            '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() ) ),
1532
-        );
1533
-
1534
-        if ( ! isset( $tooltips[ $name ] ) ) {
1535
-            return;
1536
-        }
1537
-
1538
-        if ( 'open' == $class ) {
1539
-            echo ' frm_help"';
1540
-        } else {
1541
-            echo ' class="frm_help"';
1542
-        }
1543
-
1544
-        echo ' title="'. esc_attr( $tooltips[ $name ] );
1545
-
1546
-        if ( 'open' != $class ) {
1547
-            echo '"';
1548
-        }
1549
-    }
1524
+		$tooltips = array(
1525
+			'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1526
+			'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' ),
1527
+			'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1528
+			'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1529
+			'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' ),
1530
+			'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1531
+			'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() ) ),
1532
+		);
1533
+
1534
+		if ( ! isset( $tooltips[ $name ] ) ) {
1535
+			return;
1536
+		}
1537
+
1538
+		if ( 'open' == $class ) {
1539
+			echo ' frm_help"';
1540
+		} else {
1541
+			echo ' class="frm_help"';
1542
+		}
1543
+
1544
+		echo ' title="'. esc_attr( $tooltips[ $name ] );
1545
+
1546
+		if ( 'open' != $class ) {
1547
+			echo '"';
1548
+		}
1549
+	}
1550 1550
 
1551 1551
 	/**
1552 1552
 	 * Add the current_page class to that page in the form nav
@@ -1562,35 +1562,35 @@  discard block
 block discarded – undo
1562 1562
 		}
1563 1563
 	}
1564 1564
 
1565
-    /**
1566
-     * Prepare and json_encode post content
1567
-     *
1568
-     * @since 2.0
1569
-     *
1570
-     * @param array $post_content
1571
-     * @return string $post_content ( json encoded array )
1572
-     */
1573
-    public static function prepare_and_encode( $post_content ) {
1574
-        //Loop through array to strip slashes and add only the needed ones
1565
+	/**
1566
+	 * Prepare and json_encode post content
1567
+	 *
1568
+	 * @since 2.0
1569
+	 *
1570
+	 * @param array $post_content
1571
+	 * @return string $post_content ( json encoded array )
1572
+	 */
1573
+	public static function prepare_and_encode( $post_content ) {
1574
+		//Loop through array to strip slashes and add only the needed ones
1575 1575
 		foreach ( $post_content as $key => $val ) {
1576 1576
 			// Replace problematic characters (like &quot;)
1577 1577
 			$val = str_replace( '&quot;', '"', $val );
1578 1578
 
1579 1579
 			self::prepare_action_slashes( $val, $key, $post_content );
1580
-            unset( $key, $val );
1581
-        }
1580
+			unset( $key, $val );
1581
+		}
1582 1582
 
1583
-        // json_encode the array
1584
-        $post_content = json_encode( $post_content );
1583
+		// json_encode the array
1584
+		$post_content = json_encode( $post_content );
1585 1585
 
1586
-	    // add extra slashes for \r\n since WP strips them
1586
+		// add extra slashes for \r\n since WP strips them
1587 1587
 		$post_content = str_replace( array( '\\r', '\\n', '\\u', '\\t' ), array( '\\\\r', '\\\\n', '\\\\u', '\\\\t' ), $post_content );
1588 1588
 
1589
-        // allow for &quot
1590
-	    $post_content = str_replace( '&quot;', '\\"', $post_content );
1589
+		// allow for &quot
1590
+		$post_content = str_replace( '&quot;', '\\"', $post_content );
1591 1591
 
1592
-        return $post_content;
1593
-    }
1592
+		return $post_content;
1593
+	}
1594 1594
 
1595 1595
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1596 1596
 		if ( ! isset( $post_content[ $key ] ) ) {
@@ -1658,64 +1658,64 @@  discard block
 block discarded – undo
1658 1658
 	}
1659 1659
 
1660 1660
 	public static function maybe_json_decode( $string ) {
1661
-        if ( is_array($string) ) {
1662
-            return $string;
1663
-        }
1661
+		if ( is_array($string) ) {
1662
+			return $string;
1663
+		}
1664 1664
 
1665
-        $new_string = json_decode($string, true);
1666
-        if ( function_exists('json_last_error') ) {
1665
+		$new_string = json_decode($string, true);
1666
+		if ( function_exists('json_last_error') ) {
1667 1667
 			// php 5.3+
1668
-            if ( json_last_error() == JSON_ERROR_NONE ) {
1669
-                $string = $new_string;
1670
-            }
1671
-        } else if ( isset($new_string) ) {
1668
+			if ( json_last_error() == JSON_ERROR_NONE ) {
1669
+				$string = $new_string;
1670
+			}
1671
+		} else if ( isset($new_string) ) {
1672 1672
 			// php < 5.3 fallback
1673
-            $string = $new_string;
1674
-        }
1675
-        return $string;
1676
-    }
1677
-
1678
-    /**
1679
-     * @since 1.07.10
1680
-     *
1681
-     * @param string $post_type The name of the post type that may need to be highlighted
1682
-     * @return echo The javascript to open and highlight the Formidable menu
1683
-     */
1673
+			$string = $new_string;
1674
+		}
1675
+		return $string;
1676
+	}
1677
+
1678
+	/**
1679
+	 * @since 1.07.10
1680
+	 *
1681
+	 * @param string $post_type The name of the post type that may need to be highlighted
1682
+	 * @return echo The javascript to open and highlight the Formidable menu
1683
+	 */
1684 1684
 	public static function maybe_highlight_menu( $post_type ) {
1685
-        global $post, $pagenow;
1685
+		global $post, $pagenow;
1686 1686
 
1687
-        if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1688
-            return;
1689
-        }
1687
+		if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1688
+			return;
1689
+		}
1690 1690
 
1691
-        if ( is_object($post) && $post->post_type != $post_type ) {
1692
-            return;
1693
-        }
1691
+		if ( is_object($post) && $post->post_type != $post_type ) {
1692
+			return;
1693
+		}
1694 1694
 
1695
-        self::load_admin_wide_js();
1696
-        echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1697
-    }
1695
+		self::load_admin_wide_js();
1696
+		echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1697
+	}
1698 1698
 
1699
-    /**
1700
-     * Load the JS file on non-Formidable pages in the admin area
1701
-     * @since 2.0
1702
-     */
1699
+	/**
1700
+	 * Load the JS file on non-Formidable pages in the admin area
1701
+	 * @since 2.0
1702
+	 */
1703 1703
 	public static function load_admin_wide_js( $load = true ) {
1704
-        $version = FrmAppHelper::plugin_version();
1704
+		$version = FrmAppHelper::plugin_version();
1705 1705
 		wp_register_script( 'formidable_admin_global', FrmAppHelper::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
1706 1706
 
1707
-        wp_localize_script( 'formidable_admin_global', 'frmGlobal', array(
1707
+		wp_localize_script( 'formidable_admin_global', 'frmGlobal', array(
1708 1708
 			'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
1709
-            'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1709
+			'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1710 1710
 			'url'          => FrmAppHelper::plugin_url(),
1711 1711
 			'loading'      => __( 'Loading&hellip;' ),
1712 1712
 			'nonce'        => wp_create_nonce( 'frm_ajax' ),
1713
-        ) );
1713
+		) );
1714 1714
 
1715 1715
 		if ( $load ) {
1716 1716
 			wp_enqueue_script( 'formidable_admin_global' );
1717 1717
 		}
1718
-    }
1718
+	}
1719 1719
 
1720 1720
 	/**
1721 1721
 	 * @since 2.0.9
@@ -1724,9 +1724,9 @@  discard block
 block discarded – undo
1724 1724
 		wp_enqueue_style( 'frm_fonts', self::plugin_url() . '/css/frm_fonts.css', array(), self::plugin_version() );
1725 1725
 	}
1726 1726
 
1727
-    /**
1728
-     * @param string $location
1729
-     */
1727
+	/**
1728
+	 * @param string $location
1729
+	 */
1730 1730
 	public static function localize_script( $location ) {
1731 1731
 		$ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
1732 1732
 		$ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
@@ -1776,81 +1776,81 @@  discard block
 block discarded – undo
1776 1776
 		}
1777 1777
 	}
1778 1778
 
1779
-    /**
1779
+	/**
1780 1780
 	 * echo the message on the plugins listing page
1781
-     * @since 1.07.10
1782
-     *
1783
-     * @param float $min_version The version the add-on requires
1784
-     */
1781
+	 * @since 1.07.10
1782
+	 *
1783
+	 * @param float $min_version The version the add-on requires
1784
+	 */
1785 1785
 	public static function min_version_notice( $min_version ) {
1786
-        $frm_version = self::plugin_version();
1786
+		$frm_version = self::plugin_version();
1787 1787
 
1788
-        // check if Formidable meets minimum requirements
1789
-        if ( version_compare($frm_version, $min_version, '>=') ) {
1790
-            return;
1791
-        }
1788
+		// check if Formidable meets minimum requirements
1789
+		if ( version_compare($frm_version, $min_version, '>=') ) {
1790
+			return;
1791
+		}
1792 1792
 
1793
-        $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1793
+		$wp_list_table = _get_list_table('WP_Plugins_List_Table');
1794 1794
 		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">' .
1795
-        __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1796
-        '</div></td></tr>';
1797
-    }
1798
-
1799
-    public static function locales( $type = 'date' ) {
1800
-        $locales = array(
1801
-            'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1802
-            'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1803
-            'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1804
-            'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1805
-            'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1806
-            'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1807
-            'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1808
-            'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1809
-            'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1810
-            'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1811
-            'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1812
-            'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1813
-            'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1814
-            'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1815
-            'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1816
-            'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1817
-            'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1818
-            'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1819
-            'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1820
-            'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1821
-            'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1822
-            'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1823
-            'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1824
-            'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1825
-            'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1826
-            'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1827
-            'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1828
-            'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1829
-            'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1830
-            'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1831
-            'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1832
-            'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1833
-        );
1834
-
1835
-        if ( $type == 'captcha' ) {
1836
-            // remove the languages unavailable for the captcha
1837
-            $unset = array(
1838
-                '', 'af', 'sq', 'hy', 'az', 'eu', 'bs',
1839
-                'zh-HK', 'eo', 'et', 'fo', 'fr-CH',
1840
-                'he', 'is', 'ms', 'sr-SR', 'ta', 'tu',
1841
-            );
1842
-        } else {
1843
-            // remove the languages unavailable for the datepicker
1844
-            $unset = array(
1845
-                'en', 'fil', 'fr-CA', 'de-AT', 'de-AT',
1846
-                'de-CH', 'iw', 'hi', 'pt', 'pt-PT',
1847
-                'es-419', 'tr',
1848
-            );
1849
-        }
1850
-
1851
-        $locales = array_diff_key($locales, array_flip($unset));
1852
-        $locales = apply_filters('frm_locales', $locales);
1853
-
1854
-        return $locales;
1855
-    }
1795
+		__( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1796
+		'</div></td></tr>';
1797
+	}
1798
+
1799
+	public static function locales( $type = 'date' ) {
1800
+		$locales = array(
1801
+			'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1802
+			'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1803
+			'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1804
+			'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1805
+			'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1806
+			'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1807
+			'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1808
+			'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1809
+			'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1810
+			'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1811
+			'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1812
+			'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1813
+			'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1814
+			'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1815
+			'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1816
+			'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1817
+			'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1818
+			'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1819
+			'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1820
+			'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1821
+			'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1822
+			'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1823
+			'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1824
+			'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1825
+			'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1826
+			'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1827
+			'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1828
+			'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1829
+			'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1830
+			'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1831
+			'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1832
+			'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1833
+		);
1834
+
1835
+		if ( $type == 'captcha' ) {
1836
+			// remove the languages unavailable for the captcha
1837
+			$unset = array(
1838
+				'', 'af', 'sq', 'hy', 'az', 'eu', 'bs',
1839
+				'zh-HK', 'eo', 'et', 'fo', 'fr-CH',
1840
+				'he', 'is', 'ms', 'sr-SR', 'ta', 'tu',
1841
+			);
1842
+		} else {
1843
+			// remove the languages unavailable for the datepicker
1844
+			$unset = array(
1845
+				'en', 'fil', 'fr-CA', 'de-AT', 'de-AT',
1846
+				'de-CH', 'iw', 'hi', 'pt', 'pt-PT',
1847
+				'es-419', 'tr',
1848
+			);
1849
+		}
1850
+
1851
+		$locales = array_diff_key($locales, array_flip($unset));
1852
+		$locales = apply_filters('frm_locales', $locales);
1853
+
1854
+		return $locales;
1855
+	}
1856 1856
 }
Please login to merge, or discard this patch.
Spacing   +222 added lines, -222 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,16 +23,16 @@  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() {
34 34
         //prevously FRM_URL constant
35
-        return plugins_url( '', self::plugin_path() .'/formidable.php' );
35
+        return plugins_url( '', self::plugin_path() . '/formidable.php' );
36 36
     }
37 37
 
38 38
 	public static function relative_plugin_url() {
@@ -54,7 +54,7 @@  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 ) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	public static function get_affiliate() {
69
-		$affiliate_id = apply_filters( 'frm_affiliate_link', get_option('frm_aff') );
69
+		$affiliate_id = apply_filters( 'frm_affiliate_link', get_option( 'frm_aff' ) );
70 70
 		$affiliate_id = strtolower( $affiliate_id );
71 71
 		$allowed_affiliates = array( 'mojo' );
72 72
 		if ( ! in_array( $affiliate_id, $allowed_affiliates ) ) {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public static function get_settings() {
87 87
         global $frm_settings;
88
-        if ( empty($frm_settings) ) {
88
+        if ( empty( $frm_settings ) ) {
89 89
             $frm_settings = new FrmSettings();
90 90
         }
91 91
         return $frm_settings;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     }
108 108
 
109 109
     public static function pro_is_installed() {
110
-        return apply_filters('frm_pro_installed', false);
110
+        return apply_filters( 'frm_pro_installed', false );
111 111
     }
112 112
 
113 113
     /**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      * @return boolean
152 152
      */
153 153
     public static function doing_ajax() {
154
-        return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
154
+        return defined( 'DOING_AJAX' ) && DOING_AJAX && ! self::is_preview_page();
155 155
     }
156 156
 
157 157
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      * @return boolean
172 172
      */
173 173
     public static function is_admin() {
174
-        return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
174
+        return is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX );
175 175
     }
176 176
 
177 177
     /**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      * @return string
198 198
      */
199 199
 	public static function get_server_value( $value ) {
200
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
200
+        return isset( $_SERVER[$value] ) ? wp_strip_all_tags( $_SERVER[$value] ) : '';
201 201
     }
202 202
 
203 203
     /**
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
             'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
213 213
             'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
214 214
         ) as $key ) {
215
-            if ( ! isset( $_SERVER[ $key ] ) ) {
215
+            if ( ! isset( $_SERVER[$key] ) ) {
216 216
                 continue;
217 217
             }
218 218
 
219
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
220
-                $ip = trim($ip); // just to be safe
219
+            foreach ( explode( ',', $_SERVER[$key] ) as $ip ) {
220
+                $ip = trim( $ip ); // just to be safe
221 221
 
222
-                if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
222
+                if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
223 223
                     return $ip;
224 224
                 }
225 225
             }
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
     }
230 230
 
231 231
     public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
232
-        if ( strpos($param, '[') ) {
233
-            $params = explode('[', $param);
232
+        if ( strpos( $param, '[' ) ) {
233
+            $params = explode( '[', $param );
234 234
             $param = $params[0];
235 235
         }
236 236
 
237 237
 		if ( $src == 'get' ) {
238
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
239
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
240
-                $value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[ $param ] ) ) );
238
+            $value = isset( $_POST[$param] ) ? stripslashes_deep( $_POST[$param] ) : ( isset( $_GET[$param] ) ? stripslashes_deep( $_GET[$param] ) : $default );
239
+            if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) {
240
+                $value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[$param] ) ) );
241 241
             }
242 242
 			self::sanitize_value( $sanitize, $value );
243 243
 		} else {
@@ -246,12 +246,12 @@  discard block
 block discarded – undo
246 246
 
247 247
 		if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
248 248
             foreach ( $params as $k => $p ) {
249
-                if ( ! $k || ! is_array($value) ) {
249
+                if ( ! $k || ! is_array( $value ) ) {
250 250
                     continue;
251 251
                 }
252 252
 
253
-                $p = trim($p, ']');
254
-                $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
253
+                $p = trim( $p, ']' );
254
+                $value = isset( $value[$p] ) ? $value[$p] : $default;
255 255
             }
256 256
         }
257 257
 
@@ -293,16 +293,16 @@  discard block
 block discarded – undo
293 293
 
294 294
 		$value = $args['default'];
295 295
 		if ( $args['type'] == 'get' ) {
296
-			if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
297
-				$value = $_GET[ $args['param'] ];
296
+			if ( $_GET && isset( $_GET[$args['param']] ) ) {
297
+				$value = $_GET[$args['param']];
298 298
 			}
299 299
 		} else if ( $args['type'] == 'post' ) {
300
-			if ( isset( $_POST[ $args['param'] ] ) ) {
301
-				$value = stripslashes_deep( maybe_unserialize( $_POST[ $args['param'] ] ) );
300
+			if ( isset( $_POST[$args['param']] ) ) {
301
+				$value = stripslashes_deep( maybe_unserialize( $_POST[$args['param']] ) );
302 302
 			}
303 303
 		} else {
304
-			if ( isset( $_REQUEST[ $args['param'] ] ) ) {
305
-				$value = $_REQUEST[ $args['param'] ];
304
+			if ( isset( $_REQUEST[$args['param']] ) ) {
305
+				$value = $_REQUEST[$args['param']];
306 306
 			}
307 307
 		}
308 308
 
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
     public static function sanitize_request( $sanitize_method, &$values ) {
339 339
         $temp_values = $values;
340 340
         foreach ( $temp_values as $k => $val ) {
341
-            if ( isset( $sanitize_method[ $k ] ) ) {
342
-				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
341
+            if ( isset( $sanitize_method[$k] ) ) {
342
+				$values[$k] = call_user_func( $sanitize_method[$k], $val );
343 343
             }
344 344
         }
345 345
     }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	public static function sanitize_array( &$values ) {
348 348
 		$temp_values = $values;
349 349
 		foreach ( $temp_values as $k => $val ) {
350
-			$values[ $k ] = wp_kses_post( $val );
350
+			$values[$k] = wp_kses_post( $val );
351 351
 		}
352 352
 	}
353 353
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 
368 368
 		$allowed_html = array();
369 369
 		foreach ( $allowed as $a ) {
370
-			$allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array();
370
+			$allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array();
371 371
 		}
372 372
 
373 373
 		return wp_kses( $value, $allowed_html );
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
      * @since 2.0
379 379
      */
380 380
     public static function remove_get_action() {
381
-        if ( ! isset($_GET) ) {
381
+        if ( ! isset( $_GET ) ) {
382 382
             return;
383 383
         }
384 384
 
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
         }
401 401
 
402 402
         global $wp_query;
403
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
404
-            $value = $wp_query->query_vars[ $param ];
403
+        if ( isset( $wp_query->query_vars[$param] ) ) {
404
+            $value = $wp_query->query_vars[$param];
405 405
         }
406 406
 
407 407
         return $value;
@@ -412,9 +412,9 @@  discard block
 block discarded – undo
412 412
      */
413 413
     public static function trigger_hook_load( $type, $object = null ) {
414 414
         // only load the form hooks once
415
-        $hooks_loaded = apply_filters('frm_'. $type .'_hooks_loaded', false, $object);
415
+        $hooks_loaded = apply_filters( 'frm_' . $type . '_hooks_loaded', false, $object );
416 416
         if ( ! $hooks_loaded ) {
417
-            do_action('frm_load_'. $type .'_hooks');
417
+            do_action( 'frm_load_' . $type . '_hooks' );
418 418
         }
419 419
     }
420 420
 
@@ -430,16 +430,16 @@  discard block
 block discarded – undo
430 430
      * @return mixed $results The cache or query results
431 431
      */
432 432
     public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
433
-        $results = wp_cache_get($cache_key, $group);
434
-        if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
433
+        $results = wp_cache_get( $cache_key, $group );
434
+        if ( ! self::is_empty_value( $results, false ) || empty( $query ) ) {
435 435
             return $results;
436 436
         }
437 437
 
438 438
         if ( 'get_posts' == $type ) {
439
-            $results = get_posts($query);
439
+            $results = get_posts( $query );
440 440
         } else {
441 441
             global $wpdb;
442
-            $results = $wpdb->{$type}($query);
442
+            $results = $wpdb->{$type}( $query );
443 443
         }
444 444
 
445 445
 		if ( ! self::prevent_caching() ) {
@@ -463,9 +463,9 @@  discard block
 block discarded – undo
463 463
         }
464 464
 
465 465
         // then check the transient
466
-        $results = get_transient($cache_key);
466
+        $results = get_transient( $cache_key );
467 467
         if ( $results ) {
468
-            wp_cache_set($cache_key, $results);
468
+            wp_cache_set( $cache_key, $results );
469 469
         }
470 470
 
471 471
         return $results;
@@ -476,8 +476,8 @@  discard block
 block discarded – undo
476 476
      * @param string $cache_key
477 477
      */
478 478
 	public static function delete_cache_and_transient( $cache_key ) {
479
-        delete_transient($cache_key);
480
-        wp_cache_delete($cache_key);
479
+        delete_transient( $cache_key );
480
+        wp_cache_delete( $cache_key );
481 481
     }
482 482
 
483 483
     /**
@@ -491,9 +491,9 @@  discard block
 block discarded – undo
491 491
 	public static function cache_delete_group( $group ) {
492 492
     	global $wp_object_cache;
493 493
 
494
-        if ( isset( $wp_object_cache->cache[ $group ] ) ) {
495
-            foreach ( $wp_object_cache->cache[ $group ] as $k => $v ) {
496
-                wp_cache_delete($k, $group);
494
+        if ( isset( $wp_object_cache->cache[$group] ) ) {
495
+            foreach ( $wp_object_cache->cache[$group] as $k => $v ) {
496
+                wp_cache_delete( $k, $group );
497 497
             }
498 498
             return true;
499 499
         }
@@ -524,29 +524,29 @@  discard block
 block discarded – undo
524 524
 	public static function load_scripts( $scripts ) {
525 525
         _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_script' );
526 526
         foreach ( (array) $scripts as $s ) {
527
-            wp_enqueue_script($s);
527
+            wp_enqueue_script( $s );
528 528
         }
529 529
     }
530 530
 
531 531
 	public static function load_styles( $styles ) {
532 532
         _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_style' );
533 533
         foreach ( (array) $styles as $s ) {
534
-            wp_enqueue_style($s);
534
+            wp_enqueue_style( $s );
535 535
         }
536 536
     }
537 537
 
538 538
     public static function get_pages() {
539
-		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
539
+		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => - 1, 'orderby' => 'title', 'order' => 'ASC' ) );
540 540
     }
541 541
 
542 542
     public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
543 543
         $pages = self::get_pages();
544 544
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
545 545
     ?>
546
-        <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
546
+        <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" class="frm-pages-dropdown">
547 547
             <option value=""> </option>
548 548
             <?php foreach ( $pages as $page ) { ?>
549
-				<option value="<?php echo esc_attr($page->ID); ?>" <?php selected( $selected, $page->ID ) ?>>
549
+				<option value="<?php echo esc_attr( $page->ID ); ?>" <?php selected( $selected, $page->ID ) ?>>
550 550
 					<?php echo esc_html( $truncate ? self::truncate( $page->post_title, $truncate ) : $page->post_title ); ?>
551 551
 				</option>
552 552
             <?php } ?>
@@ -555,26 +555,26 @@  discard block
 block discarded – undo
555 555
     }
556 556
 
557 557
 	public static function post_edit_link( $post_id ) {
558
-        $post = get_post($post_id);
558
+        $post = get_post( $post_id );
559 559
         if ( $post ) {
560
-			return '<a href="'. esc_url( admin_url('post.php?post='. $post_id .'&action=edit') ) .'">'. self::truncate( $post->post_title, 50 ) .'</a>';
560
+			return '<a href="' . esc_url( admin_url( 'post.php?post=' . $post_id . '&action=edit' ) ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
561 561
         }
562 562
         return '';
563 563
     }
564 564
 
565 565
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
566 566
     ?>
567
-        <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" <?php
567
+        <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" <?php
568 568
             echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
569 569
             ?> class="frm_multiselect">
570
-            <?php self::roles_options($capability); ?>
570
+            <?php self::roles_options( $capability ); ?>
571 571
         </select>
572 572
     <?php
573 573
     }
574 574
 
575 575
 	public static function roles_options( $capability ) {
576 576
         global $frm_vars;
577
-        if ( isset($frm_vars['editable_roles']) ) {
577
+        if ( isset( $frm_vars['editable_roles'] ) ) {
578 578
             $editable_roles = $frm_vars['editable_roles'];
579 579
         } else {
580 580
             $editable_roles = get_editable_roles();
@@ -582,10 +582,10 @@  discard block
 block discarded – undo
582 582
         }
583 583
 
584 584
         foreach ( $editable_roles as $role => $details ) {
585
-            $name = translate_user_role($details['name'] ); ?>
586
-        <option value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, (array) $capability) ? ' selected="selected"' : ''; ?>><?php echo esc_attr($name) ?> </option>
585
+            $name = translate_user_role( $details['name'] ); ?>
586
+        <option value="<?php echo esc_attr( $role ) ?>" <?php echo in_array( $role, (array) $capability ) ? ' selected="selected"' : ''; ?>><?php echo esc_attr( $name ) ?> </option>
587 587
 <?php
588
-            unset($role, $details);
588
+            unset( $role, $details );
589 589
         }
590 590
     }
591 591
 
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
     public static function maybe_add_permissions() {
642 642
 		self::force_capability( 'frm_view_entries' );
643 643
 
644
-        if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
644
+        if ( ! current_user_can( 'administrator' ) || current_user_can( 'frm_view_forms' ) ) {
645 645
             return;
646 646
         }
647 647
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
         $frm_roles = self::frm_capabilities();
651 651
         foreach ( $frm_roles as $frm_role => $frm_role_description ) {
652 652
 			$user->add_cap( $frm_role );
653
-            unset($frm_role, $frm_role_description);
653
+            unset( $frm_role, $frm_role_description );
654 654
         }
655 655
     }
656 656
 
@@ -675,12 +675,12 @@  discard block
 block discarded – undo
675 675
      * @param string $permission
676 676
      */
677 677
 	public static function permission_check( $permission, $show_message = 'show' ) {
678
-        $permission_error = self::permission_nonce_error($permission);
678
+        $permission_error = self::permission_nonce_error( $permission );
679 679
         if ( $permission_error !== false ) {
680 680
             if ( 'hide' == $show_message ) {
681 681
                 $permission_error = '';
682 682
             }
683
-            wp_die($permission_error);
683
+            wp_die( $permission_error );
684 684
         }
685 685
     }
686 686
 
@@ -697,11 +697,11 @@  discard block
 block discarded – undo
697 697
 		}
698 698
 
699 699
 		$error = false;
700
-        if ( empty($nonce_name) ) {
700
+        if ( empty( $nonce_name ) ) {
701 701
             return $error;
702 702
         }
703 703
 
704
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
704
+        if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $_REQUEST[$nonce_name], $nonce ) ) ) {
705 705
             $frm_settings = self::get_settings();
706 706
             $error = $frm_settings->admin_permission;
707 707
         }
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 			} else {
782 782
 				foreach ( $value as $k => $v ) {
783 783
 					if ( ! is_array( $v ) ) {
784
-						$value[ $k ] = call_user_func( $original_function, $v );
784
+						$value[$k] = call_user_func( $original_function, $v );
785 785
 					}
786 786
 				}
787 787
 			}
@@ -802,11 +802,11 @@  discard block
 block discarded – undo
802 802
 	public static function array_flatten( $array, $keys = 'keep' ) {
803 803
         $return = array();
804 804
         foreach ( $array as $key => $value ) {
805
-            if ( is_array($value) ) {
805
+            if ( is_array( $value ) ) {
806 806
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
807 807
             } else {
808 808
 				if ( $keys == 'keep' ) {
809
-					$return[ $key ] = $value;
809
+					$return[$key] = $value;
810 810
 				} else {
811 811
 					$return[] = $value;
812 812
 				}
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
     }
817 817
 
818 818
     public static function esc_textarea( $text ) {
819
-        $safe_text = str_replace('&quot;', '"', $text);
819
+        $safe_text = str_replace( '&quot;', '"', $text );
820 820
         $safe_text = htmlspecialchars( $safe_text, ENT_NOQUOTES );
821 821
     	return apply_filters( 'esc_textarea', $safe_text, $text );
822 822
     }
@@ -826,8 +826,8 @@  discard block
 block discarded – undo
826 826
      * @since 2.0
827 827
      */
828 828
 	public static function use_wpautop( $content ) {
829
-        if ( apply_filters('frm_use_wpautop', true) ) {
830
-            $content = wpautop(str_replace( '<br>', '<br />', $content));
829
+        if ( apply_filters( 'frm_use_wpautop', true ) ) {
830
+            $content = wpautop( str_replace( '<br>', '<br />', $content ) );
831 831
         }
832 832
         return $content;
833 833
     }
@@ -845,8 +845,8 @@  discard block
 block discarded – undo
845 845
      * @return string The base Google APIS url for the current version of jQuery UI
846 846
      */
847 847
     public static function jquery_ui_base_url() {
848
-        $url = 'http'. ( is_ssl() ? 's' : '' ) .'://ajax.googleapis.com/ajax/libs/jqueryui/'. self::script_version('jquery-ui-core');
849
-        $url = apply_filters('frm_jquery_ui_base_url', $url);
848
+        $url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core' );
849
+        $url = apply_filters( 'frm_jquery_ui_base_url', $url );
850 850
         return $url;
851 851
     }
852 852
 
@@ -861,11 +861,11 @@  discard block
 block discarded – undo
861 861
 
862 862
         $ver = 0;
863 863
 
864
-        if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
864
+        if ( ! isset( $wp_scripts->registered[$handle] ) ) {
865 865
             return $ver;
866 866
         }
867 867
 
868
-        $query = $wp_scripts->registered[ $handle ];
868
+        $query = $wp_scripts->registered[$handle];
869 869
     	if ( is_object( $query ) ) {
870 870
     	    $ver = $query->ver;
871 871
     	}
@@ -878,36 +878,36 @@  discard block
 block discarded – undo
878 878
     }
879 879
 
880 880
 	public static function get_user_id_param( $user_id ) {
881
-        if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
881
+        if ( ! $user_id || empty( $user_id ) || is_numeric( $user_id ) ) {
882 882
             return $user_id;
883 883
         }
884 884
 
885 885
 		if ( $user_id == 'current' ) {
886 886
 			$user_id = get_current_user_id();
887 887
 		} else {
888
-            if ( is_email($user_id) ) {
889
-                $user = get_user_by('email', $user_id);
888
+            if ( is_email( $user_id ) ) {
889
+                $user = get_user_by( 'email', $user_id );
890 890
             } else {
891
-                $user = get_user_by('login', $user_id);
891
+                $user = get_user_by( 'login', $user_id );
892 892
             }
893 893
 
894 894
             if ( $user ) {
895 895
                 $user_id = $user->ID;
896 896
             }
897
-            unset($user);
897
+            unset( $user );
898 898
         }
899 899
 
900 900
         return $user_id;
901 901
     }
902 902
 
903 903
 	public static function get_file_contents( $filename, $atts = array() ) {
904
-        if ( ! is_file($filename) ) {
904
+        if ( ! is_file( $filename ) ) {
905 905
             return false;
906 906
         }
907 907
 
908
-        extract($atts);
908
+        extract( $atts );
909 909
         ob_start();
910
-        include($filename);
910
+        include( $filename );
911 911
         $contents = ob_get_contents();
912 912
         ob_end_clean();
913 913
         return $contents;
@@ -923,28 +923,28 @@  discard block
 block discarded – undo
923 923
         $key = '';
924 924
 
925 925
         if ( ! empty( $name ) ) {
926
-            $key = sanitize_key($name);
926
+            $key = sanitize_key( $name );
927 927
         }
928 928
 
929 929
 		if ( empty( $key ) ) {
930
-            $max_slug_value = pow(36, $num_chars);
930
+            $max_slug_value = pow( 36, $num_chars );
931 931
             $min_slug_value = 37; // we want to have at least 2 characters in the slug
932
-            $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
932
+            $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
933 933
         }
934 934
 
935
-		if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
936
-            $key = $key .'a';
935
+		if ( is_numeric( $key ) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
936
+            $key = $key . 'a';
937 937
         }
938 938
 
939 939
 		$key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
940 940
 
941
-        if ( $key_check || is_numeric($key_check) ) {
941
+        if ( $key_check || is_numeric( $key_check ) ) {
942 942
             $suffix = 2;
943 943
 			do {
944 944
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
945 945
 				$key_check = FrmDb::get_var( $table_name, array( $column => $alt_post_name, 'ID !' => $id ), $column );
946
-				$suffix++;
947
-			} while ($key_check || is_numeric($key_check));
946
+				$suffix ++;
947
+			} while ( $key_check || is_numeric( $key_check ) );
948 948
 			$key = $alt_post_name;
949 949
         }
950 950
         return $key;
@@ -960,32 +960,32 @@  discard block
 block discarded – undo
960 960
             return false;
961 961
         }
962 962
 
963
-        if ( empty($post_values) ) {
964
-            $post_values = stripslashes_deep($_POST);
963
+        if ( empty( $post_values ) ) {
964
+            $post_values = stripslashes_deep( $_POST );
965 965
         }
966 966
 
967 967
 		$values = array( 'id' => $record->id, 'fields' => array() );
968 968
 
969 969
 		foreach ( array( 'name', 'description' ) as $var ) {
970
-            $default_val = isset($record->{$var}) ? $record->{$var} : '';
971
-            $values[ $var ] = self::get_param( $var, $default_val );
972
-            unset($var, $default_val);
970
+            $default_val = isset( $record->{$var}) ? $record->{$var} : '';
971
+            $values[$var] = self::get_param( $var, $default_val );
972
+            unset( $var, $default_val );
973 973
         }
974 974
 
975
-        $values['description'] = self::use_wpautop($values['description']);
975
+        $values['description'] = self::use_wpautop( $values['description'] );
976 976
         $frm_settings = self::get_settings();
977
-        $is_form_builder = self::is_admin_page('formidable' );
977
+        $is_form_builder = self::is_admin_page( 'formidable' );
978 978
 
979 979
         foreach ( (array) $fields as $field ) {
980 980
             // Make sure to filter default values (for placeholder text), but not on the form builder page
981 981
             if ( ! $is_form_builder ) {
982
-                $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
982
+                $field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true );
983 983
             }
984 984
 			$parent_form_id = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
985
-			self::fill_field_defaults($field, $record, $values, compact('default', 'post_values', 'frm_settings', 'parent_form_id' ) );
985
+			self::fill_field_defaults( $field, $record, $values, compact( 'default', 'post_values', 'frm_settings', 'parent_form_id' ) );
986 986
         }
987 987
 
988
-        self::fill_form_opts($record, $table, $post_values, $values);
988
+        self::fill_form_opts( $record, $table, $post_values, $values );
989 989
 
990 990
         if ( $table == 'entries' ) {
991 991
             $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
@@ -1002,8 +1002,8 @@  discard block
 block discarded – undo
1002 1002
         if ( $args['default'] ) {
1003 1003
             $meta_value = $field->default_value;
1004 1004
         } else {
1005
-            if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
1006
-                if ( ! isset($field->field_options['custom_field']) ) {
1005
+            if ( $record->post_id && self::pro_is_installed() && isset( $field->field_options['post_field'] ) && $field->field_options['post_field'] ) {
1006
+                if ( ! isset( $field->field_options['custom_field'] ) ) {
1007 1007
                     $field->field_options['custom_field'] = '';
1008 1008
                 }
1009 1009
 				$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 ) );
@@ -1012,8 +1012,8 @@  discard block
 block discarded – undo
1012 1012
             }
1013 1013
         }
1014 1014
 
1015
-        $field_type = isset( $post_values['field_options'][ 'type_'. $field->id ] ) ? $post_values['field_options'][ 'type_'. $field->id ] : $field->type;
1016
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1015
+        $field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type;
1016
+        $new_value = isset( $post_values['item_meta'][$field->id] ) ? maybe_unserialize( $post_values['item_meta'][$field->id] ) : $meta_value;
1017 1017
 
1018 1018
         $field_array = array(
1019 1019
             'id'            => $field->id,
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
             'default_value' => $field->default_value,
1022 1022
             'name'          => $field->name,
1023 1023
             'description'   => $field->description,
1024
-            'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1024
+            'type'          => apply_filters( 'frm_field_type', $field_type, $field, $new_value ),
1025 1025
             'options'       => $field->options,
1026 1026
             'required'      => $field->required,
1027 1027
             'field_key'     => $field->field_key,
@@ -1031,38 +1031,38 @@  discard block
 block discarded – undo
1031 1031
         );
1032 1032
 
1033 1033
         $args['field_type'] = $field_type;
1034
-        self::fill_field_opts($field, $field_array, $args);
1034
+        self::fill_field_opts( $field, $field_array, $args );
1035 1035
 
1036
-        $field_array = apply_filters('frm_setup_edit_fields_vars', $field_array, $field, $values['id']);
1036
+        $field_array = apply_filters( 'frm_setup_edit_fields_vars', $field_array, $field, $values['id'] );
1037 1037
 
1038
-        if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1038
+        if ( ! isset( $field_array['unique'] ) || ! $field_array['unique'] ) {
1039 1039
             $field_array['unique_msg'] = '';
1040 1040
         }
1041 1041
 
1042 1042
         $field_array = array_merge( $field->field_options, $field_array );
1043 1043
 
1044
-        $values['fields'][ $field->id ] = $field_array;
1044
+        $values['fields'][$field->id] = $field_array;
1045 1045
     }
1046 1046
 
1047 1047
 	private static function fill_field_opts( $field, array &$field_array, $args ) {
1048 1048
         $post_values = $args['post_values'];
1049
-        $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1049
+        $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true );
1050 1050
 
1051 1051
         foreach ( $opt_defaults as $opt => $default_opt ) {
1052
-            $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 );
1053
-            if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1054
-                $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1055
-            } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1052
+            $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 );
1053
+            if ( $opt == 'blank' && $field_array[$opt] == '' ) {
1054
+                $field_array[$opt] = $args['frm_settings']->blank_msg;
1055
+            } else if ( $opt == 'invalid' && $field_array[$opt] == '' ) {
1056 1056
                 if ( $args['field_type'] == 'captcha' ) {
1057
-                    $field_array[ $opt ] = $args['frm_settings']->re_msg;
1057
+                    $field_array[$opt] = $args['frm_settings']->re_msg;
1058 1058
                 } else {
1059
-                    $field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1059
+                    $field_array[$opt] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1060 1060
                 }
1061 1061
             }
1062 1062
         }
1063 1063
 
1064 1064
         if ( $field_array['custom_html'] == '' ) {
1065
-            $field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1065
+            $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $args['field_type'] );
1066 1066
         }
1067 1067
     }
1068 1068
 
@@ -1081,18 +1081,18 @@  discard block
 block discarded – undo
1081 1081
             return;
1082 1082
         }
1083 1083
 
1084
-        $values['form_name'] = isset($record->form_id) ? $form->name : '';
1084
+        $values['form_name'] = isset( $record->form_id ) ? $form->name : '';
1085 1085
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1086 1086
 
1087
-        if ( ! is_array($form->options) ) {
1087
+        if ( ! is_array( $form->options ) ) {
1088 1088
             return;
1089 1089
         }
1090 1090
 
1091 1091
         foreach ( $form->options as $opt => $value ) {
1092
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1092
+            $values[$opt] = isset( $post_values[$opt] ) ? maybe_unserialize( $post_values[$opt] ) : $value;
1093 1093
         }
1094 1094
 
1095
-        self::fill_form_defaults($post_values, $values);
1095
+        self::fill_form_defaults( $post_values, $values );
1096 1096
     }
1097 1097
 
1098 1098
     /**
@@ -1102,23 +1102,23 @@  discard block
 block discarded – undo
1102 1102
         $form_defaults = FrmFormsHelper::get_default_opts();
1103 1103
 
1104 1104
         foreach ( $form_defaults as $opt => $default ) {
1105
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1106
-				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1105
+            if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) {
1106
+				$values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default;
1107 1107
             }
1108 1108
 
1109
-            unset($opt, $defaut);
1109
+            unset( $opt, $defaut );
1110 1110
         }
1111 1111
 
1112
-        if ( ! isset($values['custom_style']) ) {
1112
+        if ( ! isset( $values['custom_style'] ) ) {
1113 1113
             $frm_settings = self::get_settings();
1114 1114
 			$values['custom_style'] = ( $post_values && isset( $post_values['options']['custom_style'] ) ) ? absint( $_POST['options']['custom_style'] ) : ( $frm_settings->load_style != 'none' );
1115 1115
         }
1116 1116
 
1117 1117
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1118
-            if ( ! isset( $values[ $h .'_html' ] ) ) {
1119
-                $values[ $h .'_html' ] = ( isset( $post_values['options'][ $h .'_html' ] ) ? $post_values['options'][ $h .'_html' ] : FrmFormsHelper::get_default_html( $h ) );
1118
+            if ( ! isset( $values[$h . '_html'] ) ) {
1119
+                $values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) );
1120 1120
             }
1121
-            unset($h);
1121
+            unset( $h );
1122 1122
         }
1123 1123
     }
1124 1124
 
@@ -1134,9 +1134,9 @@  discard block
 block discarded – undo
1134 1134
         }
1135 1135
     ?>
1136 1136
 <li>
1137
-    <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>
1138
-    <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>
1139
-    <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>
1137
+    <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>
1138
+    <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>
1139
+    <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>
1140 1140
 </li>
1141 1141
     <?php
1142 1142
     }
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
             return '';
1165 1165
         } else if ( $length <= 10 ) {
1166 1166
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1167
-            return $sub . (($length < $original_len) ? $continue : '');
1167
+            return $sub . ( ( $length < $original_len ) ? $continue : '' );
1168 1168
         }
1169 1169
 
1170 1170
         $sub = '';
@@ -1173,23 +1173,23 @@  discard block
 block discarded – undo
1173 1173
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1174 1174
 
1175 1175
 		foreach ( $words as $word ) {
1176
-            $part = (($sub != '') ? ' ' : '') . $word;
1176
+            $part = ( ( $sub != '' ) ? ' ' : '' ) . $word;
1177 1177
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1178
-            if ( $total_len > $length && str_word_count($sub) ) {
1178
+            if ( $total_len > $length && str_word_count( $sub ) ) {
1179 1179
                 break;
1180 1180
             }
1181 1181
 
1182 1182
             $sub .= $part;
1183 1183
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1184 1184
 
1185
-            if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1185
+            if ( str_word_count( $sub ) > $minword && $total_len >= $length ) {
1186 1186
                 break;
1187 1187
             }
1188 1188
 
1189
-            unset($total_len, $word);
1189
+            unset( $total_len, $word );
1190 1190
         }
1191 1191
 
1192
-        return $sub . (($len < $original_len) ? $continue : '');
1192
+        return $sub . ( ( $len < $original_len ) ? $continue : '' );
1193 1193
     }
1194 1194
 
1195 1195
 	public static function mb_function( $function_names, $args ) {
@@ -1202,17 +1202,17 @@  discard block
 block discarded – undo
1202 1202
 	}
1203 1203
 
1204 1204
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1205
-        if ( empty($date) ) {
1205
+        if ( empty( $date ) ) {
1206 1206
             return $date;
1207 1207
         }
1208 1208
 
1209
-        if ( empty($date_format) ) {
1210
-            $date_format = get_option('date_format');
1209
+        if ( empty( $date_format ) ) {
1210
+            $date_format = get_option( 'date_format' );
1211 1211
         }
1212 1212
 
1213
-        if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1213
+        if ( preg_match( '/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {
1214 1214
             $frmpro_settings = new FrmProSettings();
1215
-            $date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1215
+            $date = FrmProAppHelper::convert_date( $date, $frmpro_settings->date_format, 'Y-m-d' );
1216 1216
         }
1217 1217
 
1218 1218
 		$formatted = self::get_localized_date( $date_format, $date );
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 
1228 1228
 	private static function add_time_to_date( $time_format, $date ) {
1229 1229
 		if ( empty( $time_format ) ) {
1230
-			$time_format = get_option('time_format');
1230
+			$time_format = get_option( 'time_format' );
1231 1231
 		}
1232 1232
 
1233 1233
 		$trimmed_format = trim( $time_format );
@@ -1273,10 +1273,10 @@  discard block
 block discarded – undo
1273 1273
 		$time_strings = self::get_time_strings();
1274 1274
 
1275 1275
 		foreach ( $time_strings as $k => $v ) {
1276
-			if ( $diff[ $k ] ) {
1277
-				$time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] );
1276
+			if ( $diff[$k] ) {
1277
+				$time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] );
1278 1278
 			} else {
1279
-				unset( $time_strings[ $k ] );
1279
+				unset( $time_strings[$k] );
1280 1280
 			}
1281 1281
 		}
1282 1282
 
@@ -1314,7 +1314,7 @@  discard block
 block discarded – undo
1314 1314
      */
1315 1315
 	public static function esc_like( $term ) {
1316 1316
         global $wpdb;
1317
-        if ( method_exists($wpdb, 'esc_like') ) {
1317
+        if ( method_exists( $wpdb, 'esc_like' ) ) {
1318 1318
 			// WP 4.0
1319 1319
             $term = $wpdb->esc_like( $term );
1320 1320
         } else {
@@ -1328,17 +1328,17 @@  discard block
 block discarded – undo
1328 1328
      * @param string $order_query
1329 1329
      */
1330 1330
 	public static function esc_order( $order_query ) {
1331
-        if ( empty($order_query) ) {
1331
+        if ( empty( $order_query ) ) {
1332 1332
             return '';
1333 1333
         }
1334 1334
 
1335 1335
         // remove ORDER BY before santizing
1336
-        $order_query = strtolower($order_query);
1337
-        if ( strpos($order_query, 'order by') !== false ) {
1338
-            $order_query = str_replace('order by', '', $order_query);
1336
+        $order_query = strtolower( $order_query );
1337
+        if ( strpos( $order_query, 'order by' ) !== false ) {
1338
+            $order_query = str_replace( 'order by', '', $order_query );
1339 1339
         }
1340 1340
 
1341
-        $order_query = explode(' ', trim($order_query));
1341
+        $order_query = explode( ' ', trim( $order_query ) );
1342 1342
 
1343 1343
         $order_fields = array(
1344 1344
             'id', 'form_key', 'name', 'description',
@@ -1346,18 +1346,18 @@  discard block
 block discarded – undo
1346 1346
             'default_template', 'status', 'created_at',
1347 1347
         );
1348 1348
 
1349
-        $order = trim(trim(reset($order_query), ','));
1350
-        if ( ! in_array($order, $order_fields) ) {
1349
+        $order = trim( trim( reset( $order_query ), ',' ) );
1350
+        if ( ! in_array( $order, $order_fields ) ) {
1351 1351
             return '';
1352 1352
         }
1353 1353
 
1354 1354
         $order_by = '';
1355
-        if ( count($order_query) > 1 ) {
1355
+        if ( count( $order_query ) > 1 ) {
1356 1356
 			$order_by = end( $order_query );
1357 1357
 			self::esc_order_by( $order_by );
1358 1358
         }
1359 1359
 
1360
-        return ' ORDER BY '. $order . ' '. $order_by;
1360
+        return ' ORDER BY ' . $order . ' ' . $order_by;
1361 1361
     }
1362 1362
 
1363 1363
 	/**
@@ -1374,24 +1374,24 @@  discard block
 block discarded – undo
1374 1374
      * @param string $limit
1375 1375
      */
1376 1376
 	public static function esc_limit( $limit ) {
1377
-        if ( empty($limit) ) {
1377
+        if ( empty( $limit ) ) {
1378 1378
             return '';
1379 1379
         }
1380 1380
 
1381
-        $limit = trim(str_replace(' limit', '', strtolower($limit)));
1382
-        if ( is_numeric($limit) ) {
1383
-            return ' LIMIT '. $limit;
1381
+        $limit = trim( str_replace( ' limit', '', strtolower( $limit ) ) );
1382
+        if ( is_numeric( $limit ) ) {
1383
+            return ' LIMIT ' . $limit;
1384 1384
         }
1385 1385
 
1386
-        $limit = explode(',', trim($limit));
1386
+        $limit = explode( ',', trim( $limit ) );
1387 1387
         foreach ( $limit as $k => $l ) {
1388 1388
             if ( is_numeric( $l ) ) {
1389
-                $limit[ $k ] = $l;
1389
+                $limit[$k] = $l;
1390 1390
             }
1391 1391
         }
1392 1392
 
1393
-        $limit = implode(',', $limit);
1394
-        return ' LIMIT '. $limit;
1393
+        $limit = implode( ',', $limit );
1394
+        return ' LIMIT ' . $limit;
1395 1395
     }
1396 1396
 
1397 1397
     /**
@@ -1399,12 +1399,12 @@  discard block
 block discarded – undo
1399 1399
      * @since 2.0
1400 1400
      */
1401 1401
     public static function prepare_array_values( $array, $type = '%s' ) {
1402
-        $placeholders = array_fill(0, count($array), $type);
1403
-        return implode(', ', $placeholders);
1402
+        $placeholders = array_fill( 0, count( $array ), $type );
1403
+        return implode( ', ', $placeholders );
1404 1404
     }
1405 1405
 
1406 1406
     public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1407
-        if ( empty($where) ) {
1407
+        if ( empty( $where ) ) {
1408 1408
             return '';
1409 1409
         }
1410 1410
 
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
 
1451 1451
     public static function get_referer_info() {
1452 1452
         _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::get_server_value' );
1453
-        return self::get_server_value('HTTP_REFERER');
1453
+        return self::get_server_value( 'HTTP_REFERER' );
1454 1454
     }
1455 1455
 
1456 1456
 	/**
@@ -1459,19 +1459,19 @@  discard block
 block discarded – undo
1459 1459
 	public static function json_to_array( $json_vars ) {
1460 1460
         $vars = array();
1461 1461
         foreach ( $json_vars as $jv ) {
1462
-            $jv_name = explode('[', $jv['name']);
1463
-            $last = count($jv_name) - 1;
1462
+            $jv_name = explode( '[', $jv['name'] );
1463
+            $last = count( $jv_name ) - 1;
1464 1464
             foreach ( $jv_name as $p => $n ) {
1465
-                $name = trim($n, ']');
1466
-                if ( ! isset($l1) ) {
1465
+                $name = trim( $n, ']' );
1466
+                if ( ! isset( $l1 ) ) {
1467 1467
                     $l1 = $name;
1468 1468
                 }
1469 1469
 
1470
-                if ( ! isset($l2) ) {
1470
+                if ( ! isset( $l2 ) ) {
1471 1471
                     $l2 = $name;
1472 1472
                 }
1473 1473
 
1474
-                if ( ! isset($l3) ) {
1474
+                if ( ! isset( $l3 ) ) {
1475 1475
                     $l3 = $name;
1476 1476
                 }
1477 1477
 
@@ -1485,24 +1485,24 @@  discard block
 block discarded – undo
1485 1485
 
1486 1486
                     case 1:
1487 1487
                         $l2 = $name;
1488
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1488
+                        self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] );
1489 1489
                     break;
1490 1490
 
1491 1491
                     case 2:
1492 1492
                         $l3 = $name;
1493
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1493
+                        self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] );
1494 1494
                     break;
1495 1495
 
1496 1496
                     case 3:
1497 1497
                         $l4 = $name;
1498
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1498
+                        self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] );
1499 1499
                     break;
1500 1500
                 }
1501 1501
 
1502
-                unset($this_val, $n);
1502
+                unset( $this_val, $n );
1503 1503
             }
1504 1504
 
1505
-            unset($last, $jv);
1505
+            unset( $last, $jv );
1506 1506
         }
1507 1507
 
1508 1508
         return $vars;
@@ -1515,8 +1515,8 @@  discard block
 block discarded – undo
1515 1515
     public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1516 1516
         if ( $name == '' ) {
1517 1517
             $vars[] = $val;
1518
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1519
-            $vars[ $l1 ] = $val;
1518
+        } else if ( ! isset( $vars[$l1] ) ) {
1519
+            $vars[$l1] = $val;
1520 1520
         }
1521 1521
     }
1522 1522
 
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
             '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() ) ),
1532 1532
         );
1533 1533
 
1534
-        if ( ! isset( $tooltips[ $name ] ) ) {
1534
+        if ( ! isset( $tooltips[$name] ) ) {
1535 1535
             return;
1536 1536
         }
1537 1537
 
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
             echo ' class="frm_help"';
1542 1542
         }
1543 1543
 
1544
-        echo ' title="'. esc_attr( $tooltips[ $name ] );
1544
+        echo ' title="' . esc_attr( $tooltips[$name] );
1545 1545
 
1546 1546
         if ( 'open' != $class ) {
1547 1547
             echo '"';
@@ -1593,13 +1593,13 @@  discard block
 block discarded – undo
1593 1593
     }
1594 1594
 
1595 1595
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1596
-		if ( ! isset( $post_content[ $key ] ) ) {
1596
+		if ( ! isset( $post_content[$key] ) ) {
1597 1597
 			return;
1598 1598
 		}
1599 1599
 
1600 1600
 		if ( is_array( $val ) ) {
1601 1601
 			foreach ( $val as $k1 => $v1 ) {
1602
-				self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] );
1602
+				self::prepare_action_slashes( $v1, $k1, $post_content[$key] );
1603 1603
 				unset( $k1, $v1 );
1604 1604
 			}
1605 1605
 		} else {
@@ -1607,7 +1607,7 @@  discard block
 block discarded – undo
1607 1607
 			$val = stripslashes( $val );
1608 1608
 
1609 1609
 			// Add backslashes before double quotes and forward slashes only
1610
-			$post_content[ $key ] = addcslashes( $val, '"\\/' );
1610
+			$post_content[$key] = addcslashes( $val, '"\\/' );
1611 1611
 		}
1612 1612
 	}
1613 1613
 
@@ -1624,7 +1624,7 @@  discard block
 block discarded – undo
1624 1624
 		$settings['post_content'] = FrmAppHelper::prepare_and_encode( $settings['post_content'] );
1625 1625
 
1626 1626
 		if ( empty( $settings['ID'] ) ) {
1627
-			unset( $settings['ID']);
1627
+			unset( $settings['ID'] );
1628 1628
 		}
1629 1629
 
1630 1630
 		// delete all caches for this group
@@ -1658,17 +1658,17 @@  discard block
 block discarded – undo
1658 1658
 	}
1659 1659
 
1660 1660
 	public static function maybe_json_decode( $string ) {
1661
-        if ( is_array($string) ) {
1661
+        if ( is_array( $string ) ) {
1662 1662
             return $string;
1663 1663
         }
1664 1664
 
1665
-        $new_string = json_decode($string, true);
1666
-        if ( function_exists('json_last_error') ) {
1665
+        $new_string = json_decode( $string, true );
1666
+        if ( function_exists( 'json_last_error' ) ) {
1667 1667
 			// php 5.3+
1668 1668
             if ( json_last_error() == JSON_ERROR_NONE ) {
1669 1669
                 $string = $new_string;
1670 1670
             }
1671
-        } else if ( isset($new_string) ) {
1671
+        } else if ( isset( $new_string ) ) {
1672 1672
 			// php < 5.3 fallback
1673 1673
             $string = $new_string;
1674 1674
         }
@@ -1684,11 +1684,11 @@  discard block
 block discarded – undo
1684 1684
 	public static function maybe_highlight_menu( $post_type ) {
1685 1685
         global $post, $pagenow;
1686 1686
 
1687
-        if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1687
+        if ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] != $post_type ) {
1688 1688
             return;
1689 1689
         }
1690 1690
 
1691
-        if ( is_object($post) && $post->post_type != $post_type ) {
1691
+        if ( is_object( $post ) && $post->post_type != $post_type ) {
1692 1692
             return;
1693 1693
         }
1694 1694
 
@@ -1786,11 +1786,11 @@  discard block
 block discarded – undo
1786 1786
         $frm_version = self::plugin_version();
1787 1787
 
1788 1788
         // check if Formidable meets minimum requirements
1789
-        if ( version_compare($frm_version, $min_version, '>=') ) {
1789
+        if ( version_compare( $frm_version, $min_version, '>=' ) ) {
1790 1790
             return;
1791 1791
         }
1792 1792
 
1793
-        $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1793
+        $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
1794 1794
 		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">' .
1795 1795
         __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1796 1796
         '</div></td></tr>';
@@ -1798,38 +1798,38 @@  discard block
 block discarded – undo
1798 1798
 
1799 1799
     public static function locales( $type = 'date' ) {
1800 1800
         $locales = array(
1801
-            'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1802
-            'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1803
-            'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1801
+            'en' => __( 'English', 'formidable' ), '' => __( 'English/Western', 'formidable' ),
1802
+            'af' => __( 'Afrikaans', 'formidable' ), 'sq' => __( 'Albanian', 'formidable' ),
1803
+            'ar' => __( 'Arabic', 'formidable' ), 'hy' => __( 'Armenian', 'formidable' ),
1804 1804
             'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1805
-            'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1806
-            'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1805
+            'bs' => __( 'Bosnian', 'formidable' ), 'bg' => __( 'Bulgarian', 'formidable' ),
1806
+            'ca' => __( 'Catalan', 'formidable' ), 'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1807 1807
             'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1808
-            'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1809
-            'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1808
+            'hr' => __( 'Croatian', 'formidable' ), 'cs' => __( 'Czech', 'formidable' ),
1809
+            'da' => __( 'Danish', 'formidable' ), 'nl' => __( 'Dutch', 'formidable' ),
1810 1810
             'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1811
-            'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1811
+            'et' => __( 'Estonian', 'formidable' ), 'fo' => __( 'Faroese', 'formidable' ),
1812 1812
             'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1813
-            'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1813
+            'fi' => __( 'Finnish', 'formidable' ), 'fr' => __( 'French', 'formidable' ),
1814 1814
             'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1815
-            'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1815
+            'de' => __( 'German', 'formidable' ), 'de-AT' => __( 'German/Austria', 'formidable' ),
1816 1816
             'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1817
-            'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1818
-            'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1819
-            'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1820
-            'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1821
-            'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1817
+            'he' => __( 'Hebrew', 'formidable' ), 'iw' => __( 'Hebrew', 'formidable' ),
1818
+            'hi' => __( 'Hindi', 'formidable' ), 'hu' => __( 'Hungarian', 'formidable' ),
1819
+            'is' => __( 'Icelandic', 'formidable' ), 'id' => __( 'Indonesian', 'formidable' ),
1820
+            'it' => __( 'Italian', 'formidable' ), 'ja' => __( 'Japanese', 'formidable' ),
1821
+            'ko' => __( 'Korean', 'formidable' ), 'lv' => __( 'Latvian', 'formidable' ),
1822 1822
             'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1823
-            'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1823
+            'no' => __( 'Norwegian', 'formidable' ), 'pl' => __( 'Polish', 'formidable' ),
1824 1824
             'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1825 1825
             'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1826
-            'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1826
+            'ru' => __( 'Russian', 'formidable' ), 'sr' => __( 'Serbian', 'formidable' ),
1827 1827
             'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1828
-            'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1828
+            'sl' => __( 'Slovenian', 'formidable' ), 'es' => __( 'Spanish', 'formidable' ),
1829 1829
             'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1830
-            'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1831
-            'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1832
-            'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1830
+            'ta' => __( 'Tamil', 'formidable' ), 'th' => __( 'Thai', 'formidable' ),
1831
+            'tu' => __( 'Turkish', 'formidable' ), 'tr' => __( 'Turkish', 'formidable' ),
1832
+            'uk' => __( 'Ukranian', 'formidable' ), 'vi' => __( 'Vietnamese', 'formidable' ),
1833 1833
         );
1834 1834
 
1835 1835
         if ( $type == 'captcha' ) {
@@ -1848,8 +1848,8 @@  discard block
 block discarded – undo
1848 1848
             );
1849 1849
         }
1850 1850
 
1851
-        $locales = array_diff_key($locales, array_flip($unset));
1852
-        $locales = apply_filters('frm_locales', $locales);
1851
+        $locales = array_diff_key( $locales, array_flip( $unset ) );
1852
+        $locales = apply_filters( 'frm_locales', $locales );
1853 1853
 
1854 1854
         return $locales;
1855 1855
     }
Please login to merge, or discard this patch.