@@ -117,6 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | /** |
119 | 119 | * @since 3.0 |
120 | + * @return string |
|
120 | 121 | */ |
121 | 122 | public static function get_default_field( $type ) { |
122 | 123 | $field_type = FrmFieldFactory::get_field_type( $type ); |
@@ -138,6 +139,7 @@ discard block |
||
138 | 139 | |
139 | 140 | /** |
140 | 141 | * @since 2.0 |
142 | + * @param string $error |
|
141 | 143 | */ |
142 | 144 | public static function get_error_msg( $field, $error ) { |
143 | 145 | $frm_settings = FrmAppHelper::get_settings(); |
@@ -284,6 +286,7 @@ discard block |
||
284 | 286 | * replace [entry_key] |
285 | 287 | * |
286 | 288 | * @since 3.0 |
289 | + * @param string $html |
|
287 | 290 | */ |
288 | 291 | private static function replace_entry_key( &$html ) { |
289 | 292 | $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' ); |
@@ -323,6 +326,7 @@ discard block |
||
323 | 326 | |
324 | 327 | /** |
325 | 328 | * @since 3.0 |
329 | + * @param string $html |
|
326 | 330 | */ |
327 | 331 | private static function filter_for_more_shortcodes( $args, $field, &$html) { |
328 | 332 | //If field is not in repeating section |
@@ -477,6 +481,10 @@ discard block |
||
477 | 481 | return $classes; |
478 | 482 | } |
479 | 483 | |
484 | + /** |
|
485 | + * @param boolean $no_vars |
|
486 | + * @param string $code |
|
487 | + */ |
|
480 | 488 | public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) { |
481 | 489 | if ( $no_vars ) { |
482 | 490 | $html = str_replace( '[if ' . $code . ']', '', $html ); |
@@ -977,6 +985,9 @@ discard block |
||
977 | 985 | return $field_types; |
978 | 986 | } |
979 | 987 | |
988 | + /** |
|
989 | + * @param string[] $inputs |
|
990 | + */ |
|
980 | 991 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
981 | 992 | foreach ( $inputs as $input ) { |
982 | 993 | $field_types[ $input ] = $fields[ $input ]; |
@@ -7,9 +7,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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(); |
@@ -477,21 +477,21 @@ discard block |
||
477 | 477 | return $classes; |
478 | 478 | } |
479 | 479 | |
480 | - public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) { |
|
481 | - if ( $no_vars ) { |
|
480 | + public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) { |
|
481 | + if ( $no_vars ) { |
|
482 | 482 | $html = str_replace( '[if ' . $code . ']', '', $html ); |
483 | 483 | $html = str_replace( '[/if ' . $code . ']', '', $html ); |
484 | - } else { |
|
484 | + } else { |
|
485 | 485 | $html = preg_replace( '/(\[if\s+' . $code . '\])(.*?)(\[\/if\s+' . $code . '\])/mis', '', $html ); |
486 | - } |
|
486 | + } |
|
487 | 487 | |
488 | 488 | $html = str_replace( '[' . $code . ']', $replace_with, $html ); |
489 | - } |
|
489 | + } |
|
490 | 490 | |
491 | 491 | public static function get_shortcode_tag( $shortcodes, $short_key, $args ) { |
492 | 492 | _deprecated_function( __FUNCTION__, '3.0', 'FrmShortcodesHelper::get_shortcode_tag' ); |
493 | - return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args ); |
|
494 | - } |
|
493 | + return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args ); |
|
494 | + } |
|
495 | 495 | |
496 | 496 | /** |
497 | 497 | * Remove [collapse_this] if it's still included after all processing |
@@ -513,37 +513,37 @@ discard block |
||
513 | 513 | |
514 | 514 | public static function display_recaptcha( $field ) { |
515 | 515 | _deprecated_function( __FUNCTION__, '3.0', 'FrmFieldCaptcha::field_input' ); |
516 | - } |
|
516 | + } |
|
517 | 517 | |
518 | 518 | public static function show_single_option( $field ) { |
519 | 519 | if ( ! is_array( $field['options'] ) ) { |
520 | 520 | return; |
521 | 521 | } |
522 | 522 | |
523 | - $field_name = $field['name']; |
|
524 | - $html_id = self::get_html_id($field); |
|
523 | + $field_name = $field['name']; |
|
524 | + $html_id = self::get_html_id($field); |
|
525 | 525 | |
526 | 526 | foreach ( $field['options'] as $opt_key => $opt ) { |
527 | - $field_val = self::get_value_from_array( $opt, $opt_key, $field ); |
|
528 | - $opt = self::get_label_from_array( $opt, $opt_key, $field ); |
|
527 | + $field_val = self::get_value_from_array( $opt, $opt_key, $field ); |
|
528 | + $opt = self::get_label_from_array( $opt, $opt_key, $field ); |
|
529 | 529 | |
530 | 530 | // Get string for Other text field, if needed |
531 | 531 | $other_val = self::get_other_val( compact( 'opt_key', 'field' ) ); |
532 | 532 | |
533 | 533 | $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"':''; |
534 | 534 | |
535 | - // If this is an "Other" option, get the HTML for it |
|
535 | + // If this is an "Other" option, get the HTML for it |
|
536 | 536 | if ( self::is_other_opt( $opt_key ) ) { |
537 | 537 | if ( FrmAppHelper::pro_is_installed() ) { |
538 | 538 | require( FrmProAppHelper::plugin_path() . '/classes/views/frmpro-fields/other-option.php' ); |
539 | 539 | } |
540 | - } else { |
|
540 | + } else { |
|
541 | 541 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' ); |
542 | - } |
|
542 | + } |
|
543 | 543 | |
544 | 544 | unset( $checked, $other_val ); |
545 | 545 | } |
546 | - } |
|
546 | + } |
|
547 | 547 | |
548 | 548 | public static function get_value_from_array( $opt, $opt_key, $field ) { |
549 | 549 | $opt = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
@@ -556,47 +556,47 @@ discard block |
||
556 | 556 | } |
557 | 557 | |
558 | 558 | public static function get_term_link( $tax_id ) { |
559 | - $tax = get_taxonomy($tax_id); |
|
560 | - if ( ! $tax ) { |
|
561 | - return; |
|
562 | - } |
|
559 | + $tax = get_taxonomy($tax_id); |
|
560 | + if ( ! $tax ) { |
|
561 | + return; |
|
562 | + } |
|
563 | 563 | |
564 | - $link = sprintf( |
|
565 | - __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
|
564 | + $link = sprintf( |
|
565 | + __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
|
566 | 566 | '<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>' |
567 | - ); |
|
568 | - unset($tax); |
|
567 | + ); |
|
568 | + unset($tax); |
|
569 | 569 | |
570 | - return $link; |
|
571 | - } |
|
570 | + return $link; |
|
571 | + } |
|
572 | 572 | |
573 | 573 | public static function value_meets_condition( $observed_value, $cond, $hide_opt ) { |
574 | 574 | $hide_opt = self::get_value_for_comparision( $hide_opt ); |
575 | 575 | $observed_value = self::get_value_for_comparision( $observed_value ); |
576 | 576 | |
577 | - if ( is_array($observed_value) ) { |
|
578 | - return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
579 | - } |
|
580 | - |
|
581 | - $m = false; |
|
582 | - if ( $cond == '==' ) { |
|
583 | - $m = $observed_value == $hide_opt; |
|
584 | - } else if ( $cond == '!=' ) { |
|
585 | - $m = $observed_value != $hide_opt; |
|
586 | - } else if ( $cond == '>' ) { |
|
587 | - $m = $observed_value > $hide_opt; |
|
588 | - } else if ( $cond == '<' ) { |
|
589 | - $m = $observed_value < $hide_opt; |
|
590 | - } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
591 | - $m = stripos($observed_value, $hide_opt); |
|
592 | - if ( $cond == 'not LIKE' ) { |
|
593 | - $m = ( $m === false ) ? true : false; |
|
594 | - } else { |
|
595 | - $m = ( $m === false ) ? false : true; |
|
596 | - } |
|
597 | - } |
|
598 | - return $m; |
|
599 | - } |
|
577 | + if ( is_array($observed_value) ) { |
|
578 | + return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
579 | + } |
|
580 | + |
|
581 | + $m = false; |
|
582 | + if ( $cond == '==' ) { |
|
583 | + $m = $observed_value == $hide_opt; |
|
584 | + } else if ( $cond == '!=' ) { |
|
585 | + $m = $observed_value != $hide_opt; |
|
586 | + } else if ( $cond == '>' ) { |
|
587 | + $m = $observed_value > $hide_opt; |
|
588 | + } else if ( $cond == '<' ) { |
|
589 | + $m = $observed_value < $hide_opt; |
|
590 | + } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
591 | + $m = stripos($observed_value, $hide_opt); |
|
592 | + if ( $cond == 'not LIKE' ) { |
|
593 | + $m = ( $m === false ) ? true : false; |
|
594 | + } else { |
|
595 | + $m = ( $m === false ) ? false : true; |
|
596 | + } |
|
597 | + } |
|
598 | + return $m; |
|
599 | + } |
|
600 | 600 | |
601 | 601 | /** |
602 | 602 | * Trim and sanitize the values |
@@ -612,174 +612,174 @@ discard block |
||
612 | 612 | } |
613 | 613 | |
614 | 614 | public static function array_value_condition( $observed_value, $cond, $hide_opt ) { |
615 | - $m = false; |
|
616 | - if ( $cond == '==' ) { |
|
617 | - if ( is_array($hide_opt) ) { |
|
618 | - $m = array_intersect($hide_opt, $observed_value); |
|
619 | - $m = empty($m) ? false : true; |
|
620 | - } else { |
|
621 | - $m = in_array($hide_opt, $observed_value); |
|
622 | - } |
|
623 | - } else if ( $cond == '!=' ) { |
|
624 | - $m = ! in_array($hide_opt, $observed_value); |
|
625 | - } else if ( $cond == '>' ) { |
|
626 | - $min = min($observed_value); |
|
627 | - $m = $min > $hide_opt; |
|
628 | - } else if ( $cond == '<' ) { |
|
629 | - $max = max($observed_value); |
|
630 | - $m = $max < $hide_opt; |
|
631 | - } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
632 | - foreach ( $observed_value as $ob ) { |
|
633 | - $m = strpos($ob, $hide_opt); |
|
634 | - if ( $m !== false ) { |
|
635 | - $m = true; |
|
636 | - break; |
|
637 | - } |
|
638 | - } |
|
639 | - |
|
640 | - if ( $cond == 'not LIKE' ) { |
|
641 | - $m = ( $m === false ) ? true : false; |
|
642 | - } |
|
643 | - } |
|
644 | - |
|
645 | - return $m; |
|
646 | - } |
|
647 | - |
|
648 | - /** |
|
649 | - * Replace a few basic shortcodes and field ids |
|
650 | - * @since 2.0 |
|
651 | - * @return string |
|
652 | - */ |
|
615 | + $m = false; |
|
616 | + if ( $cond == '==' ) { |
|
617 | + if ( is_array($hide_opt) ) { |
|
618 | + $m = array_intersect($hide_opt, $observed_value); |
|
619 | + $m = empty($m) ? false : true; |
|
620 | + } else { |
|
621 | + $m = in_array($hide_opt, $observed_value); |
|
622 | + } |
|
623 | + } else if ( $cond == '!=' ) { |
|
624 | + $m = ! in_array($hide_opt, $observed_value); |
|
625 | + } else if ( $cond == '>' ) { |
|
626 | + $min = min($observed_value); |
|
627 | + $m = $min > $hide_opt; |
|
628 | + } else if ( $cond == '<' ) { |
|
629 | + $max = max($observed_value); |
|
630 | + $m = $max < $hide_opt; |
|
631 | + } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
632 | + foreach ( $observed_value as $ob ) { |
|
633 | + $m = strpos($ob, $hide_opt); |
|
634 | + if ( $m !== false ) { |
|
635 | + $m = true; |
|
636 | + break; |
|
637 | + } |
|
638 | + } |
|
639 | + |
|
640 | + if ( $cond == 'not LIKE' ) { |
|
641 | + $m = ( $m === false ) ? true : false; |
|
642 | + } |
|
643 | + } |
|
644 | + |
|
645 | + return $m; |
|
646 | + } |
|
647 | + |
|
648 | + /** |
|
649 | + * Replace a few basic shortcodes and field ids |
|
650 | + * @since 2.0 |
|
651 | + * @return string |
|
652 | + */ |
|
653 | 653 | public static function basic_replace_shortcodes( $value, $form, $entry ) { |
654 | - if ( strpos($value, '[sitename]') !== false ) { |
|
655 | - $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
|
656 | - $value = str_replace('[sitename]', $new_value, $value); |
|
657 | - } |
|
654 | + if ( strpos($value, '[sitename]') !== false ) { |
|
655 | + $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
|
656 | + $value = str_replace('[sitename]', $new_value, $value); |
|
657 | + } |
|
658 | 658 | |
659 | - $value = apply_filters('frm_content', $value, $form, $entry); |
|
660 | - $value = do_shortcode($value); |
|
659 | + $value = apply_filters('frm_content', $value, $form, $entry); |
|
660 | + $value = do_shortcode($value); |
|
661 | 661 | |
662 | - return $value; |
|
663 | - } |
|
662 | + return $value; |
|
663 | + } |
|
664 | 664 | |
665 | 665 | public static function get_shortcodes( $content, $form_id ) { |
666 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
667 | - return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
668 | - } |
|
666 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
667 | + return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
668 | + } |
|
669 | 669 | |
670 | - $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
|
670 | + $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
|
671 | 671 | |
672 | - $tagregexp = self::allowed_shortcodes($fields); |
|
672 | + $tagregexp = self::allowed_shortcodes($fields); |
|
673 | 673 | |
674 | - preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
674 | + preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
675 | 675 | |
676 | - return $matches; |
|
677 | - } |
|
676 | + return $matches; |
|
677 | + } |
|
678 | 678 | |
679 | 679 | public static function allowed_shortcodes( $fields = array() ) { |
680 | - $tagregexp = array( |
|
681 | - 'editlink', 'id', 'key', 'ip', |
|
682 | - 'siteurl', 'sitename', 'admin_email', |
|
683 | - 'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by', |
|
680 | + $tagregexp = array( |
|
681 | + 'editlink', 'id', 'key', 'ip', |
|
682 | + 'siteurl', 'sitename', 'admin_email', |
|
683 | + 'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by', |
|
684 | 684 | 'parent[-|_]id', |
685 | - ); |
|
685 | + ); |
|
686 | 686 | |
687 | - foreach ( $fields as $field ) { |
|
688 | - $tagregexp[] = $field->id; |
|
689 | - $tagregexp[] = $field->field_key; |
|
690 | - } |
|
687 | + foreach ( $fields as $field ) { |
|
688 | + $tagregexp[] = $field->id; |
|
689 | + $tagregexp[] = $field->field_key; |
|
690 | + } |
|
691 | 691 | |
692 | - $tagregexp = implode('|', $tagregexp); |
|
693 | - return $tagregexp; |
|
694 | - } |
|
692 | + $tagregexp = implode('|', $tagregexp); |
|
693 | + return $tagregexp; |
|
694 | + } |
|
695 | 695 | |
696 | 696 | public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { |
697 | - $shortcode_values = array( |
|
698 | - 'id' => $entry->id, |
|
699 | - 'key' => $entry->item_key, |
|
700 | - 'ip' => $entry->ip, |
|
701 | - ); |
|
697 | + $shortcode_values = array( |
|
698 | + 'id' => $entry->id, |
|
699 | + 'key' => $entry->item_key, |
|
700 | + 'ip' => $entry->ip, |
|
701 | + ); |
|
702 | 702 | |
703 | - foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
703 | + foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
704 | 704 | if ( empty( $tag ) ) { |
705 | 705 | continue; |
706 | 706 | } |
707 | 707 | |
708 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
708 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
709 | 709 | |
710 | - if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
710 | + if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
711 | 711 | $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] ); |
712 | - $tags = explode(' ', $tag); |
|
713 | - if ( is_array($tags) ) { |
|
714 | - $tag = $tags[0]; |
|
715 | - } |
|
716 | - } else { |
|
717 | - $tag = $shortcodes[2][ $short_key ]; |
|
718 | - } |
|
719 | - |
|
720 | - switch ( $tag ) { |
|
721 | - case 'id': |
|
722 | - case 'key': |
|
723 | - case 'ip': |
|
724 | - $replace_with = $shortcode_values[ $tag ]; |
|
725 | - break; |
|
726 | - |
|
727 | - case 'user_agent': |
|
728 | - case 'user-agent': |
|
729 | - $entry->description = maybe_unserialize($entry->description); |
|
712 | + $tags = explode(' ', $tag); |
|
713 | + if ( is_array($tags) ) { |
|
714 | + $tag = $tags[0]; |
|
715 | + } |
|
716 | + } else { |
|
717 | + $tag = $shortcodes[2][ $short_key ]; |
|
718 | + } |
|
719 | + |
|
720 | + switch ( $tag ) { |
|
721 | + case 'id': |
|
722 | + case 'key': |
|
723 | + case 'ip': |
|
724 | + $replace_with = $shortcode_values[ $tag ]; |
|
725 | + break; |
|
726 | + |
|
727 | + case 'user_agent': |
|
728 | + case 'user-agent': |
|
729 | + $entry->description = maybe_unserialize($entry->description); |
|
730 | 730 | $replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] ); |
731 | - break; |
|
732 | - |
|
733 | - case 'created_at': |
|
734 | - case 'created-at': |
|
735 | - case 'updated_at': |
|
736 | - case 'updated-at': |
|
737 | - if ( isset($atts['format']) ) { |
|
738 | - $time_format = ' '; |
|
739 | - } else { |
|
740 | - $atts['format'] = get_option('date_format'); |
|
741 | - $time_format = ''; |
|
742 | - } |
|
743 | - |
|
744 | - $this_tag = str_replace('-', '_', $tag); |
|
745 | - $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
746 | - unset($this_tag); |
|
747 | - break; |
|
748 | - |
|
749 | - case 'created_by': |
|
750 | - case 'created-by': |
|
751 | - case 'updated_by': |
|
752 | - case 'updated-by': |
|
753 | - $this_tag = str_replace('-', '_', $tag); |
|
731 | + break; |
|
732 | + |
|
733 | + case 'created_at': |
|
734 | + case 'created-at': |
|
735 | + case 'updated_at': |
|
736 | + case 'updated-at': |
|
737 | + if ( isset($atts['format']) ) { |
|
738 | + $time_format = ' '; |
|
739 | + } else { |
|
740 | + $atts['format'] = get_option('date_format'); |
|
741 | + $time_format = ''; |
|
742 | + } |
|
743 | + |
|
744 | + $this_tag = str_replace('-', '_', $tag); |
|
745 | + $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
746 | + unset($this_tag); |
|
747 | + break; |
|
748 | + |
|
749 | + case 'created_by': |
|
750 | + case 'created-by': |
|
751 | + case 'updated_by': |
|
752 | + case 'updated-by': |
|
753 | + $this_tag = str_replace('-', '_', $tag); |
|
754 | 754 | $replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts ); |
755 | - unset($this_tag); |
|
756 | - break; |
|
757 | - |
|
758 | - case 'admin_email': |
|
759 | - case 'siteurl': |
|
760 | - case 'frmurl': |
|
761 | - case 'sitename': |
|
762 | - case 'get': |
|
763 | - $replace_with = self::dynamic_default_values( $tag, $atts ); |
|
764 | - break; |
|
765 | - |
|
766 | - default: |
|
767 | - $field = FrmField::getOne( $tag ); |
|
768 | - if ( ! $field ) { |
|
769 | - break; |
|
770 | - } |
|
771 | - |
|
772 | - $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
773 | - |
|
774 | - $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
|
775 | - |
|
776 | - $atts['entry_id'] = $entry->id; |
|
777 | - $atts['entry_key'] = $entry->item_key; |
|
778 | - |
|
779 | - if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
780 | - $replace_with = $field->name; |
|
781 | - } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
782 | - $replace_with = $field->description; |
|
755 | + unset($this_tag); |
|
756 | + break; |
|
757 | + |
|
758 | + case 'admin_email': |
|
759 | + case 'siteurl': |
|
760 | + case 'frmurl': |
|
761 | + case 'sitename': |
|
762 | + case 'get': |
|
763 | + $replace_with = self::dynamic_default_values( $tag, $atts ); |
|
764 | + break; |
|
765 | + |
|
766 | + default: |
|
767 | + $field = FrmField::getOne( $tag ); |
|
768 | + if ( ! $field ) { |
|
769 | + break; |
|
770 | + } |
|
771 | + |
|
772 | + $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
773 | + |
|
774 | + $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
|
775 | + |
|
776 | + $atts['entry_id'] = $entry->id; |
|
777 | + $atts['entry_key'] = $entry->item_key; |
|
778 | + |
|
779 | + if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
780 | + $replace_with = $field->name; |
|
781 | + } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
782 | + $replace_with = $field->description; |
|
783 | 783 | } else { |
784 | 784 | $string_value = $replace_with; |
785 | 785 | if ( is_array( $replace_with ) ) { |
@@ -793,82 +793,82 @@ discard block |
||
793 | 793 | } |
794 | 794 | } |
795 | 795 | |
796 | - unset($field); |
|
797 | - break; |
|
798 | - } |
|
796 | + unset($field); |
|
797 | + break; |
|
798 | + } |
|
799 | 799 | |
800 | - if ( isset($replace_with) ) { |
|
801 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
802 | - } |
|
800 | + if ( isset($replace_with) ) { |
|
801 | + $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
802 | + } |
|
803 | 803 | |
804 | - unset($atts, $conditional, $replace_with); |
|
804 | + unset($atts, $conditional, $replace_with); |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | return $content; |
808 | - } |
|
809 | - |
|
810 | - /** |
|
811 | - * Get the value to replace a few standard shortcodes |
|
812 | - * |
|
813 | - * @since 2.0 |
|
814 | - * @return string |
|
815 | - */ |
|
816 | - public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) { |
|
817 | - $new_value = ''; |
|
818 | - switch ( $tag ) { |
|
819 | - case 'admin_email': |
|
820 | - $new_value = get_option('admin_email'); |
|
821 | - break; |
|
822 | - case 'siteurl': |
|
823 | - $new_value = FrmAppHelper::site_url(); |
|
824 | - break; |
|
825 | - case 'frmurl': |
|
826 | - $new_value = FrmAppHelper::plugin_url(); |
|
827 | - break; |
|
828 | - case 'sitename': |
|
829 | - $new_value = FrmAppHelper::site_name(); |
|
830 | - break; |
|
831 | - case 'get': |
|
832 | - $new_value = self::process_get_shortcode( $atts, $return_array ); |
|
833 | - break; |
|
834 | - } |
|
835 | - |
|
836 | - return $new_value; |
|
837 | - } |
|
838 | - |
|
839 | - /** |
|
840 | - * Process the [get] shortcode |
|
841 | - * |
|
842 | - * @since 2.0 |
|
843 | - * @return string|array |
|
844 | - */ |
|
845 | - public static function process_get_shortcode( $atts, $return_array = false ) { |
|
846 | - if ( ! isset($atts['param']) ) { |
|
847 | - return ''; |
|
848 | - } |
|
849 | - |
|
850 | - if ( strpos($atts['param'], '[') ) { |
|
851 | - $atts['param'] = str_replace('[', '[', $atts['param']); |
|
852 | - $atts['param'] = str_replace(']', ']', $atts['param']); |
|
853 | - } |
|
854 | - |
|
855 | - $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
856 | - $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
|
857 | - |
|
858 | - if ( $new_value == '' ) { |
|
859 | - if ( ! isset($atts['prev_val']) ) { |
|
860 | - $atts['prev_val'] = ''; |
|
861 | - } |
|
862 | - |
|
863 | - $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
864 | - } |
|
865 | - |
|
866 | - if ( is_array($new_value) && ! $return_array ) { |
|
867 | - $new_value = implode(', ', $new_value); |
|
868 | - } |
|
869 | - |
|
870 | - return $new_value; |
|
871 | - } |
|
808 | + } |
|
809 | + |
|
810 | + /** |
|
811 | + * Get the value to replace a few standard shortcodes |
|
812 | + * |
|
813 | + * @since 2.0 |
|
814 | + * @return string |
|
815 | + */ |
|
816 | + public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) { |
|
817 | + $new_value = ''; |
|
818 | + switch ( $tag ) { |
|
819 | + case 'admin_email': |
|
820 | + $new_value = get_option('admin_email'); |
|
821 | + break; |
|
822 | + case 'siteurl': |
|
823 | + $new_value = FrmAppHelper::site_url(); |
|
824 | + break; |
|
825 | + case 'frmurl': |
|
826 | + $new_value = FrmAppHelper::plugin_url(); |
|
827 | + break; |
|
828 | + case 'sitename': |
|
829 | + $new_value = FrmAppHelper::site_name(); |
|
830 | + break; |
|
831 | + case 'get': |
|
832 | + $new_value = self::process_get_shortcode( $atts, $return_array ); |
|
833 | + break; |
|
834 | + } |
|
835 | + |
|
836 | + return $new_value; |
|
837 | + } |
|
838 | + |
|
839 | + /** |
|
840 | + * Process the [get] shortcode |
|
841 | + * |
|
842 | + * @since 2.0 |
|
843 | + * @return string|array |
|
844 | + */ |
|
845 | + public static function process_get_shortcode( $atts, $return_array = false ) { |
|
846 | + if ( ! isset($atts['param']) ) { |
|
847 | + return ''; |
|
848 | + } |
|
849 | + |
|
850 | + if ( strpos($atts['param'], '[') ) { |
|
851 | + $atts['param'] = str_replace('[', '[', $atts['param']); |
|
852 | + $atts['param'] = str_replace(']', ']', $atts['param']); |
|
853 | + } |
|
854 | + |
|
855 | + $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
856 | + $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
|
857 | + |
|
858 | + if ( $new_value == '' ) { |
|
859 | + if ( ! isset($atts['prev_val']) ) { |
|
860 | + $atts['prev_val'] = ''; |
|
861 | + } |
|
862 | + |
|
863 | + $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
864 | + } |
|
865 | + |
|
866 | + if ( is_array($new_value) && ! $return_array ) { |
|
867 | + $new_value = implode(', ', $new_value); |
|
868 | + } |
|
869 | + |
|
870 | + return $new_value; |
|
871 | + } |
|
872 | 872 | |
873 | 873 | public static function get_display_value( $value, $field, $atts = array() ) { |
874 | 874 | |
@@ -952,37 +952,37 @@ discard block |
||
952 | 952 | } |
953 | 953 | |
954 | 954 | public static function get_field_types( $type ) { |
955 | - $single_input = array( |
|
956 | - 'text', 'textarea', 'rte', 'number', 'email', 'url', |
|
957 | - 'image', 'file', 'date', 'phone', 'hidden', 'time', |
|
958 | - 'user_id', 'tag', 'password', |
|
959 | - ); |
|
955 | + $single_input = array( |
|
956 | + 'text', 'textarea', 'rte', 'number', 'email', 'url', |
|
957 | + 'image', 'file', 'date', 'phone', 'hidden', 'time', |
|
958 | + 'user_id', 'tag', 'password', |
|
959 | + ); |
|
960 | 960 | $multiple_input = array( 'radio', 'checkbox', 'select', 'scale', 'lookup' ); |
961 | 961 | $other_type = array( 'html', 'break' ); |
962 | 962 | |
963 | 963 | $field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() ); |
964 | 964 | |
965 | - $field_types = array(); |
|
966 | - if ( in_array($type, $single_input) ) { |
|
967 | - self::field_types_for_input( $single_input, $field_selection, $field_types ); |
|
968 | - } else if ( in_array($type, $multiple_input) ) { |
|
969 | - self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
|
970 | - } else if ( in_array($type, $other_type) ) { |
|
971 | - self::field_types_for_input( $other_type, $field_selection, $field_types ); |
|
965 | + $field_types = array(); |
|
966 | + if ( in_array($type, $single_input) ) { |
|
967 | + self::field_types_for_input( $single_input, $field_selection, $field_types ); |
|
968 | + } else if ( in_array($type, $multiple_input) ) { |
|
969 | + self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
|
970 | + } else if ( in_array($type, $other_type) ) { |
|
971 | + self::field_types_for_input( $other_type, $field_selection, $field_types ); |
|
972 | 972 | } else if ( isset( $field_selection[ $type ] ) ) { |
973 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
974 | - } |
|
973 | + $field_types[ $type ] = $field_selection[ $type ]; |
|
974 | + } |
|
975 | 975 | |
976 | 976 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
977 | - return $field_types; |
|
978 | - } |
|
977 | + return $field_types; |
|
978 | + } |
|
979 | 979 | |
980 | - private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
|
981 | - foreach ( $inputs as $input ) { |
|
982 | - $field_types[ $input ] = $fields[ $input ]; |
|
983 | - unset($input); |
|
984 | - } |
|
985 | - } |
|
980 | + private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
|
981 | + foreach ( $inputs as $input ) { |
|
982 | + $field_types[ $input ] = $fields[ $input ]; |
|
983 | + unset($input); |
|
984 | + } |
|
985 | + } |
|
986 | 986 | |
987 | 987 | /** |
988 | 988 | * Check if current field option is an "other" option |
@@ -996,14 +996,14 @@ discard block |
||
996 | 996 | return $opt_key && strpos( $opt_key, 'other_' ) === 0; |
997 | 997 | } |
998 | 998 | |
999 | - /** |
|
1000 | - * Get value that belongs in "Other" text box |
|
1001 | - * |
|
1002 | - * @since 2.0.6 |
|
1003 | - * |
|
1004 | - * @param array $args |
|
1005 | - */ |
|
1006 | - public static function get_other_val( $args ) { |
|
999 | + /** |
|
1000 | + * Get value that belongs in "Other" text box |
|
1001 | + * |
|
1002 | + * @since 2.0.6 |
|
1003 | + * |
|
1004 | + * @param array $args |
|
1005 | + */ |
|
1006 | + public static function get_other_val( $args ) { |
|
1007 | 1007 | $defaults = array( |
1008 | 1008 | 'opt_key' => 0, 'field' => array(), |
1009 | 1009 | 'parent' => false, 'pointer' => false, |
@@ -1079,20 +1079,20 @@ discard block |
||
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | return $other_val; |
1082 | - } |
|
1083 | - |
|
1084 | - /** |
|
1085 | - * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val. |
|
1086 | - * Intended for front-end use |
|
1087 | - * |
|
1088 | - * @since 2.0.6 |
|
1089 | - * |
|
1090 | - * @param array $args should include field, opt_key and field name |
|
1091 | - * @param boolean $other_opt |
|
1092 | - * @param string $checked |
|
1093 | - * @return string $other_val |
|
1094 | - */ |
|
1095 | - public static function prepare_other_input( $args, &$other_opt, &$checked ) { |
|
1082 | + } |
|
1083 | + |
|
1084 | + /** |
|
1085 | + * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val. |
|
1086 | + * Intended for front-end use |
|
1087 | + * |
|
1088 | + * @since 2.0.6 |
|
1089 | + * |
|
1090 | + * @param array $args should include field, opt_key and field name |
|
1091 | + * @param boolean $other_opt |
|
1092 | + * @param string $checked |
|
1093 | + * @return string $other_val |
|
1094 | + */ |
|
1095 | + public static function prepare_other_input( $args, &$other_opt, &$checked ) { |
|
1096 | 1096 | //Check if this is an "Other" option |
1097 | 1097 | if ( ! self::is_other_opt( $args['opt_key'] ) ) { |
1098 | 1098 | return; |
@@ -1108,8 +1108,8 @@ discard block |
||
1108 | 1108 | $checked = 'checked="checked" '; |
1109 | 1109 | } |
1110 | 1110 | |
1111 | - return $other_args; |
|
1112 | - } |
|
1111 | + return $other_args; |
|
1112 | + } |
|
1113 | 1113 | |
1114 | 1114 | /** |
1115 | 1115 | * @param array $args |
@@ -1159,8 +1159,8 @@ discard block |
||
1159 | 1159 | * @since 2.0.6 |
1160 | 1160 | */ |
1161 | 1161 | public static function include_other_input( $args ) { |
1162 | - if ( ! $args['other_opt'] ) { |
|
1163 | - return; |
|
1162 | + if ( ! $args['other_opt'] ) { |
|
1163 | + return; |
|
1164 | 1164 | } |
1165 | 1165 | |
1166 | 1166 | $classes = array( 'frm_other_input' ); |
@@ -1181,15 +1181,15 @@ discard block |
||
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | /** |
1184 | - * Get the HTML id for an "Other" text field |
|
1185 | - * Note: This does not affect fields in repeating sections |
|
1186 | - * |
|
1187 | - * @since 2.0.08 |
|
1188 | - * @param string $type - field type |
|
1189 | - * @param string $html_id |
|
1190 | - * @param string|boolean $opt_key |
|
1191 | - * @return string $other_id |
|
1192 | - */ |
|
1184 | + * Get the HTML id for an "Other" text field |
|
1185 | + * Note: This does not affect fields in repeating sections |
|
1186 | + * |
|
1187 | + * @since 2.0.08 |
|
1188 | + * @param string $type - field type |
|
1189 | + * @param string $html_id |
|
1190 | + * @param string|boolean $opt_key |
|
1191 | + * @return string $other_id |
|
1192 | + */ |
|
1193 | 1193 | public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) { |
1194 | 1194 | $other_id = $html_id; |
1195 | 1195 | |
@@ -1247,10 +1247,10 @@ discard block |
||
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | public static function switch_field_ids( $val ) { |
1250 | - global $frm_duplicate_ids; |
|
1251 | - $replace = array(); |
|
1252 | - $replace_with = array(); |
|
1253 | - foreach ( (array) $frm_duplicate_ids as $old => $new ) { |
|
1250 | + global $frm_duplicate_ids; |
|
1251 | + $replace = array(); |
|
1252 | + $replace_with = array(); |
|
1253 | + foreach ( (array) $frm_duplicate_ids as $old => $new ) { |
|
1254 | 1254 | $replace[] = '[if ' . $old . ']'; |
1255 | 1255 | $replace_with[] = '[if ' . $new . ']'; |
1256 | 1256 | $replace[] = '[if ' . $old . ' '; |
@@ -1265,153 +1265,153 @@ discard block |
||
1265 | 1265 | $replace_with[] = '[' . $new . ']'; |
1266 | 1266 | $replace[] = '[' . $old . ' '; |
1267 | 1267 | $replace_with[] = '[' . $new . ' '; |
1268 | - unset($old, $new); |
|
1269 | - } |
|
1268 | + unset($old, $new); |
|
1269 | + } |
|
1270 | 1270 | if ( is_array( $val ) ) { |
1271 | 1271 | foreach ( $val as $k => $v ) { |
1272 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
1273 | - unset($k, $v); |
|
1274 | - } |
|
1275 | - } else { |
|
1276 | - $val = str_replace($replace, $replace_with, $val); |
|
1277 | - } |
|
1278 | - |
|
1279 | - return $val; |
|
1280 | - } |
|
1281 | - |
|
1282 | - public static function get_us_states() { |
|
1283 | - return apply_filters( 'frm_us_states', array( |
|
1284 | - 'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona', |
|
1285 | - 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', |
|
1286 | - 'DC' => 'District of Columbia', |
|
1287 | - 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
|
1288 | - 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
|
1289 | - 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
1290 | - 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
|
1291 | - 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
|
1292 | - 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
|
1293 | - 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', |
|
1294 | - 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', |
|
1295 | - 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', |
|
1296 | - 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', |
|
1297 | - 'WI' => 'Wisconsin', 'WY' => 'Wyoming', |
|
1298 | - ) ); |
|
1299 | - } |
|
1300 | - |
|
1301 | - public static function get_countries() { |
|
1302 | - return apply_filters( 'frm_countries', array( |
|
1303 | - __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ), |
|
1304 | - __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ), |
|
1305 | - __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ), |
|
1306 | - __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ), |
|
1307 | - __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ), |
|
1308 | - __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ), |
|
1309 | - __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ), |
|
1310 | - __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ), |
|
1311 | - __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ), |
|
1312 | - __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ), |
|
1313 | - __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ), |
|
1314 | - __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ), |
|
1315 | - __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ), |
|
1316 | - __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ), |
|
1317 | - __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ), |
|
1318 | - __( 'Costa Rica', 'formidable' ), __( 'Côte d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ), |
|
1319 | - __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ), |
|
1320 | - __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ), |
|
1321 | - __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ), |
|
1322 | - __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ), |
|
1323 | - __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ), |
|
1324 | - __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ), |
|
1325 | - __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ), |
|
1326 | - __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ), |
|
1327 | - __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ), |
|
1328 | - __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ), |
|
1329 | - __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ), |
|
1330 | - __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ), |
|
1331 | - __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ), |
|
1332 | - __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ), |
|
1333 | - __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ), |
|
1334 | - __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ), |
|
1335 | - __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ), |
|
1336 | - __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ), |
|
1337 | - __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ), |
|
1338 | - __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ), |
|
1339 | - __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ), |
|
1340 | - __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ), |
|
1341 | - __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ), |
|
1342 | - __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ), |
|
1343 | - __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ), |
|
1344 | - __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ), |
|
1345 | - __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ), |
|
1346 | - __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ), |
|
1347 | - __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ), |
|
1348 | - __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ), |
|
1349 | - __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ), |
|
1350 | - __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ), |
|
1351 | - __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ), |
|
1352 | - __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ), |
|
1353 | - __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ), |
|
1354 | - __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ), |
|
1355 | - __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ), |
|
1356 | - __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ), |
|
1357 | - __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ), |
|
1358 | - __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ), |
|
1359 | - __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ), |
|
1360 | - __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ), |
|
1361 | - __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ), |
|
1362 | - __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ), |
|
1363 | - __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ), |
|
1364 | - __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ), |
|
1365 | - __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ), |
|
1366 | - __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ), |
|
1367 | - __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ), |
|
1368 | - __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ), |
|
1369 | - __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ), |
|
1370 | - __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ), |
|
1371 | - __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ), |
|
1372 | - __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ), |
|
1373 | - __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ), |
|
1374 | - __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ), |
|
1375 | - __( 'Zimbabwe', 'formidable' ), |
|
1376 | - ) ); |
|
1377 | - } |
|
1272 | + $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
1273 | + unset($k, $v); |
|
1274 | + } |
|
1275 | + } else { |
|
1276 | + $val = str_replace($replace, $replace_with, $val); |
|
1277 | + } |
|
1278 | + |
|
1279 | + return $val; |
|
1280 | + } |
|
1281 | + |
|
1282 | + public static function get_us_states() { |
|
1283 | + return apply_filters( 'frm_us_states', array( |
|
1284 | + 'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona', |
|
1285 | + 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', |
|
1286 | + 'DC' => 'District of Columbia', |
|
1287 | + 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
|
1288 | + 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
|
1289 | + 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
1290 | + 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
|
1291 | + 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
|
1292 | + 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
|
1293 | + 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', |
|
1294 | + 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', |
|
1295 | + 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', |
|
1296 | + 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', |
|
1297 | + 'WI' => 'Wisconsin', 'WY' => 'Wyoming', |
|
1298 | + ) ); |
|
1299 | + } |
|
1300 | + |
|
1301 | + public static function get_countries() { |
|
1302 | + return apply_filters( 'frm_countries', array( |
|
1303 | + __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ), |
|
1304 | + __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ), |
|
1305 | + __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ), |
|
1306 | + __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ), |
|
1307 | + __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ), |
|
1308 | + __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ), |
|
1309 | + __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ), |
|
1310 | + __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ), |
|
1311 | + __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ), |
|
1312 | + __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ), |
|
1313 | + __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ), |
|
1314 | + __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ), |
|
1315 | + __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ), |
|
1316 | + __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ), |
|
1317 | + __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ), |
|
1318 | + __( 'Costa Rica', 'formidable' ), __( 'Côte d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ), |
|
1319 | + __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ), |
|
1320 | + __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ), |
|
1321 | + __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ), |
|
1322 | + __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ), |
|
1323 | + __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ), |
|
1324 | + __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ), |
|
1325 | + __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ), |
|
1326 | + __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ), |
|
1327 | + __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ), |
|
1328 | + __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ), |
|
1329 | + __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ), |
|
1330 | + __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ), |
|
1331 | + __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ), |
|
1332 | + __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ), |
|
1333 | + __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ), |
|
1334 | + __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ), |
|
1335 | + __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ), |
|
1336 | + __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ), |
|
1337 | + __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ), |
|
1338 | + __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ), |
|
1339 | + __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ), |
|
1340 | + __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ), |
|
1341 | + __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ), |
|
1342 | + __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ), |
|
1343 | + __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ), |
|
1344 | + __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ), |
|
1345 | + __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ), |
|
1346 | + __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ), |
|
1347 | + __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ), |
|
1348 | + __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ), |
|
1349 | + __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ), |
|
1350 | + __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ), |
|
1351 | + __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ), |
|
1352 | + __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ), |
|
1353 | + __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ), |
|
1354 | + __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ), |
|
1355 | + __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ), |
|
1356 | + __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ), |
|
1357 | + __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ), |
|
1358 | + __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ), |
|
1359 | + __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ), |
|
1360 | + __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ), |
|
1361 | + __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ), |
|
1362 | + __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ), |
|
1363 | + __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ), |
|
1364 | + __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ), |
|
1365 | + __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ), |
|
1366 | + __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ), |
|
1367 | + __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ), |
|
1368 | + __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ), |
|
1369 | + __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ), |
|
1370 | + __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ), |
|
1371 | + __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ), |
|
1372 | + __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ), |
|
1373 | + __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ), |
|
1374 | + __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ), |
|
1375 | + __( 'Zimbabwe', 'formidable' ), |
|
1376 | + ) ); |
|
1377 | + } |
|
1378 | 1378 | |
1379 | 1379 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
1380 | 1380 | $prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries(); |
1381 | 1381 | |
1382 | - $states = FrmFieldsHelper::get_us_states(); |
|
1383 | - $state_abv = array_keys($states); |
|
1384 | - sort($state_abv); |
|
1382 | + $states = FrmFieldsHelper::get_us_states(); |
|
1383 | + $state_abv = array_keys($states); |
|
1384 | + sort($state_abv); |
|
1385 | 1385 | $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
1386 | 1386 | |
1387 | - $states = array_values($states); |
|
1388 | - sort($states); |
|
1387 | + $states = array_values($states); |
|
1388 | + sort($states); |
|
1389 | 1389 | $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
1390 | - unset($state_abv, $states); |
|
1390 | + unset($state_abv, $states); |
|
1391 | 1391 | |
1392 | 1392 | $prepop[ __( 'Age', 'formidable' ) ] = array( |
1393 | - __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
|
1394 | - __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
|
1395 | - __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
|
1396 | - ); |
|
1393 | + __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
|
1394 | + __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
|
1395 | + __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
|
1396 | + ); |
|
1397 | 1397 | |
1398 | 1398 | $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
1399 | - __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
1400 | - __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
|
1401 | - ); |
|
1399 | + __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
1400 | + __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
|
1401 | + ); |
|
1402 | 1402 | |
1403 | 1403 | $prepop[ __( 'Importance', 'formidable' ) ] = array( |
1404 | - __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
1405 | - __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
|
1406 | - ); |
|
1404 | + __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
1405 | + __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
|
1406 | + ); |
|
1407 | 1407 | |
1408 | 1408 | $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
1409 | - __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
1410 | - __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
|
1411 | - ); |
|
1409 | + __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
1410 | + __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
|
1411 | + ); |
|
1412 | 1412 | |
1413 | 1413 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
1414 | - } |
|
1414 | + } |
|
1415 | 1415 | |
1416 | 1416 | /** |
1417 | 1417 | * Display a field value selector |
@@ -1421,10 +1421,10 @@ discard block |
||
1421 | 1421 | * @param int $selector_field_id |
1422 | 1422 | * @param array $selector_args |
1423 | 1423 | */ |
1424 | - public static function display_field_value_selector( $selector_field_id, $selector_args ) { |
|
1425 | - $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args ); |
|
1426 | - $field_value_selector->display(); |
|
1427 | - } |
|
1424 | + public static function display_field_value_selector( $selector_field_id, $selector_args ) { |
|
1425 | + $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args ); |
|
1426 | + $field_value_selector->display(); |
|
1427 | + } |
|
1428 | 1428 | |
1429 | 1429 | /** |
1430 | 1430 | * Convert a field object to a flat array |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined('ABSPATH') ) { |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | 3 | die( 'You are not allowed to call this page directly.' ); |
4 | 4 | } |
5 | 5 | |
@@ -7,8 +7,8 @@ discard block |
||
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); |
|
10 | + if ( strpos( $type, '|' ) ) { |
|
11 | + list( $type, $setting ) = explode( '|', $type ); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | $values = self::get_default_field( $type ); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | if ( in_array( $type, array( 'data', 'lookup' ) ) ) { |
26 | 26 | $values['field_options']['data_type'] = $setting; |
27 | 27 | } else { |
28 | - $values['field_options'][ $setting ] = 1; |
|
28 | + $values['field_options'][$setting] = 1; |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if ( ! $doing_ajax ) { |
49 | 49 | $field_values = array( 'name', 'description', 'field_key', 'type', 'default_value', 'field_order', 'required' ); |
50 | 50 | foreach ( $field_values as $var ) { |
51 | - $values[ $var ] = FrmAppHelper::get_param( $var, $values[ $var ], 'get', 'htmlspecialchars' ); |
|
51 | + $values[$var] = FrmAppHelper::get_param( $var, $values[$var], 'get', 'htmlspecialchars' ); |
|
52 | 52 | unset( $var ); |
53 | 53 | } |
54 | 54 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | $defaults = self::get_default_field_options_from_field( $field ); |
79 | 79 | |
80 | 80 | foreach ( $defaults as $opt => $default ) { |
81 | - $current_opt = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default; |
|
82 | - $values[ $opt ] = ( $_POST && isset( $_POST['field_options'][ $opt . '_' . $field->id ] ) ) ? stripslashes_deep( maybe_unserialize( $_POST['field_options'][ $opt . '_' . $field->id ] ) ) : $current_opt; |
|
81 | + $current_opt = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default; |
|
82 | + $values[$opt] = ( $_POST && isset( $_POST['field_options'][$opt . '_' . $field->id] ) ) ? stripslashes_deep( maybe_unserialize( $_POST['field_options'][$opt . '_' . $field->id] ) ) : $current_opt; |
|
83 | 83 | unset( $opt, $default ); |
84 | 84 | } |
85 | 85 | } |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | |
129 | 129 | $values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
130 | 130 | $values['form_id'] = $form_id; |
131 | - $values['options'] = maybe_serialize($field->options); |
|
132 | - $values['default_value'] = maybe_serialize($field->default_value); |
|
131 | + $values['options'] = maybe_serialize( $field->options ); |
|
132 | + $values['default_value'] = maybe_serialize( $field->default_value ); |
|
133 | 133 | |
134 | 134 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
135 | - $values[ $col ] = $field->{$col}; |
|
135 | + $values[$col] = $field->{$col}; |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | |
147 | 147 | $conf_msg = __( 'The entered values do not match', 'formidable' ); |
148 | 148 | $defaults = array( |
149 | - 'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ) ), |
|
150 | - 'invalid' => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ) ), |
|
149 | + 'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ) ), |
|
150 | + 'invalid' => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ) ), |
|
151 | 151 | 'blank' => array( 'full' => $frm_settings->blank_msg, 'part' => $frm_settings->blank_msg ), |
152 | 152 | 'conf_msg' => array( 'full' => $conf_msg, 'part' => $conf_msg ), |
153 | 153 | ); |
154 | 154 | |
155 | 155 | $msg = FrmField::get_option( $field, $error ); |
156 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
156 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
157 | 157 | $msg = do_shortcode( $msg ); |
158 | 158 | return $msg; |
159 | 159 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $default_html = apply_filters( 'frm_other_custom_html', '', $type ); |
173 | 173 | } |
174 | 174 | |
175 | - return apply_filters('frm_custom_html', $default_html, $type); |
|
175 | + return apply_filters( 'frm_custom_html', $default_html, $type ); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | public static function show_fields( $fields, $errors, $form, $form_action ) { |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $html = str_replace( '[key]', $field['field_key'], $html ); |
229 | 229 | |
230 | 230 | //replace [field_name] |
231 | - $html = str_replace('[field_name]', $field['name'], $html ); |
|
231 | + $html = str_replace( '[field_name]', $field['name'], $html ); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @since 3.0 |
268 | 268 | */ |
269 | 269 | private static function replace_error_shortcode( $args, &$html ) { |
270 | - $error = isset( $args['errors'][ 'field' . $args['field_id'] ] ) ? $args['errors'][ 'field' . $args['field_id'] ] : false; |
|
270 | + $error = isset( $args['errors']['field' . $args['field_id']] ) ? $args['errors']['field' . $args['field_id']] : false; |
|
271 | 271 | self::remove_inline_conditions( ! empty( $error ), 'error', $error, $html ); |
272 | 272 | } |
273 | 273 | /** |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | return; |
317 | 317 | } |
318 | 318 | |
319 | - self::filter_for_more_shortcodes( $args, $args['field'], $html); |
|
319 | + self::filter_for_more_shortcodes( $args, $args['field'], $html ); |
|
320 | 320 | self::filter_html_field_shortcodes( $args['field'], $html ); |
321 | 321 | self::remove_collapse_shortcode( $html ); |
322 | 322 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | /** |
325 | 325 | * @since 3.0 |
326 | 326 | */ |
327 | - private static function filter_for_more_shortcodes( $args, $field, &$html) { |
|
327 | + private static function filter_for_more_shortcodes( $args, $field, &$html ) { |
|
328 | 328 | //If field is not in repeating section |
329 | 329 | if ( empty( $args['section_id'] ) ) { |
330 | 330 | $args = array( 'errors' => $args['errors'], 'form' => $args['form'] ); |
@@ -347,10 +347,10 @@ discard block |
||
347 | 347 | * @since 3.0 |
348 | 348 | */ |
349 | 349 | public static function replace_shortcodes_with_atts( $args, &$html ) { |
350 | - preg_match_all("/\[(deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER); |
|
350 | + preg_match_all( "/\[(deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER ); |
|
351 | 351 | |
352 | 352 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
353 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
353 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
354 | 354 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) ); |
355 | 355 | |
356 | 356 | $replace_with = ''; |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $replace_with = FrmProEntriesController::entry_delete_link( $shortcode_atts ); |
360 | 360 | } |
361 | 361 | |
362 | - $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html ); |
|
362 | + $html = str_replace( $shortcodes[0][$short_key], $replace_with, $html ); |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | |
@@ -453,14 +453,14 @@ discard block |
||
453 | 453 | */ |
454 | 454 | private static function get_field_div_classes( $field_id, $field, $errors, $html ) { |
455 | 455 | // Add error class |
456 | - $classes = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : ''; |
|
456 | + $classes = isset( $errors['field' . $field_id] ) ? ' frm_blank_field' : ''; |
|
457 | 457 | |
458 | 458 | // Add label position class |
459 | 459 | $classes .= ' frm_' . $field['label'] . '_container'; |
460 | 460 | |
461 | 461 | // Add CSS layout classes |
462 | 462 | if ( ! empty( $field['classes'] ) ) { |
463 | - if ( ! strpos( $html, 'frm_form_field ') ) { |
|
463 | + if ( ! strpos( $html, 'frm_form_field ' ) ) { |
|
464 | 464 | $classes .= ' frm_form_field'; |
465 | 465 | } |
466 | 466 | $classes .= ' ' . $field['classes']; |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | } |
522 | 522 | |
523 | 523 | $field_name = $field['name']; |
524 | - $html_id = self::get_html_id($field); |
|
524 | + $html_id = self::get_html_id( $field ); |
|
525 | 525 | |
526 | 526 | foreach ( $field['options'] as $opt_key => $opt ) { |
527 | 527 | $field_val = self::get_value_from_array( $opt, $opt_key, $field ); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | // Get string for Other text field, if needed |
531 | 531 | $other_val = self::get_other_val( compact( 'opt_key', 'field' ) ); |
532 | 532 | |
533 | - $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"':''; |
|
533 | + $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"' : ''; |
|
534 | 534 | |
535 | 535 | // If this is an "Other" option, get the HTML for it |
536 | 536 | if ( self::is_other_opt( $opt_key ) ) { |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | } |
557 | 557 | |
558 | 558 | public static function get_term_link( $tax_id ) { |
559 | - $tax = get_taxonomy($tax_id); |
|
559 | + $tax = get_taxonomy( $tax_id ); |
|
560 | 560 | if ( ! $tax ) { |
561 | 561 | return; |
562 | 562 | } |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
566 | 566 | '<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>' |
567 | 567 | ); |
568 | - unset($tax); |
|
568 | + unset( $tax ); |
|
569 | 569 | |
570 | 570 | return $link; |
571 | 571 | } |
@@ -574,8 +574,8 @@ discard block |
||
574 | 574 | $hide_opt = self::get_value_for_comparision( $hide_opt ); |
575 | 575 | $observed_value = self::get_value_for_comparision( $observed_value ); |
576 | 576 | |
577 | - if ( is_array($observed_value) ) { |
|
578 | - return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
577 | + if ( is_array( $observed_value ) ) { |
|
578 | + return self::array_value_condition( $observed_value, $cond, $hide_opt ); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | $m = false; |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | } else if ( $cond == '<' ) { |
589 | 589 | $m = $observed_value < $hide_opt; |
590 | 590 | } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
591 | - $m = stripos($observed_value, $hide_opt); |
|
591 | + $m = stripos( $observed_value, $hide_opt ); |
|
592 | 592 | if ( $cond == 'not LIKE' ) { |
593 | 593 | $m = ( $m === false ) ? true : false; |
594 | 594 | } else { |
@@ -614,23 +614,23 @@ discard block |
||
614 | 614 | public static function array_value_condition( $observed_value, $cond, $hide_opt ) { |
615 | 615 | $m = false; |
616 | 616 | if ( $cond == '==' ) { |
617 | - if ( is_array($hide_opt) ) { |
|
618 | - $m = array_intersect($hide_opt, $observed_value); |
|
619 | - $m = empty($m) ? false : true; |
|
617 | + if ( is_array( $hide_opt ) ) { |
|
618 | + $m = array_intersect( $hide_opt, $observed_value ); |
|
619 | + $m = empty( $m ) ? false : true; |
|
620 | 620 | } else { |
621 | - $m = in_array($hide_opt, $observed_value); |
|
621 | + $m = in_array( $hide_opt, $observed_value ); |
|
622 | 622 | } |
623 | 623 | } else if ( $cond == '!=' ) { |
624 | - $m = ! in_array($hide_opt, $observed_value); |
|
624 | + $m = ! in_array( $hide_opt, $observed_value ); |
|
625 | 625 | } else if ( $cond == '>' ) { |
626 | - $min = min($observed_value); |
|
626 | + $min = min( $observed_value ); |
|
627 | 627 | $m = $min > $hide_opt; |
628 | 628 | } else if ( $cond == '<' ) { |
629 | - $max = max($observed_value); |
|
629 | + $max = max( $observed_value ); |
|
630 | 630 | $m = $max < $hide_opt; |
631 | 631 | } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
632 | 632 | foreach ( $observed_value as $ob ) { |
633 | - $m = strpos($ob, $hide_opt); |
|
633 | + $m = strpos( $ob, $hide_opt ); |
|
634 | 634 | if ( $m !== false ) { |
635 | 635 | $m = true; |
636 | 636 | break; |
@@ -651,27 +651,27 @@ discard block |
||
651 | 651 | * @return string |
652 | 652 | */ |
653 | 653 | public static function basic_replace_shortcodes( $value, $form, $entry ) { |
654 | - if ( strpos($value, '[sitename]') !== false ) { |
|
654 | + if ( strpos( $value, '[sitename]' ) !== false ) { |
|
655 | 655 | $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
656 | - $value = str_replace('[sitename]', $new_value, $value); |
|
656 | + $value = str_replace( '[sitename]', $new_value, $value ); |
|
657 | 657 | } |
658 | 658 | |
659 | - $value = apply_filters('frm_content', $value, $form, $entry); |
|
660 | - $value = do_shortcode($value); |
|
659 | + $value = apply_filters( 'frm_content', $value, $form, $entry ); |
|
660 | + $value = do_shortcode( $value ); |
|
661 | 661 | |
662 | 662 | return $value; |
663 | 663 | } |
664 | 664 | |
665 | 665 | public static function get_shortcodes( $content, $form_id ) { |
666 | 666 | if ( FrmAppHelper::pro_is_installed() ) { |
667 | - return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
667 | + return FrmProDisplaysHelper::get_shortcodes( $content, $form_id ); |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
671 | 671 | |
672 | - $tagregexp = self::allowed_shortcodes($fields); |
|
672 | + $tagregexp = self::allowed_shortcodes( $fields ); |
|
673 | 673 | |
674 | - preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
674 | + preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER ); |
|
675 | 675 | |
676 | 676 | return $matches; |
677 | 677 | } |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | $tagregexp[] = $field->field_key; |
690 | 690 | } |
691 | 691 | |
692 | - $tagregexp = implode('|', $tagregexp); |
|
692 | + $tagregexp = implode( '|', $tagregexp ); |
|
693 | 693 | return $tagregexp; |
694 | 694 | } |
695 | 695 | |
@@ -705,28 +705,28 @@ discard block |
||
705 | 705 | continue; |
706 | 706 | } |
707 | 707 | |
708 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
708 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
709 | 709 | |
710 | - if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
711 | - $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] ); |
|
712 | - $tags = explode(' ', $tag); |
|
713 | - if ( is_array($tags) ) { |
|
710 | + if ( ! empty( $shortcodes[3][$short_key] ) ) { |
|
711 | + $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][$short_key] ); |
|
712 | + $tags = explode( ' ', $tag ); |
|
713 | + if ( is_array( $tags ) ) { |
|
714 | 714 | $tag = $tags[0]; |
715 | 715 | } |
716 | 716 | } else { |
717 | - $tag = $shortcodes[2][ $short_key ]; |
|
717 | + $tag = $shortcodes[2][$short_key]; |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | switch ( $tag ) { |
721 | 721 | case 'id': |
722 | 722 | case 'key': |
723 | 723 | case 'ip': |
724 | - $replace_with = $shortcode_values[ $tag ]; |
|
724 | + $replace_with = $shortcode_values[$tag]; |
|
725 | 725 | break; |
726 | 726 | |
727 | 727 | case 'user_agent': |
728 | 728 | case 'user-agent': |
729 | - $entry->description = maybe_unserialize($entry->description); |
|
729 | + $entry->description = maybe_unserialize( $entry->description ); |
|
730 | 730 | $replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] ); |
731 | 731 | break; |
732 | 732 | |
@@ -734,25 +734,25 @@ discard block |
||
734 | 734 | case 'created-at': |
735 | 735 | case 'updated_at': |
736 | 736 | case 'updated-at': |
737 | - if ( isset($atts['format']) ) { |
|
737 | + if ( isset( $atts['format'] ) ) { |
|
738 | 738 | $time_format = ' '; |
739 | 739 | } else { |
740 | - $atts['format'] = get_option('date_format'); |
|
740 | + $atts['format'] = get_option( 'date_format' ); |
|
741 | 741 | $time_format = ''; |
742 | 742 | } |
743 | 743 | |
744 | - $this_tag = str_replace('-', '_', $tag); |
|
745 | - $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
746 | - unset($this_tag); |
|
744 | + $this_tag = str_replace( '-', '_', $tag ); |
|
745 | + $replace_with = FrmAppHelper::get_formatted_time( $entry->{$this_tag}, $atts['format'], $time_format ); |
|
746 | + unset( $this_tag ); |
|
747 | 747 | break; |
748 | 748 | |
749 | 749 | case 'created_by': |
750 | 750 | case 'created-by': |
751 | 751 | case 'updated_by': |
752 | 752 | case 'updated-by': |
753 | - $this_tag = str_replace('-', '_', $tag); |
|
753 | + $this_tag = str_replace( '-', '_', $tag ); |
|
754 | 754 | $replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts ); |
755 | - unset($this_tag); |
|
755 | + unset( $this_tag ); |
|
756 | 756 | break; |
757 | 757 | |
758 | 758 | case 'admin_email': |
@@ -769,16 +769,16 @@ discard block |
||
769 | 769 | break; |
770 | 770 | } |
771 | 771 | |
772 | - $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
772 | + $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
|
773 | 773 | |
774 | 774 | $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
775 | 775 | |
776 | 776 | $atts['entry_id'] = $entry->id; |
777 | 777 | $atts['entry_key'] = $entry->item_key; |
778 | 778 | |
779 | - if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
779 | + if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) { |
|
780 | 780 | $replace_with = $field->name; |
781 | - } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
781 | + } else if ( isset( $atts['show'] ) && $atts['show'] == 'description' ) { |
|
782 | 782 | $replace_with = $field->description; |
783 | 783 | } else { |
784 | 784 | $string_value = $replace_with; |
@@ -793,15 +793,15 @@ discard block |
||
793 | 793 | } |
794 | 794 | } |
795 | 795 | |
796 | - unset($field); |
|
796 | + unset( $field ); |
|
797 | 797 | break; |
798 | 798 | } |
799 | 799 | |
800 | - if ( isset($replace_with) ) { |
|
801 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
800 | + if ( isset( $replace_with ) ) { |
|
801 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
802 | 802 | } |
803 | 803 | |
804 | - unset($atts, $conditional, $replace_with); |
|
804 | + unset( $atts, $conditional, $replace_with ); |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | return $content; |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | $new_value = ''; |
818 | 818 | switch ( $tag ) { |
819 | 819 | case 'admin_email': |
820 | - $new_value = get_option('admin_email'); |
|
820 | + $new_value = get_option( 'admin_email' ); |
|
821 | 821 | break; |
822 | 822 | case 'siteurl': |
823 | 823 | $new_value = FrmAppHelper::site_url(); |
@@ -843,28 +843,28 @@ discard block |
||
843 | 843 | * @return string|array |
844 | 844 | */ |
845 | 845 | public static function process_get_shortcode( $atts, $return_array = false ) { |
846 | - if ( ! isset($atts['param']) ) { |
|
846 | + if ( ! isset( $atts['param'] ) ) { |
|
847 | 847 | return ''; |
848 | 848 | } |
849 | 849 | |
850 | - if ( strpos($atts['param'], '[') ) { |
|
851 | - $atts['param'] = str_replace('[', '[', $atts['param']); |
|
852 | - $atts['param'] = str_replace(']', ']', $atts['param']); |
|
850 | + if ( strpos( $atts['param'], '[' ) ) { |
|
851 | + $atts['param'] = str_replace( '[', '[', $atts['param'] ); |
|
852 | + $atts['param'] = str_replace( ']', ']', $atts['param'] ); |
|
853 | 853 | } |
854 | 854 | |
855 | - $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
855 | + $new_value = FrmAppHelper::get_param( $atts['param'], '' ); |
|
856 | 856 | $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
857 | 857 | |
858 | 858 | if ( $new_value == '' ) { |
859 | - if ( ! isset($atts['prev_val']) ) { |
|
859 | + if ( ! isset( $atts['prev_val'] ) ) { |
|
860 | 860 | $atts['prev_val'] = ''; |
861 | 861 | } |
862 | 862 | |
863 | - $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
863 | + $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val']; |
|
864 | 864 | } |
865 | 865 | |
866 | - if ( is_array($new_value) && ! $return_array ) { |
|
867 | - $new_value = implode(', ', $new_value); |
|
866 | + if ( is_array( $new_value ) && ! $return_array ) { |
|
867 | + $new_value = implode( ', ', $new_value ); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | return $new_value; |
@@ -902,9 +902,9 @@ discard block |
||
902 | 902 | 'blank' => false, 'link' => false, 'size' => 96 |
903 | 903 | ); |
904 | 904 | |
905 | - $args = wp_parse_args($args, $defaults); |
|
905 | + $args = wp_parse_args( $args, $defaults ); |
|
906 | 906 | |
907 | - $user = get_userdata($user_id); |
|
907 | + $user = get_userdata( $user_id ); |
|
908 | 908 | $info = ''; |
909 | 909 | |
910 | 910 | if ( $user ) { |
@@ -913,16 +913,16 @@ discard block |
||
913 | 913 | } elseif ( $user_info == 'author_link' ) { |
914 | 914 | $info = get_author_posts_url( $user_id ); |
915 | 915 | } else { |
916 | - $info = isset($user->$user_info) ? $user->$user_info : ''; |
|
916 | + $info = isset( $user->$user_info ) ? $user->$user_info : ''; |
|
917 | 917 | } |
918 | 918 | |
919 | - if ( empty($info) && ! $args['blank'] ) { |
|
919 | + if ( empty( $info ) && ! $args['blank'] ) { |
|
920 | 920 | $info = $user->user_login; |
921 | 921 | } |
922 | 922 | } |
923 | 923 | |
924 | 924 | if ( $args['link'] ) { |
925 | - $info = '<a href="' . esc_url( admin_url('user-edit.php?user_id=' . $user_id ) ) . '">' . $info . '</a>'; |
|
925 | + $info = '<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $user_id ) ) . '">' . $info . '</a>'; |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | return $info; |
@@ -963,14 +963,14 @@ discard block |
||
963 | 963 | $field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() ); |
964 | 964 | |
965 | 965 | $field_types = array(); |
966 | - if ( in_array($type, $single_input) ) { |
|
966 | + if ( in_array( $type, $single_input ) ) { |
|
967 | 967 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
968 | - } else if ( in_array($type, $multiple_input) ) { |
|
968 | + } else if ( in_array( $type, $multiple_input ) ) { |
|
969 | 969 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
970 | - } else if ( in_array($type, $other_type) ) { |
|
970 | + } else if ( in_array( $type, $other_type ) ) { |
|
971 | 971 | self::field_types_for_input( $other_type, $field_selection, $field_types ); |
972 | - } else if ( isset( $field_selection[ $type ] ) ) { |
|
973 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
972 | + } else if ( isset( $field_selection[$type] ) ) { |
|
973 | + $field_types[$type] = $field_selection[$type]; |
|
974 | 974 | } |
975 | 975 | |
976 | 976 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
@@ -979,8 +979,8 @@ discard block |
||
979 | 979 | |
980 | 980 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
981 | 981 | foreach ( $inputs as $input ) { |
982 | - $field_types[ $input ] = $fields[ $input ]; |
|
983 | - unset($input); |
|
982 | + $field_types[$input] = $fields[$input]; |
|
983 | + unset( $input ); |
|
984 | 984 | } |
985 | 985 | } |
986 | 986 | |
@@ -1025,21 +1025,21 @@ discard block |
||
1025 | 1025 | // Check posted vals before checking saved values |
1026 | 1026 | |
1027 | 1027 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
1028 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
1028 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
1029 | 1029 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1030 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) : ''; |
|
1030 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) : ''; |
|
1031 | 1031 | } else { |
1032 | - $other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ); |
|
1032 | + $other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ); |
|
1033 | 1033 | } |
1034 | 1034 | return $other_val; |
1035 | 1035 | |
1036 | - } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
1036 | + } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
1037 | 1037 | // For normal fields |
1038 | 1038 | |
1039 | 1039 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1040 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : ''; |
|
1040 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : ''; |
|
1041 | 1041 | } else { |
1042 | - $other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] ); |
|
1042 | + $other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] ); |
|
1043 | 1043 | } |
1044 | 1044 | return $other_val; |
1045 | 1045 | } |
@@ -1048,8 +1048,8 @@ discard block |
||
1048 | 1048 | if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
1049 | 1049 | // Check if there is an "other" val in saved value and make sure the |
1050 | 1050 | // "other" val is not equal to the Other checkbox option |
1051 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
1052 | - $other_val = $field['value'][ $opt_key ]; |
|
1051 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
1052 | + $other_val = $field['value'][$opt_key]; |
|
1053 | 1053 | } |
1054 | 1054 | } else { |
1055 | 1055 | /** |
@@ -1061,8 +1061,8 @@ discard block |
||
1061 | 1061 | // Multi-select dropdowns - key is not preserved |
1062 | 1062 | if ( is_array( $field['value'] ) ) { |
1063 | 1063 | $o_key = array_search( $temp_val, $field['value'] ); |
1064 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
1065 | - unset( $field['value'][ $o_key ], $o_key ); |
|
1064 | + if ( isset( $field['value'][$o_key] ) ) { |
|
1065 | + unset( $field['value'][$o_key], $o_key ); |
|
1066 | 1066 | } |
1067 | 1067 | } else if ( $temp_val == $field['value'] ) { |
1068 | 1068 | // For radio and regular dropdowns |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | private static function set_other_name( $args, &$other_args ) { |
1120 | 1120 | //Set up name for other field |
1121 | 1121 | $other_args['name'] = str_replace( '[]', '', $args['field_name'] ); |
1122 | - $other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']); |
|
1122 | + $other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] ); |
|
1123 | 1123 | $other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']'; |
1124 | 1124 | |
1125 | 1125 | //Converts item_meta[field_id] => item_meta[other][field_id] and |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | // Count should only be greater than 3 if inside of a repeating section |
1147 | 1147 | if ( count( $temp_array ) > 3 ) { |
1148 | 1148 | $parent = str_replace( ']', '', $temp_array[1] ); |
1149 | - $pointer = str_replace( ']', '', $temp_array[2]); |
|
1149 | + $pointer = str_replace( ']', '', $temp_array[2] ); |
|
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | // Get text for "other" text field |
@@ -1265,15 +1265,15 @@ discard block |
||
1265 | 1265 | $replace_with[] = '[' . $new . ']'; |
1266 | 1266 | $replace[] = '[' . $old . ' '; |
1267 | 1267 | $replace_with[] = '[' . $new . ' '; |
1268 | - unset($old, $new); |
|
1268 | + unset( $old, $new ); |
|
1269 | 1269 | } |
1270 | 1270 | if ( is_array( $val ) ) { |
1271 | 1271 | foreach ( $val as $k => $v ) { |
1272 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
1273 | - unset($k, $v); |
|
1272 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
1273 | + unset( $k, $v ); |
|
1274 | 1274 | } |
1275 | 1275 | } else { |
1276 | - $val = str_replace($replace, $replace_with, $val); |
|
1276 | + $val = str_replace( $replace, $replace_with, $val ); |
|
1277 | 1277 | } |
1278 | 1278 | |
1279 | 1279 | return $val; |
@@ -1286,7 +1286,7 @@ discard block |
||
1286 | 1286 | 'DC' => 'District of Columbia', |
1287 | 1287 | 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
1288 | 1288 | 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
1289 | - 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
1289 | + 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland', |
|
1290 | 1290 | 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
1291 | 1291 | 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
1292 | 1292 | 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
@@ -1377,35 +1377,35 @@ discard block |
||
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
1380 | - $prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries(); |
|
1380 | + $prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries(); |
|
1381 | 1381 | |
1382 | 1382 | $states = FrmFieldsHelper::get_us_states(); |
1383 | - $state_abv = array_keys($states); |
|
1384 | - sort($state_abv); |
|
1385 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
1383 | + $state_abv = array_keys( $states ); |
|
1384 | + sort( $state_abv ); |
|
1385 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
1386 | 1386 | |
1387 | - $states = array_values($states); |
|
1388 | - sort($states); |
|
1389 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
1390 | - unset($state_abv, $states); |
|
1387 | + $states = array_values( $states ); |
|
1388 | + sort( $states ); |
|
1389 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
1390 | + unset( $state_abv, $states ); |
|
1391 | 1391 | |
1392 | - $prepop[ __( 'Age', 'formidable' ) ] = array( |
|
1392 | + $prepop[__( 'Age', 'formidable' )] = array( |
|
1393 | 1393 | __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
1394 | 1394 | __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
1395 | 1395 | __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
1396 | 1396 | ); |
1397 | 1397 | |
1398 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
|
1398 | + $prepop[__( 'Satisfaction', 'formidable' )] = array( |
|
1399 | 1399 | __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
1400 | 1400 | __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
1401 | 1401 | ); |
1402 | 1402 | |
1403 | - $prepop[ __( 'Importance', 'formidable' ) ] = array( |
|
1403 | + $prepop[__( 'Importance', 'formidable' )] = array( |
|
1404 | 1404 | __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
1405 | 1405 | __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
1406 | 1406 | ); |
1407 | 1407 | |
1408 | - $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
|
1408 | + $prepop[__( 'Agreement', 'formidable' )] = array( |
|
1409 | 1409 | __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
1410 | 1410 | __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
1411 | 1411 | ); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | - * @param $column |
|
86 | + * @param string $column |
|
87 | 87 | * |
88 | 88 | * @return string|array |
89 | 89 | */ |
@@ -239,6 +239,9 @@ discard block |
||
239 | 239 | return $this->alter_builder_classes( $classes ); |
240 | 240 | } |
241 | 241 | |
242 | + /** |
|
243 | + * @param string $classes |
|
244 | + */ |
|
242 | 245 | protected function alter_builder_classes( $classes ) { |
243 | 246 | return $classes; |
244 | 247 | } |
@@ -187,7 +187,7 @@ |
||
187 | 187 | |
188 | 188 | protected function html_id( $plus = '' ) { |
189 | 189 | return apply_filters( 'frm_field_get_html_id', 'field_' . $this->get_field_column('field_key') . $plus, $this->field ); |
190 | - } |
|
190 | + } |
|
191 | 191 | |
192 | 192 | public function display_field_settings() { |
193 | 193 | $default_settings = $this->default_field_settings(); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | protected function set_type( $type ) { |
77 | 77 | if ( empty( $this->type ) ) { |
78 | - $this->type = $this->get_field_column('type'); |
|
78 | + $this->type = $this->get_field_column( 'type' ); |
|
79 | 79 | if ( empty( $this->type ) && ! empty( $type ) ) { |
80 | 80 | $this->type = $type; |
81 | 81 | } |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | $field_val = ''; |
92 | 92 | if ( is_object( $this->field ) ) { |
93 | 93 | $field_val = $this->field->{$column}; |
94 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
95 | - $field_val = $this->field[ $column ]; |
|
94 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
95 | + $field_val = $this->field[$column]; |
|
96 | 96 | } |
97 | 97 | return $field_val; |
98 | 98 | } |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | protected function builder_text_field() { |
180 | - return '<input type="text" name="' . esc_attr( $this->html_name() ) . '" id="' . esc_attr( $this->html_id() ) . '" value="' . esc_attr( $this->get_field_column('default_value') ) . '" class="dyn_default_value" />'; |
|
180 | + return '<input type="text" name="' . esc_attr( $this->html_name() ) . '" id="' . esc_attr( $this->html_id() ) . '" value="' . esc_attr( $this->get_field_column( 'default_value' ) ) . '" class="dyn_default_value" />'; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | protected function html_name( $name = '' ) { |
184 | 184 | $prefix = empty( $name ) ? 'item_meta' : $name; |
185 | - return $prefix . '[' . $this->get_field_column('id') . ']'; |
|
185 | + return $prefix . '[' . $this->get_field_column( 'id' ) . ']'; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | protected function html_id( $plus = '' ) { |
189 | - return apply_filters( 'frm_field_get_html_id', 'field_' . $this->get_field_column('field_key') . $plus, $this->field ); |
|
189 | + return apply_filters( 'frm_field_get_html_id', 'field_' . $this->get_field_column( 'field_key' ) . $plus, $this->field ); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | public function display_field_settings() { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | } |
277 | 277 | |
278 | 278 | protected function default_invalid_msg() { |
279 | - $field_name = $this->get_field_column('name'); |
|
279 | + $field_name = $this->get_field_column( 'name' ); |
|
280 | 280 | if ( $field_name == '' ) { |
281 | 281 | $invalid = __( 'This field is invalid', 'formidable' ); |
282 | 282 | } else { |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | $fields = FrmField::field_selection(); |
293 | 293 | $fields = array_merge( $fields, FrmField::pro_field_selection() ); |
294 | 294 | |
295 | - if ( isset( $fields[ $this->type ] ) ) { |
|
296 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
295 | + if ( isset( $fields[$this->type] ) ) { |
|
296 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | return $name; |
@@ -387,23 +387,23 @@ discard block |
||
387 | 387 | |
388 | 388 | protected function replace_input_shortcode( $args, &$html ) { |
389 | 389 | unset( $args['field'] ); |
390 | - preg_match_all("/\[(input)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER); |
|
390 | + preg_match_all( "/\[(input)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER ); |
|
391 | 391 | |
392 | 392 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
393 | 393 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) ); |
394 | 394 | if ( $tag == 'input' ) { |
395 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
395 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
396 | 396 | $field['shortcodes'] = $this->prepare_input_shortcode_atts( $shortcode_atts ); |
397 | 397 | $input = $this->include_front_field_input( $args, $shortcode_atts ); |
398 | 398 | |
399 | - $html = str_replace( $shortcodes[0][ $short_key ], $input, $html ); |
|
399 | + $html = str_replace( $shortcodes[0][$short_key], $input, $html ); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | 404 | protected function prepare_input_shortcode_atts( $shortcode_atts ) { |
405 | 405 | if ( isset( $shortcode_atts['opt'] ) ) { |
406 | - $shortcode_atts['opt']--; |
|
406 | + $shortcode_atts['opt'] --; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | $field['input_class'] = isset( $shortcode_atts['class'] ) ? $shortcode_atts['class'] : ''; |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | |
467 | 467 | protected function fill_display_field_values( $args = array() ) { |
468 | 468 | $defaults = array( |
469 | - 'field_name' => 'item_meta[' . $this->get_field_column('id') . ']', |
|
470 | - 'field_id' => $this->get_field_column('id'), |
|
469 | + 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
|
470 | + 'field_id' => $this->get_field_column( 'id' ), |
|
471 | 471 | 'field_plus_id' => '', |
472 | 472 | 'section_id' => '', |
473 | 473 | ); |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | $value = $this->prepare_display_value( $value, $atts ); |
505 | 505 | |
506 | 506 | if ( is_array( $value ) ) { |
507 | - if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) { |
|
508 | - $value = $value[ $atts['show'] ]; |
|
507 | + if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) { |
|
508 | + $value = $value[$atts['show']]; |
|
509 | 509 | } elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) { |
510 | 510 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
511 | 511 | $value = implode( $sep, $value ); |
@@ -564,8 +564,8 @@ discard block |
||
564 | 564 | $saved_entries = $atts['ids']; |
565 | 565 | $new_value = array(); |
566 | 566 | foreach ( (array) $value as $old_child_id ) { |
567 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
568 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
567 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
568 | + $new_value[] = $saved_entries[$old_child_id]; |
|
569 | 569 | } |
570 | 570 | } |
571 | 571 |
@@ -75,7 +75,6 @@ discard block |
||
75 | 75 | * @since 3.0 |
76 | 76 | * |
77 | 77 | * @param array $file_names And array of file paths |
78 | - * @param string $new_location The path for the file to be saved |
|
79 | 78 | */ |
80 | 79 | public function combine_files( $file_names ) { |
81 | 80 | if ( $this->has_permission ) { |
@@ -125,6 +124,9 @@ discard block |
||
125 | 124 | } |
126 | 125 | } |
127 | 126 | |
127 | + /** |
|
128 | + * @param boolean $dirs_exist |
|
129 | + */ |
|
128 | 130 | private function create_directories( &$dirs_exist ) { |
129 | 131 | global $wp_filesystem; |
130 | 132 |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | $this->error_message = isset( $atts['error_message'] ) ? $atts['error_message'] : ''; |
22 | 22 | $this->uploads = wp_upload_dir(); |
23 | 23 | $this->set_new_file_path( $atts ); |
24 | - $this->chmod_dir = defined('FS_CHMOD_DIR') ? FS_CHMOD_DIR : ( fileperms( ABSPATH ) & 0777 | 0755 ); |
|
25 | - $this->chmod_file = defined('FS_CHMOD_FILE') ? FS_CHMOD_FILE : ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ); |
|
24 | + $this->chmod_dir = defined( 'FS_CHMOD_DIR' ) ? FS_CHMOD_DIR : ( fileperms( ABSPATH ) & 0777 | 0755 ); |
|
25 | + $this->chmod_file = defined( 'FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ); |
|
26 | 26 | |
27 | 27 | $this->check_permission(); |
28 | 28 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | private function get_creds() { |
157 | - if ( ! function_exists('get_filesystem_method') ) { |
|
157 | + if ( ! function_exists( 'get_filesystem_method' ) ) { |
|
158 | 158 | include_once( ABSPATH . 'wp-admin/includes/file.php' ); |
159 | 159 | } |
160 | 160 | |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | private function get_ftp_creds( $type ) { |
171 | 171 | $credentials = get_option( 'ftp_credentials', array( 'hostname' => '', 'username' => '' ) ); |
172 | 172 | |
173 | - $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : $credentials['hostname']; |
|
174 | - $credentials['username'] = defined('FTP_USER') ? FTP_USER : $credentials['username']; |
|
175 | - $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : ''; |
|
173 | + $credentials['hostname'] = defined( 'FTP_HOST' ) ? FTP_HOST : $credentials['hostname']; |
|
174 | + $credentials['username'] = defined( 'FTP_USER' ) ? FTP_USER : $credentials['username']; |
|
175 | + $credentials['password'] = defined( 'FTP_PASS' ) ? FTP_PASS : ''; |
|
176 | 176 | |
177 | 177 | // Check to see if we are setting the public/private keys for ssh |
178 | - $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : ''; |
|
179 | - $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : ''; |
|
178 | + $credentials['public_key'] = defined( 'FTP_PUBKEY' ) ? FTP_PUBKEY : ''; |
|
179 | + $credentials['private_key'] = defined( 'FTP_PRIKEY' ) ? FTP_PRIKEY : ''; |
|
180 | 180 | |
181 | 181 | // Sanitize the hostname, Some people might pass in odd-data: |
182 | 182 | $credentials['hostname'] = preg_replace( '|\w+://|', '', $credentials['hostname'] ); //Strip any schemes off |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | function load_formidable_forms() { |
26 | 26 | global $frm_vars; |
27 | 27 | $frm_vars = array( |
28 | - 'load_css' => false, 'forms_loaded' => array(), |
|
29 | - 'created_entries' => array(), |
|
30 | - 'pro_is_authorized' => false, |
|
28 | + 'load_css' => false, 'forms_loaded' => array(), |
|
29 | + 'created_entries' => array(), |
|
30 | + 'pro_is_authorized' => false, |
|
31 | 31 | ); |
32 | 32 | |
33 | 33 | require_once( dirname( __FILE__ ) . '/classes/controllers/FrmHooksController.php' ); |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | |
43 | 43 | // if __autoload is active, put it on the spl_autoload stack |
44 | 44 | if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) { |
45 | - spl_autoload_register('__autoload'); |
|
45 | + spl_autoload_register('__autoload'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | // Add the autoloader |
49 | 49 | spl_autoload_register('frm_forms_autoloader'); |
50 | 50 | |
51 | 51 | function frm_forms_autoloader( $class_name ) { |
52 | - // Only load Frm classes here |
|
52 | + // Only load Frm classes here |
|
53 | 53 | if ( ! preg_match( '/^Frm.+$/', $class_name ) || preg_match( '/^FrmPro.+$/', $class_name ) ) { |
54 | - return; |
|
55 | - } |
|
54 | + return; |
|
55 | + } |
|
56 | 56 | |
57 | 57 | FrmHooksController::autoloader( $class_name, dirname( __FILE__ ) ); |
58 | 58 | } |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | |
33 | 33 | require_once( dirname( __FILE__ ) . '/classes/controllers/FrmHooksController.php' ); |
34 | 34 | |
35 | - $frm_path = dirname(__FILE__); |
|
36 | - if ( file_exists($frm_path . '/pro/formidable-pro.php') ) { |
|
35 | + $frm_path = dirname( __FILE__ ); |
|
36 | + if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) { |
|
37 | 37 | include( $frm_path . '/pro/formidable-pro.php' ); |
38 | 38 | } |
39 | 39 | |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | |
43 | 43 | // if __autoload is active, put it on the spl_autoload stack |
44 | 44 | if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) { |
45 | - spl_autoload_register('__autoload'); |
|
45 | + spl_autoload_register( '__autoload' ); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | // Add the autoloader |
49 | -spl_autoload_register('frm_forms_autoloader'); |
|
49 | +spl_autoload_register( 'frm_forms_autoloader' ); |
|
50 | 50 | |
51 | 51 | function frm_forms_autoloader( $class_name ) { |
52 | 52 | // Only load Frm classes here |
@@ -37,7 +37,7 @@ |
||
37 | 37 | ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
38 | 38 | } |
39 | 39 | |
40 | - ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php |
|
40 | + ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action( 'frm_field_input_html', $field ) ?> /><?php |
|
41 | 41 | |
42 | 42 | if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) { |
43 | 43 | echo ' ' . $opt . '</label>'; |
@@ -18,14 +18,14 @@ |
||
18 | 18 | if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) { |
19 | 19 | ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
20 | 20 | } |
21 | - $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' '; |
|
21 | + $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' '; |
|
22 | 22 | |
23 | 23 | $other_opt = false; |
24 | 24 | $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked ); |
25 | 25 | ?> |
26 | 26 | <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php |
27 | 27 | echo $checked; |
28 | - do_action('frm_field_input_html', $field); |
|
28 | + do_action( 'frm_field_input_html', $field ); |
|
29 | 29 | ?>/><?php |
30 | 30 | |
31 | 31 | if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) { |
@@ -3,7 +3,7 @@ |
||
3 | 3 | if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
4 | 4 | do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) ); |
5 | 5 | } else { |
6 | - do_action( 'frm_add_multiple_opts_labels', $field ); ?> |
|
6 | + do_action( 'frm_add_multiple_opts_labels', $field ); ?> |
|
7 | 7 | <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts frm_clear<?php echo ( count( $field['options'] ) > 10 ) ? ' frm_field_opts_list' : ''; ?>"> |
8 | 8 | <?php FrmFieldsHelper::show_single_option( $field ); ?> |
9 | 9 | </ul> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( isset($field['post_field']) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) { |
|
3 | +if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) { |
|
4 | 4 | echo FrmProPost::get_category_dropdown( $field, array( 'name' => $field_name, 'id' => 'placeholder_id', 'location' => 'form_builder' ) ); |
5 | 5 | } else { ?> |
6 | 6 | <select id="frm_dropdown_<?php echo esc_attr( $field['id'] ) ?>" |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | <?php |
28 | 28 | |
29 | 29 | if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) { ?> |
30 | - <?php do_action('frm_add_multiple_opts_labels', $field); ?> |
|
31 | - <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts<?php echo ( count($field['options']) > 10 ) ? ' frm_field_opts_list' : ''; ?>"> |
|
32 | - <?php FrmFieldsHelper::show_single_option($field); ?> |
|
30 | + <?php do_action( 'frm_add_multiple_opts_labels', $field ); ?> |
|
31 | + <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts<?php echo ( count( $field['options'] ) > 10 ) ? ' frm_field_opts_list' : ''; ?>"> |
|
32 | + <?php FrmFieldsHelper::show_single_option( $field ); ?> |
|
33 | 33 | </ul> |
34 | 34 | <?php |
35 | 35 | } ?> |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | $frm_settings = FrmAppHelper::get_settings(); |
3 | 3 | if ( empty( $frm_settings->pubkey ) ) { ?> |
4 | - <div class="howto frm_no_captcha_text"><?php printf(__( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Secret Keys', 'formidable' ), '<a href="?page=formidable-settings">', '</a>') ?></div> |
|
4 | + <div class="howto frm_no_captcha_text"><?php printf( __( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Secret Keys', 'formidable' ), '<a href="?page=formidable-settings">', '</a>' ) ?></div> |
|
5 | 5 | <?php |
6 | 6 | } ?> |
7 | 7 | <img src="<?php echo esc_url( FrmAppHelper::plugin_url() . '/images/recaptcha.png' ) ?>" class="recaptcha_placeholder" alt="reCaptcha"/> |