Completed
Branch 3.0 (1aee71)
by Stephanie
03:09
created
classes/helpers/FrmFieldsHelper.php 1 patch
Indentation   +475 added lines, -475 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
 
8 8
 	public static function setup_new_vars( $type = '', $form_id = '' ) {
9 9
 
10
-        if ( strpos($type, '|') ) {
11
-            list($type, $setting) = explode('|', $type);
12
-        }
10
+		if ( strpos($type, '|') ) {
11
+			list($type, $setting) = explode('|', $type);
12
+		}
13 13
 
14 14
 		$values = self::get_default_field( $type );
15 15
 
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
 			}
30 30
 		}
31 31
 
32
-        return $values;
33
-    }
32
+		return $values;
33
+	}
34 34
 
35 35
 	public static function get_html_id( $field, $plus = '' ) {
36 36
 		return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field );
37
-    }
37
+	}
38 38
 
39
-    public static function setup_edit_vars( $field, $doing_ajax = false ) {
39
+	public static function setup_edit_vars( $field, $doing_ajax = false ) {
40 40
 		$values = self::field_object_to_array( $field, $doing_ajax );
41 41
 		return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) );
42
-    }
42
+	}
43 43
 
44 44
 	public static function field_object_to_array( $field, $doing_ajax = false ) {
45 45
 		$values = (array) $field;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		}
85 85
 	}
86 86
 
87
-    public static function get_default_field_opts( $type, $field, $limit = false ) {
87
+	public static function get_default_field_opts( $type, $field, $limit = false ) {
88 88
 		if ( $limit ) {
89 89
 			_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldHelper::get_default_field_options' );
90 90
 			$field_options = self::get_default_field_options( $type );
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		}
95 95
 
96 96
 		return $field_options;
97
-    }
97
+	}
98 98
 
99 99
 	/**
100 100
 	 * @since 3.0
@@ -123,22 +123,22 @@  discard block
 block discarded – undo
123 123
 		return $field_type->get_new_field_defaults();
124 124
 	}
125 125
 
126
-    public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
127
-        global $wpdb;
126
+	public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
127
+		global $wpdb;
128 128
 
129 129
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
130
-        $values['form_id'] = $form_id;
131
-        $values['options'] = maybe_serialize($field->options);
132
-        $values['default_value'] = maybe_serialize($field->default_value);
133
-
134
-        foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
135
-            $values[ $col ] = $field->{$col};
136
-        }
137
-    }
138
-
139
-    /**
140
-     * @since 2.0
141
-     */
130
+		$values['form_id'] = $form_id;
131
+		$values['options'] = maybe_serialize($field->options);
132
+		$values['default_value'] = maybe_serialize($field->default_value);
133
+
134
+		foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
135
+			$values[ $col ] = $field->{$col};
136
+		}
137
+	}
138
+
139
+	/**
140
+	 * @since 2.0
141
+	 */
142 142
 	public static function get_error_msg( $field, $error ) {
143 143
 		$frm_settings = FrmAppHelper::get_settings();
144 144
 		$default_settings = $frm_settings->default_options();
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 
244 244
 	public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
245 245
 		_deprecated_function( __FUNCTION__, '3.0', 'FrmShortcodeHelper::get_shortcode_tag' );
246
-        return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args );
247
-    }
246
+		return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args );
247
+	}
248 248
 
249 249
 	public static function get_checkbox_id( $field, $opt_key ) {
250 250
 		$id = $field['id'];
@@ -256,37 +256,37 @@  discard block
 block discarded – undo
256 256
 
257 257
 	public static function display_recaptcha( $field ) {
258 258
 		_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldCaptcha::field_input' );
259
-    }
259
+	}
260 260
 
261 261
 	public static function show_single_option( $field ) {
262 262
 		if ( ! is_array( $field['options'] ) ) {
263 263
 			return;
264 264
 		}
265 265
 
266
-        $field_name = $field['name'];
267
-        $html_id = self::get_html_id($field);
266
+		$field_name = $field['name'];
267
+		$html_id = self::get_html_id($field);
268 268
 
269 269
 		foreach ( $field['options'] as $opt_key => $opt ) {
270
-		    $field_val = self::get_value_from_array( $opt, $opt_key, $field );
271
-		    $opt = self::get_label_from_array( $opt, $opt_key, $field );
270
+			$field_val = self::get_value_from_array( $opt, $opt_key, $field );
271
+			$opt = self::get_label_from_array( $opt, $opt_key, $field );
272 272
 
273 273
 			// Get string for Other text field, if needed
274 274
 			$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
275 275
 
276 276
 			$checked = ( $other_val || isset( $field['value'] ) && ( ( ! is_array( $field['value'] ) && $field['value'] == $field_val ) || ( is_array($field['value'] ) && in_array( $field_val, $field['value'] ) ) ) ) ? ' checked="checked"':'';
277 277
 
278
-		    // If this is an "Other" option, get the HTML for it
278
+			// If this is an "Other" option, get the HTML for it
279 279
 			if ( self::is_other_opt( $opt_key ) ) {
280 280
 				if ( FrmAppHelper::pro_is_installed() ) {
281 281
 					require( FrmProAppHelper::plugin_path() . '/classes/views/frmpro-fields/other-option.php' );
282 282
 				}
283
-		    } else {
283
+			} else {
284 284
 				require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
285
-		    }
285
+			}
286 286
 
287 287
 			unset( $checked, $other_val );
288 288
 		}
289
-    }
289
+	}
290 290
 
291 291
 	public static function get_value_from_array( $opt, $opt_key, $field ) {
292 292
 		$opt = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
@@ -299,47 +299,47 @@  discard block
 block discarded – undo
299 299
 	}
300 300
 
301 301
 	public static function get_term_link( $tax_id ) {
302
-        $tax = get_taxonomy($tax_id);
303
-        if ( ! $tax ) {
304
-            return;
305
-        }
302
+		$tax = get_taxonomy($tax_id);
303
+		if ( ! $tax ) {
304
+			return;
305
+		}
306 306
 
307
-        $link = sprintf(
308
-            __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
307
+		$link = sprintf(
308
+			__( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
309 309
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
310
-        );
311
-        unset($tax);
310
+		);
311
+		unset($tax);
312 312
 
313
-        return $link;
314
-    }
313
+		return $link;
314
+	}
315 315
 
316 316
 	public static function value_meets_condition( $observed_value, $cond, $hide_opt ) {
317 317
 		$hide_opt = self::get_value_for_comparision( $hide_opt );
318 318
 		$observed_value = self::get_value_for_comparision( $observed_value );
319 319
 
320
-        if ( is_array($observed_value) ) {
321
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
322
-        }
323
-
324
-        $m = false;
325
-        if ( $cond == '==' ) {
326
-            $m = $observed_value == $hide_opt;
327
-        } else if ( $cond == '!=' ) {
328
-            $m = $observed_value != $hide_opt;
329
-        } else if ( $cond == '>' ) {
330
-            $m = $observed_value > $hide_opt;
331
-        } else if ( $cond == '<' ) {
332
-            $m = $observed_value < $hide_opt;
333
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
334
-            $m = stripos($observed_value, $hide_opt);
335
-            if ( $cond == 'not LIKE' ) {
336
-                $m = ( $m === false ) ? true : false;
337
-            } else {
338
-                $m = ( $m === false ) ? false : true;
339
-            }
340
-        }
341
-        return $m;
342
-    }
320
+		if ( is_array($observed_value) ) {
321
+			return self::array_value_condition($observed_value, $cond, $hide_opt);
322
+		}
323
+
324
+		$m = false;
325
+		if ( $cond == '==' ) {
326
+			$m = $observed_value == $hide_opt;
327
+		} else if ( $cond == '!=' ) {
328
+			$m = $observed_value != $hide_opt;
329
+		} else if ( $cond == '>' ) {
330
+			$m = $observed_value > $hide_opt;
331
+		} else if ( $cond == '<' ) {
332
+			$m = $observed_value < $hide_opt;
333
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
334
+			$m = stripos($observed_value, $hide_opt);
335
+			if ( $cond == 'not LIKE' ) {
336
+				$m = ( $m === false ) ? true : false;
337
+			} else {
338
+				$m = ( $m === false ) ? false : true;
339
+			}
340
+		}
341
+		return $m;
342
+	}
343 343
 
344 344
 	/**
345 345
 	 * Trim and sanitize the values
@@ -355,174 +355,174 @@  discard block
 block discarded – undo
355 355
 	}
356 356
 
357 357
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
358
-        $m = false;
359
-        if ( $cond == '==' ) {
360
-            if ( is_array($hide_opt) ) {
361
-                $m = array_intersect($hide_opt, $observed_value);
362
-                $m = empty($m) ? false : true;
363
-            } else {
364
-                $m = in_array($hide_opt, $observed_value);
365
-            }
366
-        } else if ( $cond == '!=' ) {
367
-            $m = ! in_array($hide_opt, $observed_value);
368
-        } else if ( $cond == '>' ) {
369
-            $min = min($observed_value);
370
-            $m = $min > $hide_opt;
371
-        } else if ( $cond == '<' ) {
372
-            $max = max($observed_value);
373
-            $m = $max < $hide_opt;
374
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
375
-            foreach ( $observed_value as $ob ) {
376
-                $m = strpos($ob, $hide_opt);
377
-                if ( $m !== false ) {
378
-                    $m = true;
379
-                    break;
380
-                }
381
-            }
382
-
383
-            if ( $cond == 'not LIKE' ) {
384
-                $m = ( $m === false ) ? true : false;
385
-            }
386
-        }
387
-
388
-        return $m;
389
-    }
390
-
391
-    /**
392
-     * Replace a few basic shortcodes and field ids
393
-     * @since 2.0
394
-     * @return string
395
-     */
358
+		$m = false;
359
+		if ( $cond == '==' ) {
360
+			if ( is_array($hide_opt) ) {
361
+				$m = array_intersect($hide_opt, $observed_value);
362
+				$m = empty($m) ? false : true;
363
+			} else {
364
+				$m = in_array($hide_opt, $observed_value);
365
+			}
366
+		} else if ( $cond == '!=' ) {
367
+			$m = ! in_array($hide_opt, $observed_value);
368
+		} else if ( $cond == '>' ) {
369
+			$min = min($observed_value);
370
+			$m = $min > $hide_opt;
371
+		} else if ( $cond == '<' ) {
372
+			$max = max($observed_value);
373
+			$m = $max < $hide_opt;
374
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
375
+			foreach ( $observed_value as $ob ) {
376
+				$m = strpos($ob, $hide_opt);
377
+				if ( $m !== false ) {
378
+					$m = true;
379
+					break;
380
+				}
381
+			}
382
+
383
+			if ( $cond == 'not LIKE' ) {
384
+				$m = ( $m === false ) ? true : false;
385
+			}
386
+		}
387
+
388
+		return $m;
389
+	}
390
+
391
+	/**
392
+	 * Replace a few basic shortcodes and field ids
393
+	 * @since 2.0
394
+	 * @return string
395
+	 */
396 396
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
397
-        if ( strpos($value, '[sitename]') !== false ) {
398
-            $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
399
-            $value = str_replace('[sitename]', $new_value, $value);
400
-        }
397
+		if ( strpos($value, '[sitename]') !== false ) {
398
+			$new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
399
+			$value = str_replace('[sitename]', $new_value, $value);
400
+		}
401 401
 
402
-        $value = apply_filters('frm_content', $value, $form, $entry);
403
-        $value = do_shortcode($value);
402
+		$value = apply_filters('frm_content', $value, $form, $entry);
403
+		$value = do_shortcode($value);
404 404
 
405
-        return $value;
406
-    }
405
+		return $value;
406
+	}
407 407
 
408 408
 	public static function get_shortcodes( $content, $form_id ) {
409
-        if ( FrmAppHelper::pro_is_installed() ) {
410
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
411
-        }
409
+		if ( FrmAppHelper::pro_is_installed() ) {
410
+			return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
411
+		}
412 412
 
413
-        $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
413
+		$fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
414 414
 
415
-        $tagregexp = self::allowed_shortcodes($fields);
415
+		$tagregexp = self::allowed_shortcodes($fields);
416 416
 
417
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
417
+		preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
418 418
 
419
-        return $matches;
420
-    }
419
+		return $matches;
420
+	}
421 421
 
422 422
 	public static function allowed_shortcodes( $fields = array() ) {
423
-        $tagregexp = array(
424
-            'editlink', 'id', 'key', 'ip',
425
-            'siteurl', 'sitename', 'admin_email',
426
-            'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
423
+		$tagregexp = array(
424
+			'editlink', 'id', 'key', 'ip',
425
+			'siteurl', 'sitename', 'admin_email',
426
+			'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
427 427
 			'parent[-|_]id',
428
-        );
428
+		);
429 429
 
430
-        foreach ( $fields as $field ) {
431
-            $tagregexp[] = $field->id;
432
-            $tagregexp[] = $field->field_key;
433
-        }
430
+		foreach ( $fields as $field ) {
431
+			$tagregexp[] = $field->id;
432
+			$tagregexp[] = $field->field_key;
433
+		}
434 434
 
435
-        $tagregexp = implode('|', $tagregexp);
436
-        return $tagregexp;
437
-    }
435
+		$tagregexp = implode('|', $tagregexp);
436
+		return $tagregexp;
437
+	}
438 438
 
439 439
 	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
440
-        $shortcode_values = array(
441
-           'id'     => $entry->id,
442
-           'key'    => $entry->item_key,
443
-           'ip'     => $entry->ip,
444
-        );
440
+		$shortcode_values = array(
441
+		   'id'     => $entry->id,
442
+		   'key'    => $entry->item_key,
443
+		   'ip'     => $entry->ip,
444
+		);
445 445
 
446
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
446
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
447 447
 			if ( empty( $tag ) ) {
448 448
 				continue;
449 449
 			}
450 450
 
451
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
451
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
452 452
 
453
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
453
+			if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
454 454
 				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
455
-                $tags = explode(' ', $tag);
456
-                if ( is_array($tags) ) {
457
-                    $tag = $tags[0];
458
-                }
459
-            } else {
460
-                $tag = $shortcodes[2][ $short_key ];
461
-            }
462
-
463
-            switch ( $tag ) {
464
-                case 'id':
465
-                case 'key':
466
-                case 'ip':
467
-                    $replace_with = $shortcode_values[ $tag ];
468
-                break;
469
-
470
-                case 'user_agent':
471
-                case 'user-agent':
472
-                    $entry->description = maybe_unserialize($entry->description);
455
+				$tags = explode(' ', $tag);
456
+				if ( is_array($tags) ) {
457
+					$tag = $tags[0];
458
+				}
459
+			} else {
460
+				$tag = $shortcodes[2][ $short_key ];
461
+			}
462
+
463
+			switch ( $tag ) {
464
+				case 'id':
465
+				case 'key':
466
+				case 'ip':
467
+					$replace_with = $shortcode_values[ $tag ];
468
+				break;
469
+
470
+				case 'user_agent':
471
+				case 'user-agent':
472
+					$entry->description = maybe_unserialize($entry->description);
473 473
 					$replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] );
474
-                break;
475
-
476
-                case 'created_at':
477
-                case 'created-at':
478
-                case 'updated_at':
479
-                case 'updated-at':
480
-                    if ( isset($atts['format']) ) {
481
-                        $time_format = ' ';
482
-                    } else {
483
-                        $atts['format'] = get_option('date_format');
484
-                        $time_format = '';
485
-                    }
486
-
487
-                    $this_tag = str_replace('-', '_', $tag);
488
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
489
-                    unset($this_tag);
490
-                break;
491
-
492
-                case 'created_by':
493
-                case 'created-by':
494
-                case 'updated_by':
495
-                case 'updated-by':
496
-                    $this_tag = str_replace('-', '_', $tag);
474
+				break;
475
+
476
+				case 'created_at':
477
+				case 'created-at':
478
+				case 'updated_at':
479
+				case 'updated-at':
480
+					if ( isset($atts['format']) ) {
481
+						$time_format = ' ';
482
+					} else {
483
+						$atts['format'] = get_option('date_format');
484
+						$time_format = '';
485
+					}
486
+
487
+					$this_tag = str_replace('-', '_', $tag);
488
+					$replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
489
+					unset($this_tag);
490
+				break;
491
+
492
+				case 'created_by':
493
+				case 'created-by':
494
+				case 'updated_by':
495
+				case 'updated-by':
496
+					$this_tag = str_replace('-', '_', $tag);
497 497
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
498
-                    unset($this_tag);
499
-                break;
500
-
501
-                case 'admin_email':
502
-                case 'siteurl':
503
-                case 'frmurl':
504
-                case 'sitename':
505
-                case 'get':
506
-                    $replace_with = self::dynamic_default_values( $tag, $atts );
507
-                break;
508
-
509
-                default:
510
-                    $field = FrmField::getOne( $tag );
511
-                    if ( ! $field ) {
512
-                        break;
513
-                    }
514
-
515
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
516
-
517
-                    $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
518
-
519
-                    $atts['entry_id'] = $entry->id;
520
-                    $atts['entry_key'] = $entry->item_key;
521
-
522
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
523
-                        $replace_with = $field->name;
524
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
525
-                        $replace_with = $field->description;
498
+					unset($this_tag);
499
+				break;
500
+
501
+				case 'admin_email':
502
+				case 'siteurl':
503
+				case 'frmurl':
504
+				case 'sitename':
505
+				case 'get':
506
+					$replace_with = self::dynamic_default_values( $tag, $atts );
507
+				break;
508
+
509
+				default:
510
+					$field = FrmField::getOne( $tag );
511
+					if ( ! $field ) {
512
+						break;
513
+					}
514
+
515
+					$sep = isset($atts['sep']) ? $atts['sep'] : ', ';
516
+
517
+					$replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
518
+
519
+					$atts['entry_id'] = $entry->id;
520
+					$atts['entry_key'] = $entry->item_key;
521
+
522
+					if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
523
+						$replace_with = $field->name;
524
+					} else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
525
+						$replace_with = $field->description;
526 526
 					} else {
527 527
 						$string_value = $replace_with;
528 528
 						if ( is_array( $replace_with ) ) {
@@ -536,82 +536,82 @@  discard block
 block discarded – undo
536 536
 						}
537 537
 					}
538 538
 
539
-                    unset($field);
540
-                break;
541
-            }
539
+					unset($field);
540
+				break;
541
+			}
542 542
 
543
-            if ( isset($replace_with) ) {
544
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
545
-            }
543
+			if ( isset($replace_with) ) {
544
+				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
545
+			}
546 546
 
547
-            unset($atts, $conditional, $replace_with);
547
+			unset($atts, $conditional, $replace_with);
548 548
 		}
549 549
 
550 550
 		return $content;
551
-    }
552
-
553
-    /**
554
-     * Get the value to replace a few standard shortcodes
555
-     *
556
-     * @since 2.0
557
-     * @return string
558
-     */
559
-    public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
560
-        $new_value = '';
561
-        switch ( $tag ) {
562
-            case 'admin_email':
563
-                $new_value = get_option('admin_email');
564
-                break;
565
-            case 'siteurl':
566
-                $new_value = FrmAppHelper::site_url();
567
-                break;
568
-            case 'frmurl':
569
-                $new_value = FrmAppHelper::plugin_url();
570
-                break;
571
-            case 'sitename':
572
-                $new_value = FrmAppHelper::site_name();
573
-                break;
574
-            case 'get':
575
-                $new_value = self::process_get_shortcode( $atts, $return_array );
576
-                break;
577
-        }
578
-
579
-        return $new_value;
580
-    }
581
-
582
-    /**
583
-     * Process the [get] shortcode
584
-     *
585
-     * @since 2.0
586
-     * @return string|array
587
-     */
588
-    public static function process_get_shortcode( $atts, $return_array = false ) {
589
-        if ( ! isset($atts['param']) ) {
590
-            return '';
591
-        }
592
-
593
-        if ( strpos($atts['param'], '&#91;') ) {
594
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
595
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
596
-        }
597
-
598
-        $new_value = FrmAppHelper::get_param($atts['param'], '');
599
-        $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
600
-
601
-        if ( $new_value == '' ) {
602
-            if ( ! isset($atts['prev_val']) ) {
603
-                $atts['prev_val'] = '';
604
-            }
605
-
606
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
607
-        }
608
-
609
-        if ( is_array($new_value) && ! $return_array ) {
610
-            $new_value = implode(', ', $new_value);
611
-        }
612
-
613
-        return $new_value;
614
-    }
551
+	}
552
+
553
+	/**
554
+	 * Get the value to replace a few standard shortcodes
555
+	 *
556
+	 * @since 2.0
557
+	 * @return string
558
+	 */
559
+	public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
560
+		$new_value = '';
561
+		switch ( $tag ) {
562
+			case 'admin_email':
563
+				$new_value = get_option('admin_email');
564
+				break;
565
+			case 'siteurl':
566
+				$new_value = FrmAppHelper::site_url();
567
+				break;
568
+			case 'frmurl':
569
+				$new_value = FrmAppHelper::plugin_url();
570
+				break;
571
+			case 'sitename':
572
+				$new_value = FrmAppHelper::site_name();
573
+				break;
574
+			case 'get':
575
+				$new_value = self::process_get_shortcode( $atts, $return_array );
576
+				break;
577
+		}
578
+
579
+		return $new_value;
580
+	}
581
+
582
+	/**
583
+	 * Process the [get] shortcode
584
+	 *
585
+	 * @since 2.0
586
+	 * @return string|array
587
+	 */
588
+	public static function process_get_shortcode( $atts, $return_array = false ) {
589
+		if ( ! isset($atts['param']) ) {
590
+			return '';
591
+		}
592
+
593
+		if ( strpos($atts['param'], '&#91;') ) {
594
+			$atts['param'] = str_replace('&#91;', '[', $atts['param']);
595
+			$atts['param'] = str_replace('&#93;', ']', $atts['param']);
596
+		}
597
+
598
+		$new_value = FrmAppHelper::get_param($atts['param'], '');
599
+		$new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
600
+
601
+		if ( $new_value == '' ) {
602
+			if ( ! isset($atts['prev_val']) ) {
603
+				$atts['prev_val'] = '';
604
+			}
605
+
606
+			$new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
607
+		}
608
+
609
+		if ( is_array($new_value) && ! $return_array ) {
610
+			$new_value = implode(', ', $new_value);
611
+		}
612
+
613
+		return $new_value;
614
+	}
615 615
 
616 616
 	public static function get_display_value( $value, $field, $atts = array() ) {
617 617
 
@@ -671,37 +671,37 @@  discard block
 block discarded – undo
671 671
 	}
672 672
 
673 673
 	public static function get_field_types( $type ) {
674
-        $single_input = array(
675
-            'text', 'textarea', 'rte', 'number', 'email', 'url',
676
-            'image', 'file', 'date', 'phone', 'hidden', 'time',
677
-            'user_id', 'tag', 'password',
678
-        );
674
+		$single_input = array(
675
+			'text', 'textarea', 'rte', 'number', 'email', 'url',
676
+			'image', 'file', 'date', 'phone', 'hidden', 'time',
677
+			'user_id', 'tag', 'password',
678
+		);
679 679
 		$multiple_input = array( 'radio', 'checkbox', 'select', 'scale', 'lookup' );
680 680
 		$other_type = array( 'html', 'break' );
681 681
 
682 682
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
683 683
 
684
-        $field_types = array();
685
-        if ( in_array($type, $single_input) ) {
686
-            self::field_types_for_input( $single_input, $field_selection, $field_types );
687
-        } else if ( in_array($type, $multiple_input) ) {
688
-            self::field_types_for_input( $multiple_input, $field_selection, $field_types );
689
-        } else if ( in_array($type, $other_type) ) {
690
-            self::field_types_for_input( $other_type, $field_selection, $field_types );
684
+		$field_types = array();
685
+		if ( in_array($type, $single_input) ) {
686
+			self::field_types_for_input( $single_input, $field_selection, $field_types );
687
+		} else if ( in_array($type, $multiple_input) ) {
688
+			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
689
+		} else if ( in_array($type, $other_type) ) {
690
+			self::field_types_for_input( $other_type, $field_selection, $field_types );
691 691
 		} else if ( isset( $field_selection[ $type ] ) ) {
692
-            $field_types[ $type ] = $field_selection[ $type ];
693
-        }
692
+			$field_types[ $type ] = $field_selection[ $type ];
693
+		}
694 694
 
695 695
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
696
-        return $field_types;
697
-    }
696
+		return $field_types;
697
+	}
698 698
 
699
-    private static function field_types_for_input( $inputs, $fields, &$field_types ) {
700
-        foreach ( $inputs as $input ) {
701
-            $field_types[ $input ] = $fields[ $input ];
702
-            unset($input);
703
-        }
704
-    }
699
+	private static function field_types_for_input( $inputs, $fields, &$field_types ) {
700
+		foreach ( $inputs as $input ) {
701
+			$field_types[ $input ] = $fields[ $input ];
702
+			unset($input);
703
+		}
704
+	}
705 705
 
706 706
 	/**
707 707
 	 * Check if current field option is an "other" option
@@ -715,14 +715,14 @@  discard block
 block discarded – undo
715 715
 		return $opt_key && strpos( $opt_key, 'other_' ) === 0;
716 716
 	}
717 717
 
718
-    /**
719
-    * Get value that belongs in "Other" text box
720
-    *
721
-    * @since 2.0.6
722
-    *
723
-    * @param array $args
724
-    */
725
-    public static function get_other_val( $args ) {
718
+	/**
719
+	 * Get value that belongs in "Other" text box
720
+	 *
721
+	 * @since 2.0.6
722
+	 *
723
+	 * @param array $args
724
+	 */
725
+	public static function get_other_val( $args ) {
726 726
 		$defaults = array(
727 727
 			'opt_key' => 0, 'field' => array(),
728 728
 			'parent' => false, 'pointer' => false,
@@ -798,20 +798,20 @@  discard block
 block discarded – undo
798 798
 		}
799 799
 
800 800
 		return $other_val;
801
-    }
802
-
803
-    /**
804
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
805
-    * Intended for front-end use
806
-    *
807
-    * @since 2.0.6
808
-    *
809
-    * @param array $args should include field, opt_key and field name
810
-    * @param boolean $other_opt
811
-    * @param string $checked
812
-    * @return string $other_val
813
-    */
814
-    public static function prepare_other_input( $args, &$other_opt, &$checked ) {
801
+	}
802
+
803
+	/**
804
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
805
+	 * Intended for front-end use
806
+	 *
807
+	 * @since 2.0.6
808
+	 *
809
+	 * @param array $args should include field, opt_key and field name
810
+	 * @param boolean $other_opt
811
+	 * @param string $checked
812
+	 * @return string $other_val
813
+	 */
814
+	public static function prepare_other_input( $args, &$other_opt, &$checked ) {
815 815
 		//Check if this is an "Other" option
816 816
 		if ( ! self::is_other_opt( $args['opt_key'] ) ) {
817 817
 			return;
@@ -827,8 +827,8 @@  discard block
 block discarded – undo
827 827
 			$checked = 'checked="checked" ';
828 828
 		}
829 829
 
830
-        return $other_args;
831
-    }
830
+		return $other_args;
831
+	}
832 832
 
833 833
 	/**
834 834
 	 * @param array $args
@@ -878,8 +878,8 @@  discard block
 block discarded – undo
878 878
 	 * @since 2.0.6
879 879
 	 */
880 880
 	public static function include_other_input( $args ) {
881
-        if ( ! $args['other_opt'] ) {
882
-        	return;
881
+		if ( ! $args['other_opt'] ) {
882
+			return;
883 883
 		}
884 884
 
885 885
 		$classes = array( 'frm_other_input' );
@@ -900,15 +900,15 @@  discard block
 block discarded – undo
900 900
 	}
901 901
 
902 902
 	/**
903
-	* Get the HTML id for an "Other" text field
904
-	* Note: This does not affect fields in repeating sections
905
-	*
906
-	* @since 2.0.08
907
-	* @param string $type - field type
908
-	* @param string $html_id
909
-	* @param string|boolean $opt_key
910
-	* @return string $other_id
911
-	*/
903
+	 * Get the HTML id for an "Other" text field
904
+	 * Note: This does not affect fields in repeating sections
905
+	 *
906
+	 * @since 2.0.08
907
+	 * @param string $type - field type
908
+	 * @param string $html_id
909
+	 * @param string|boolean $opt_key
910
+	 * @return string $other_id
911
+	 */
912 912
 	public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) {
913 913
 		$other_id = $html_id;
914 914
 
@@ -966,10 +966,10 @@  discard block
 block discarded – undo
966 966
 	}
967 967
 
968 968
 	public static function switch_field_ids( $val ) {
969
-        global $frm_duplicate_ids;
970
-        $replace = array();
971
-        $replace_with = array();
972
-        foreach ( (array) $frm_duplicate_ids as $old => $new ) {
969
+		global $frm_duplicate_ids;
970
+		$replace = array();
971
+		$replace_with = array();
972
+		foreach ( (array) $frm_duplicate_ids as $old => $new ) {
973 973
 			$replace[] = '[if ' . $old . ']';
974 974
 			$replace_with[] = '[if ' . $new . ']';
975 975
 			$replace[] = '[if ' . $old . ' ';
@@ -984,153 +984,153 @@  discard block
 block discarded – undo
984 984
 			$replace_with[] = '[' . $new . ']';
985 985
 			$replace[] = '[' . $old . ' ';
986 986
 			$replace_with[] = '[' . $new . ' ';
987
-            unset($old, $new);
988
-        }
987
+			unset($old, $new);
988
+		}
989 989
 		if ( is_array( $val ) ) {
990 990
 			foreach ( $val as $k => $v ) {
991
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
992
-                unset($k, $v);
993
-            }
994
-        } else {
995
-            $val = str_replace($replace, $replace_with, $val);
996
-        }
997
-
998
-        return $val;
999
-    }
1000
-
1001
-    public static function get_us_states() {
1002
-        return apply_filters( 'frm_us_states', array(
1003
-            'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1004
-            'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1005
-            'DC' => 'District of Columbia',
1006
-            'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1007
-            'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1008
-            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1009
-            'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1010
-            'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1011
-            'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1012
-            'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1013
-            'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1014
-            'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1015
-            'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1016
-            'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1017
-        ) );
1018
-    }
1019
-
1020
-    public static function get_countries() {
1021
-        return apply_filters( 'frm_countries', array(
1022
-            __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1023
-            __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1024
-            __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1025
-            __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1026
-            __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1027
-            __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1028
-            __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1029
-            __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1030
-            __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1031
-            __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1032
-            __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1033
-            __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1034
-            __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1035
-            __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1036
-            __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1037
-            __( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1038
-            __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1039
-            __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1040
-            __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1041
-            __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1042
-            __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1043
-            __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1044
-            __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1045
-            __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1046
-            __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1047
-            __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1048
-            __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1049
-            __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1050
-            __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1051
-            __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1052
-            __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1053
-            __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1054
-            __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1055
-            __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1056
-            __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1057
-            __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1058
-            __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1059
-            __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1060
-            __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1061
-            __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1062
-            __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1063
-            __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1064
-            __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1065
-            __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1066
-            __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1067
-            __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1068
-            __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1069
-            __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1070
-            __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1071
-            __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1072
-            __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1073
-            __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1074
-            __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1075
-            __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1076
-            __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1077
-            __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1078
-            __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1079
-            __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1080
-            __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1081
-            __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1082
-            __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1083
-            __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1084
-            __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1085
-            __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1086
-            __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1087
-            __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1088
-            __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1089
-            __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1090
-            __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1091
-            __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1092
-            __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1093
-            __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1094
-            __( 'Zimbabwe', 'formidable' ),
1095
-        ) );
1096
-    }
991
+				$val[ $k ] = str_replace( $replace, $replace_with, $v );
992
+				unset($k, $v);
993
+			}
994
+		} else {
995
+			$val = str_replace($replace, $replace_with, $val);
996
+		}
997
+
998
+		return $val;
999
+	}
1000
+
1001
+	public static function get_us_states() {
1002
+		return apply_filters( 'frm_us_states', array(
1003
+			'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1004
+			'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1005
+			'DC' => 'District of Columbia',
1006
+			'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1007
+			'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1008
+			'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1009
+			'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1010
+			'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1011
+			'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1012
+			'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1013
+			'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1014
+			'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1015
+			'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1016
+			'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1017
+		) );
1018
+	}
1019
+
1020
+	public static function get_countries() {
1021
+		return apply_filters( 'frm_countries', array(
1022
+			__( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1023
+			__( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1024
+			__( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1025
+			__( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1026
+			__( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1027
+			__( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1028
+			__( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1029
+			__( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1030
+			__( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1031
+			__( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1032
+			__( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1033
+			__( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1034
+			__( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1035
+			__( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1036
+			__( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1037
+			__( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1038
+			__( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1039
+			__( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1040
+			__( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1041
+			__( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1042
+			__( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1043
+			__( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1044
+			__( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1045
+			__( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1046
+			__( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1047
+			__( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1048
+			__( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1049
+			__( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1050
+			__( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1051
+			__( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1052
+			__( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1053
+			__( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1054
+			__( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1055
+			__( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1056
+			__( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1057
+			__( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1058
+			__( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1059
+			__( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1060
+			__( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1061
+			__( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1062
+			__( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1063
+			__( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1064
+			__( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1065
+			__( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1066
+			__( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1067
+			__( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1068
+			__( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1069
+			__( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1070
+			__( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1071
+			__( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1072
+			__( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1073
+			__( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1074
+			__( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1075
+			__( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1076
+			__( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1077
+			__( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1078
+			__( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1079
+			__( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1080
+			__( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1081
+			__( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1082
+			__( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1083
+			__( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1084
+			__( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1085
+			__( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1086
+			__( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1087
+			__( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1088
+			__( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1089
+			__( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1090
+			__( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1091
+			__( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1092
+			__( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1093
+			__( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1094
+			__( 'Zimbabwe', 'formidable' ),
1095
+		) );
1096
+	}
1097 1097
 
1098 1098
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1099 1099
 		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1100 1100
 
1101
-        $states = FrmFieldsHelper::get_us_states();
1102
-        $state_abv = array_keys($states);
1103
-        sort($state_abv);
1101
+		$states = FrmFieldsHelper::get_us_states();
1102
+		$state_abv = array_keys($states);
1103
+		sort($state_abv);
1104 1104
 		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1105 1105
 
1106
-        $states = array_values($states);
1107
-        sort($states);
1106
+		$states = array_values($states);
1107
+		sort($states);
1108 1108
 		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1109
-        unset($state_abv, $states);
1109
+		unset($state_abv, $states);
1110 1110
 
1111 1111
 		$prepop[ __( 'Age', 'formidable' ) ] = array(
1112
-            __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1113
-            __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1114
-            __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1115
-        );
1112
+			__( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1113
+			__( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1114
+			__( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1115
+		);
1116 1116
 
1117 1117
 		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1118
-            __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1119
-            __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1120
-        );
1118
+			__( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1119
+			__( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1120
+		);
1121 1121
 
1122 1122
 		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1123
-            __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1124
-            __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1125
-        );
1123
+			__( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1124
+			__( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1125
+		);
1126 1126
 
1127 1127
 		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1128
-            __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1129
-            __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1130
-        );
1128
+			__( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1129
+			__( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1130
+		);
1131 1131
 
1132 1132
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1133
-    }
1133
+	}
1134 1134
 
1135 1135
 	/**
1136 1136
 	 * Display a field value selector
@@ -1140,10 +1140,10 @@  discard block
 block discarded – undo
1140 1140
 	 * @param int $selector_field_id
1141 1141
 	 * @param array $selector_args
1142 1142
 	 */
1143
-    public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1144
-	    $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1145
-	    $field_value_selector->display();
1146
-    }
1143
+	public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1144
+		$field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1145
+		$field_value_selector->display();
1146
+	}
1147 1147
 
1148 1148
 	/**
1149 1149
 	 * Convert a field object to a flat array
Please login to merge, or discard this patch.