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