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