PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/helpers/FrmFieldsHelper.php +56 -386 6.45.0 View file →
@@ -123,9 +123,9 @@
123 123 * @param object $field
124 124 * @param array $values
125 125 */
126 126 private static function fill_default_field_opts( $field, array &$values ) {
127 - $check_post = FrmAppHelper::is_admin_page() && $_POST && isset( $_POST['field_options'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
127 + $check_post = FrmAppHelper::is_admin_page() && $_POST && isset( $_POST['field_options'] );
128 128
129 129 $defaults = self::get_default_field_options_from_field( $field, $values );
130 130 if ( ! $check_post ) {
131 131 $defaults['required_indicator'] = '';
@@ -158,9 +158,9 @@
158 158 if ( '' == $field_array['blank'] && '1' === $field_array['required'] ) {
159 159 $field_array['blank'] = $frm_settings->blank_msg;
160 160 }
161 161
162 - if ( '' === $field_array['invalid'] ) {
162 + if ( '' == $field_array['invalid'] ) {
163 163 if ( 'captcha' === $field->type ) {
164 164 $field_array['invalid'] = $frm_settings->re_msg;
165 165 } else {
166 166 /* translators: %s: Field name */
@@ -179,20 +179,22 @@
179 179 * @param string $setting
180 180 * @param mixed $value
181 181 */
182 182 private static function get_posted_field_setting( $setting, &$value ) {
183 - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
183 + if ( ! isset( $_POST['field_options'][ $setting ] ) ) {
184 184 return;
185 185 }
186 186
187 187 if ( strpos( $setting, 'html' ) !== false ) {
188 188 // Strip slashes from HTML but not regex or script tags.
189 - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
189 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
190 + $value = wp_unslash( $_POST['field_options'][ $setting ] );
190 191 } elseif ( strpos( $setting, 'format_' ) === 0 ) {
191 192 // TODO: Remove stripslashes on output, and use on input only.
192 - $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing
193 + $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // WPCS: sanitization ok.
193 194 } else {
194 - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
195 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
196 + $value = wp_unslash( $_POST['field_options'][ $setting ] );
195 197 FrmAppHelper::sanitize_value( 'wp_kses_post', $value );
196 198 }
197 199 }
198 200
@@ -568,37 +570,27 @@
568 570 return self::array_value_condition( $observed_value, $cond, $hide_opt );
569 571 }
570 572
571 573 $m = false;
572 - if ( $cond === '==' ) {
574 + if ( $cond == '==' ) {
573 575 $m = $observed_value == $hide_opt;
574 - } elseif ( $cond === '!=' ) {
576 + } elseif ( $cond == '!=' ) {
575 577 $m = $observed_value != $hide_opt;
576 - } elseif ( $cond === '>' ) {
578 + } elseif ( $cond == '>' ) {
577 579 $m = $observed_value > $hide_opt;
578 - } elseif ( $cond === '>=' ) {
580 + } elseif ( $cond == '>=' ) {
579 581 $m = $observed_value >= $hide_opt;
580 - } elseif ( $cond === '<' ) {
582 + } elseif ( $cond == '<' ) {
581 583 $m = $observed_value < $hide_opt;
582 - } elseif ( $cond === '<=' ) {
584 + } elseif ( $cond == '<=' ) {
583 585 $m = $observed_value <= $hide_opt;
584 - } elseif ( $cond === 'LIKE' || $cond === 'not LIKE' ) {
586 + } elseif ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
585 587 $m = stripos( $observed_value, $hide_opt );
586 - if ( $cond === 'not LIKE' ) {
588 + if ( $cond == 'not LIKE' ) {
587 589 $m = ( $m === false ) ? true : false;
588 590 } else {
589 591 $m = ( $m === false ) ? false : true;
590 592 }
591 - } elseif ( $cond === '%LIKE' ) {
592 - // ends with
593 - $length = strlen( $hide_opt );
594 - $substr = substr( $observed_value, strlen( $observed_value ) - $length );
595 - $m = 0 === strcasecmp( $substr, $hide_opt );
596 - } elseif ( 'LIKE%' === $cond ) {
597 - // starts with
598 - $length = strlen( $hide_opt );
599 - $substr = substr( $observed_value, 0, $length );
600 - $m = 0 === strcasecmp( $substr, $hide_opt );
601 593 }
602 594
603 595 return $m;
604 596 }
@@ -620,9 +612,9 @@
620 612 }
621 613
622 614 public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
623 615 $m = false;
624 - if ( $cond === '==' ) {
616 + if ( $cond == '==' ) {
625 617 if ( is_array( $hide_opt ) ) {
626 618 $m = array_intersect( $hide_opt, $observed_value );
627 619 $m = empty( $m ) ? false : true;
628 620 } else {
@@ -627,17 +619,17 @@
627 619 $m = empty( $m ) ? false : true;
628 620 } else {
629 621 $m = in_array( $hide_opt, $observed_value );
630 622 }
631 - } elseif ( $cond === '!=' ) {
623 + } elseif ( $cond == '!=' ) {
632 624 $m = ! in_array( $hide_opt, $observed_value );
633 - } elseif ( $cond === '>' ) {
625 + } elseif ( $cond == '>' ) {
634 626 $min = min( $observed_value );
635 627 $m = $min > $hide_opt;
636 - } elseif ( $cond === '<' ) {
628 + } elseif ( $cond == '<' ) {
637 629 $max = max( $observed_value );
638 630 $m = $max < $hide_opt;
639 - } elseif ( $cond === 'LIKE' || $cond === 'not LIKE' ) {
631 + } elseif ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
640 632 foreach ( $observed_value as $ob ) {
641 633 $m = strpos( $ob, $hide_opt );
642 634 if ( $m !== false ) {
643 635 $m = true;
@@ -644,27 +636,11 @@
644 636 break;
645 637 }
646 638 }
647 639
648 - if ( $cond === 'not LIKE' ) {
640 + if ( $cond == 'not LIKE' ) {
649 641 $m = ( $m === false ) ? true : false;
650 642 }
651 - } elseif ( $cond === '%LIKE' ) {
652 - // ends with
653 - foreach ( $observed_value as $ob ) {
654 - if ( $hide_opt === substr( $ob, strlen( $ob ) - strlen( $hide_opt ) ) ) {
655 - $m = true;
656 - break;
657 - }
658 - }
659 - } elseif ( $cond === 'LIKE%' ) {
660 - // starts with
661 - foreach ( $observed_value as $ob ) {
662 - if ( $hide_opt === substr( $ob, 0, strlen( $hide_opt ) ) ) {
663 - $m = true;
664 - break;
665 - }
666 - }
667 643 }
668 644
669 645 return $m;
670 646 }
@@ -745,9 +721,8 @@
745 721 $atts['tag'] = $tag;
746 722 $replace_with = self::get_value_for_shortcode( $atts );
747 723
748 724 if ( $replace_with !== null ) {
749 - $replace_with = self::trigger_shortcode_atts( $replace_with, $atts );
750 725 self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with );
751 726 $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
752 727 }
753 728
@@ -757,56 +732,8 @@
757 732 return $content;
758 733 }
759 734
760 735 /**
761 - * @param string $replace_with
762 - * @param array $atts
763 - * @return string
764 - */
765 - private static function trigger_shortcode_atts( $replace_with, $atts ) {
766 - $supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' );
767 - $included_atts = array_intersect( $supported_atts, array_keys( $atts ) );
768 - foreach ( $included_atts as $included_att ) {
769 - if ( '0' === $atts[ $included_att ] ) {
770 - // Skip any option that uses 0 so sanitize_url=0 does not encode.
771 - continue;
772 - }
773 - $function = 'atts_' . $included_att;
774 - $replace_with = self::$function( $replace_with, $atts );
775 - }
776 - return $replace_with;
777 - }
778 -
779 - /**
780 - * Converts all accent characters to ASCII characters.
781 - *
782 - * @since 6.3.1
783 - *
784 - * @param string $replace_with The text to remove accents from.
785 - *
786 - * @return string
787 - */
788 - public static function atts_remove_accents( $replace_with ) {
789 - return remove_accents( $replace_with );
790 - }
791 -
792 - /**
793 - * @param string $replace_with
794 - * @return string
795 - */
796 - private static function atts_sanitize( $replace_with ) {
797 - return sanitize_title_with_dashes( $replace_with );
798 - }
799 -
800 - /**
801 - * @param string $replace_with
802 - * @return string
803 - */
804 - private static function atts_sanitize_url( $replace_with ) {
805 - return urlencode( $replace_with );
806 - }
807 -
808 - /**
809 736 * Prevent shortcodes in fields from being processed
810 737 *
811 738 * @since 3.01.02
812 739 *
@@ -888,11 +815,11 @@
888 815 if ( empty( $field ) ) {
889 816 return null;
890 817 }
891 818
892 - if ( isset( $atts['show'] ) && $atts['show'] === 'field_label' ) {
819 + if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) {
893 820 $replace_with = $field->name;
894 - } elseif ( isset( $atts['show'] ) && $atts['show'] === 'description' ) {
821 + } elseif ( isset( $atts['show'] ) && $atts['show'] == 'description' ) {
895 822 $replace_with = $field->description;
896 823 } else {
897 824 $replace_with = FrmEntryMeta::get_meta_value( $atts['entry'], $field->id );
898 825 $string_value = $replace_with;
@@ -1054,9 +981,9 @@
1054 981 } elseif ( isset( $field_selection[ $type ] ) ) {
1055 982 $field_types[ $type ] = $field_selection[ $type ];
1056 983 }
1057 984
1058 - $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) );
985 + $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
1059 986
1060 987 return $field_types;
1061 988 }
1062 989
@@ -1132,26 +1059,24 @@
1132 1059 }
1133 1060
1134 1061 // Check posted vals before checking saved values
1135 1062 // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
1136 - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1063 + if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
1137 1064 if ( FrmField::is_field_with_multiple_values( $field ) ) {
1138 - // phpcs:ignore WordPress.Security.NonceVerification.Missing
1139 1065 $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : '';
1140 1066 } else {
1141 - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1067 + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) );
1142 1068 }
1143 1069
1144 1070 return $other_val;
1145 1071
1146 - } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1072 + } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
1147 1073 // For normal fields
1148 1074
1149 1075 if ( FrmField::is_field_with_multiple_values( $field ) ) {
1150 - // phpcs:ignore WordPress.Security.NonceVerification.Missing
1151 1076 $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : '';
1152 1077 } else {
1153 - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1078 + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) );
1154 1079 }
1155 1080
1156 1081 return $other_val;
1157 1082 }
@@ -1156,9 +1081,9 @@
1156 1081 return $other_val;
1157 1082 }
1158 1083
1159 1084 // For checkboxes
1160 - if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) {
1085 + if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) {
1161 1086 // Check if there is an "other" val in saved value and make sure the
1162 1087 // "other" val is not equal to the Other checkbox option
1163 1088 if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
1164 1089 $other_val = $field['value'][ $opt_key ];
@@ -1352,24 +1277,16 @@
1352 1277 $replace[] = '[if ' . $old . ' ';
1353 1278 $replace_with[] = '[if ' . $new . ' ';
1354 1279 $replace[] = '[/if ' . $old . ']';
1355 1280 $replace_with[] = '[/if ' . $new . ']';
1356 - $replace[] = '[\/if ' . $old . ']';
1357 - $replace_with[] = '[\/if ' . $new . ']';
1358 1281 $replace[] = '[foreach ' . $old . ']';
1359 1282 $replace_with[] = '[foreach ' . $new . ']';
1360 1283 $replace[] = '[/foreach ' . $old . ']';
1361 1284 $replace_with[] = '[/foreach ' . $new . ']';
1362 - $replace[] = '[\/foreach ' . $old . ']';
1363 - $replace_with[] = '[\/foreach ' . $new . ']';
1364 1285 $replace[] = '[' . $old . ']';
1365 1286 $replace_with[] = '[' . $new . ']';
1366 1287 $replace[] = '[' . $old . ' ';
1367 1288 $replace_with[] = '[' . $new . ' ';
1368 - $replace[] = 'field_id="' . $old . '"';
1369 - $replace_with[] = 'field_id="' . $new . '"';
1370 - $replace[] = 'field_id=\"' . $old . '\"';
1371 - $replace_with[] = 'field_id=\"' . $new . '\"';
1372 1289 unset( $old, $new );
1373 1290 }
1374 1291 if ( is_array( $val ) ) {
1375 1292 foreach ( $val as $k => $v ) {
@@ -1389,9 +1306,9 @@
1389 1306 * @since 4.0
1390 1307 */
1391 1308 public static function bulk_options_overlay() {
1392 1309 $prepop = array();
1393 - self::get_bulk_prefilled_opts( $prepop, true );
1310 + self::get_bulk_prefilled_opts( $prepop );
1394 1311
1395 1312 include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/bulk-options-overlay.php' );
1396 1313 }
1397 1314
@@ -1711,47 +1628,22 @@
1711 1628 sort( $countries, SORT_LOCALE_STRING );
1712 1629 return apply_filters( 'frm_countries', $countries );
1713 1630 }
1714 1631
1715 - /**
1716 - * Gets bulk prefilled options.
1717 - *
1718 - * @since 5.0.04 Add `$include_class` param.
1719 - *
1720 - * @param array $prepop Bulk options.
1721 - * @param array|false $include_class Include the class in the bulk options.
1722 - */
1723 - public static function get_bulk_prefilled_opts( array &$prepop, $include_class = false ) {
1724 - // Countries.
1725 - $countries = self::get_countries();
1726 - if ( $include_class ) {
1727 - $countries['class'] = 'frm-countries-opts';
1728 - }
1632 + public static function get_bulk_prefilled_opts( array &$prepop ) {
1633 + $prepop[ __( 'Countries', 'formidable' ) ] = self::get_countries();
1729 1634
1730 - $prepop[ __( 'Countries', 'formidable' ) ] = $countries;
1731 -
1732 - // State abv.
1733 1635 $states = self::get_us_states();
1734 1636 $state_abv = array_keys( $states );
1735 1637 sort( $state_abv );
1736 - if ( $include_class ) {
1737 - $state_abv['class'] = 'frm-state-abv-opts';
1738 - }
1739 -
1740 1638 $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1741 1639
1742 - // States.
1743 1640 $states = array_values( $states );
1744 1641 sort( $states );
1745 - if ( $include_class ) {
1746 - $states['class'] = 'frm-states-opts';
1747 - }
1748 -
1749 1642 $prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1750 1643 unset( $state_abv, $states );
1751 1644
1752 - // Age.
1753 - $ages = array(
1645 + $prepop[ __( 'Age', 'formidable' ) ] = array(
1754 1646 __( 'Under 18', 'formidable' ),
1755 1647 __( '18-24', 'formidable' ),
1756 1648 __( '25-34', 'formidable' ),
1757 1649 __( '35-44', 'formidable' ),
@@ -1759,74 +1651,36 @@
1759 1651 __( '55-64', 'formidable' ),
1760 1652 __( '65 or Above', 'formidable' ),
1761 1653 __( 'Prefer Not to Answer', 'formidable' ),
1762 1654 );
1763 - if ( $include_class ) {
1764 - $ages['class'] = 'frm-age-opts';
1765 - }
1766 1655
1767 - $prepop[ __( 'Age', 'formidable' ) ] = $ages;
1768 -
1769 - // Satisfaction.
1770 - $satisfaction = array(
1656 + $prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1657 + __( 'Very Satisfied', 'formidable' ),
1658 + __( 'Satisfied', 'formidable' ),
1659 + __( 'Neutral', 'formidable' ),
1660 + __( 'Unsatisfied', 'formidable' ),
1771 1661 __( 'Very Unsatisfied', 'formidable' ),
1772 - __( 'Unsatisfied', 'formidable' ),
1773 - __( 'Neutral', 'formidable' ),
1774 - __( 'Satisfied', 'formidable' ),
1775 - __( 'Very Satisfied', 'formidable' ),
1776 1662 __( 'N/A', 'formidable' ),
1777 1663 );
1778 - if ( $include_class ) {
1779 - $satisfaction['class'] = 'frm-satisfaction-opts';
1780 - }
1781 1664
1782 - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction;
1783 -
1784 - // Importance.
1785 - $importance = array(
1665 + $prepop[ __( 'Importance', 'formidable' ) ] = array(
1666 + __( 'Very Important', 'formidable' ),
1667 + __( 'Important', 'formidable' ),
1668 + __( 'Neutral', 'formidable' ),
1669 + __( 'Somewhat Important', 'formidable' ),
1786 1670 __( 'Not at all Important', 'formidable' ),
1787 - __( 'Somewhat Important', 'formidable' ),
1788 - __( 'Neutral', 'formidable' ),
1789 - __( 'Important', 'formidable' ),
1790 - __( 'Very Important', 'formidable' ),
1791 1671 __( 'N/A', 'formidable' ),
1792 1672 );
1793 - if ( $include_class ) {
1794 - $importance['class'] = 'frm-importance-opts';
1795 - }
1796 1673
1797 - $prepop[ __( 'Importance', 'formidable' ) ] = $importance;
1798 -
1799 - // Agreement.
1800 - $agreement = array(
1801 - __( 'Strongly Disagree', 'formidable' ),
1802 - __( 'Disagree', 'formidable' ),
1803 - __( 'Neutral', 'formidable' ),
1674 + $prepop[ __( 'Agreement', 'formidable' ) ] = array(
1675 + __( 'Strongly Agree', 'formidable' ),
1804 1676 __( 'Agree', 'formidable' ),
1805 - __( 'Strongly Agree', 'formidable' ),
1806 - __( 'N/A', 'formidable' ),
1807 - );
1808 - if ( $include_class ) {
1809 - $agreement['class'] = 'frm-agreement-opts';
1810 - }
1811 -
1812 - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement;
1813 -
1814 - // Likely.
1815 - $likely = array(
1816 - __( 'Extremely Unlikely', 'formidable' ),
1817 - __( 'Unlikely', 'formidable' ),
1818 1677 __( 'Neutral', 'formidable' ),
1819 - __( 'Likely', 'formidable' ),
1820 - __( 'Extremely Likely', 'formidable' ),
1678 + __( 'Disagree', 'formidable' ),
1679 + __( 'Strongly Disagree', 'formidable' ),
1821 1680 __( 'N/A', 'formidable' ),
1822 1681 );
1823 - if ( $include_class ) {
1824 - $likely['class'] = 'frm-likely-opts';
1825 - }
1826 1682
1827 - $prepop[ __( 'Likely', 'formidable' ) ] = $likely;
1828 -
1829 1683 $prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1830 1684 }
1831 1685
1832 1686 /**
@@ -1860,11 +1714,9 @@
1860 1714 }
1861 1715
1862 1716 /**
1863 1717 * @since 4.04
1864 - *
1865 1718 * @param array $args
1866 - * @return void
1867 1719 */
1868 1720 public static function show_add_field_buttons( $args ) {
1869 1721 $field_key = $args['field_key'];
1870 1722 $field_type = $args['field_type'];
@@ -1906,29 +1758,15 @@
1906 1758 $upgrade_message = FrmAppHelper::kses( $field_type['message'], array( 'a', 'img' ) );
1907 1759 }
1908 1760 }
1909 1761
1910 - $li_params = array(
1911 - 'class' => 'frmbutton frm6 ' . $args['no_allow_class'] . $single_no_allow . ' frm_t' . str_replace( '|', '-', $field_key ),
1912 - 'id' => $field_key,
1913 - 'data-upgrade' => $upgrade_label,
1914 - 'data-link' => $link,
1915 - 'data-medium' => 'builder',
1916 - 'data-oneclick' => $install_data,
1917 - 'data-content' => $field_key,
1918 - 'data-requires' => $requires,
1919 - );
1920 -
1921 - if ( $upgrade_message ) {
1922 - $li_params['data-message'] = $upgrade_message;
1923 - }
1924 1762 ?>
1925 - <li <?php FrmAppHelper::array_to_html_params( $li_params, true ); ?>>
1763 + <li class="frmbutton <?php echo esc_attr( $args['no_allow_class'] . $single_no_allow . ' frm_t' . str_replace( '|', '-', $field_key ) ); ?>" id="<?php echo esc_attr( $field_key ); ?>" data-upgrade="<?php echo esc_attr( $upgrade_label ); ?>" data-message="<?php echo esc_attr( $upgrade_message ); ?>" data-link="<?php echo esc_attr( $link ); ?>" data-medium="builder" data-oneclick="<?php echo esc_attr( $install_data ); ?>" data-content="<?php echo esc_attr( $field_key ); ?>" data-requires="<?php echo esc_attr( $requires ); ?>">
1926 1764 <?php
1927 1765 if ( $run_filter ) {
1928 1766 $field_label = apply_filters( 'frmpro_field_links', $field_label, $args['id'], $field_key );
1929 1767 }
1930 - echo FrmAppHelper::kses( $field_label, array( 'a', 'i', 'span', 'use', 'svg' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1768 + echo FrmAppHelper::kses( $field_label, array( 'a', 'i', 'span', 'use', 'svg' ) ); // WPCS: XSS ok.
1931 1769 ?>
1932 1770 </li>
1933 1771 <?php
1934 1772 }
@@ -1933,173 +1771,8 @@
1933 1771 <?php
1934 1772 }
1935 1773
1936 1774 /**
1937 - * Shows Display format option.
1938 - *
1939 - * @since 5.0.04
1940 - *
1941 - * @param array $field Field data.
1942 - */
1943 - public static function show_radio_display_format( $field ) {
1944 - $options = self::get_display_format_options( $field );
1945 -
1946 - $args = self::get_display_format_args( $field, $options );
1947 -
1948 - include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/radio-display-format.php';
1949 - }
1950 -
1951 - /**
1952 - * Creates an array that contains variables used for display format options setting.
1953 - *
1954 - * @since 6.3.2
1955 - *
1956 - * @param array $field The field.
1957 - *
1958 - * @return array
1959 - */
1960 - public static function get_display_format_options( $field ) {
1961 - $options = array(
1962 - '0' => array(
1963 - 'text' => __( 'Simple', 'formidable' ),
1964 - 'svg' => 'frm_simple_radio',
1965 - ),
1966 - '1' => array(
1967 - 'text' => __( 'Images', 'formidable' ),
1968 - 'svg' => 'frm_image_as_option',
1969 - 'addon' => 'pro',
1970 - 'upgrade' => __( 'Image Options', 'formidable' ),
1971 - 'message' => __( 'Show images instead of radio buttons or check boxes. This is ideal for polls, surveys, segmenting questionnaires and more.', 'formidable' ) . '<img src="' . esc_url( FrmAppHelper::plugin_url() ) . '/images/image-options.png" />',
1972 - 'content' => 'image-options',
1973 - ),
1974 - 'buttons' => array(
1975 - 'text' => __( 'Buttons', 'formidable' ),
1976 - 'svg' => 'frm_button_as_option',
1977 - 'addon' => 'surveys',
1978 - 'upgrade' => __( 'Button Options', 'formidable' ),
1979 - 'message' => __( 'Show buttons for radio buttons or check boxes. This is ideal for polls, surveys, segmenting questionnaires and more.', 'formidable' ),
1980 - 'content' => 'button-options',
1981 - ),
1982 - );
1983 -
1984 - /**
1985 - * Allows modifying the options of Display format setting of Radio field.
1986 - *
1987 - * @since 5.0.04
1988 - *
1989 - * @param array $options Options.
1990 - * @param array $field
1991 - */
1992 - $options = apply_filters( 'frm_' . $field['type'] . '_display_format_options', $options, $field );
1993 -
1994 - return $options;
1995 - }
1996 -
1997 - /**
1998 - * Gets display format arguments to pass to the images_dropdown() method.
1999 - *
2000 - * @since 5.0.04
2001 - *
2002 - * @param array $field Field data.
2003 - * @param array $options Options array.
2004 - * @return array
2005 - */
2006 - public static function get_display_format_args( $field, $options ) {
2007 - $args = array(
2008 - 'selected' => '0',
2009 - 'options' => array(),
2010 - 'name' => 'field_options[image_options_' . $field['id'] . ']',
2011 - 'input_attrs' => array(
2012 - 'class' => 'frm_toggle_image_options',
2013 - ),
2014 - );
2015 -
2016 - self::fill_image_setting_options( $options, $args );
2017 -
2018 - /**
2019 - * Allows modifying the arguments of Display format setting of Radio field.
2020 - *
2021 - * @since 5.0.04
2022 - *
2023 - * @param array $args Arguments.
2024 - * @param array $method_args The arguments from the method. Contains `field`, `options`.
2025 - */
2026 - return apply_filters( 'frm_' . $field['type'] . '_display_format_args', $args, compact( 'field', 'options' ) );
2027 - }
2028 -
2029 - /**
2030 - * @since 5.0.04
2031 - */
2032 - private static function fill_image_setting_options( $options, &$args ) {
2033 - foreach ( $options as $key => $option ) {
2034 - $args['options'][ $key ] = $option;
2035 -
2036 - if ( ! empty( $option['addon'] ) ) {
2037 - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option );
2038 - }
2039 -
2040 - unset( $args['options'][ $key ]['addon'] );
2041 - $fill = array( 'upgrade', 'message', 'content' );
2042 - foreach ( $fill as $f ) {
2043 - unset( $args['options'][ $key ][ $f ], $f );
2044 - }
2045 - }
2046 - }
2047 -
2048 - /**
2049 - * @since 5.0.04
2050 - *
2051 - * @return array
2052 - */
2053 - private static function fill_image_setting_addon_link( $option ) {
2054 - $custom_attrs = array(
2055 - 'class' => 'frm_noallow frm_show_upgrade',
2056 - 'data-medium' => 'builder',
2057 - );
2058 -
2059 - // translators: Add-on name.
2060 - $custom_attrs['data-upgrade'] = sprintf( __( 'Formidable %s', 'formidable' ), ucwords( $option['addon'] ) );
2061 -
2062 - $fill = array( 'upgrade', 'message', 'content' );
2063 - foreach ( $fill as $f ) {
2064 - if ( isset( $option[ $f ] ) ) {
2065 - $custom_attrs[ 'data-' . $f ] = $option[ $f ];
2066 - }
2067 - }
2068 -
2069 - if ( 'pro' === $option['addon'] ) {
2070 - return $custom_attrs;
2071 - }
2072 -
2073 - $upgrading = FrmAddonsController::install_link( $option['addon'] );
2074 - if ( isset( $upgrading['url'] ) ) {
2075 - $install_data = wp_json_encode( $upgrading );
2076 - } else {
2077 - $install_data = '';
2078 - }
2079 -
2080 - $custom_attrs['data-oneclick'] = $install_data;
2081 - $custom_attrs['data-requires'] = FrmFormsHelper::get_plan_required( $upgrading );
2082 -
2083 - return $custom_attrs;
2084 - }
2085 -
2086 - /**
2087 - * Maybe adjust a field value based on type.
2088 - * Some types require unserializing an array (@see self::field_type_requires_unserialize).
2089 - *
2090 - * @since 6.2
2091 - *
2092 - * @param mixed $value
2093 - * @param string $field_type
2094 - * @return void
2095 - */
2096 - public static function prepare_field_value( &$value, $field_type ) {
2097 - $field_object = FrmFieldFactory::get_field_type( $field_type );
2098 - $value = $field_object->maybe_decode_value( $value );
2099 - }
2100 -
2101 - /**
2102 1775 * @deprecated 4.0
2103 1776 */
2104 1777 public static function show_icon_link_js( $atts ) {
2105 1778 _deprecated_function( __METHOD__, '4.0' );
@@ -2158,13 +1831,13 @@
2158 1831 /**
2159 1832 * @deprecated 3.0
2160 1833 * @codeCoverageIgnore
2161 1834 *
2162 - * @param string $html
2163 - * @param array $field
2164 - * @param array $errors
2165 - * @param object|false $form
2166 - * @param array $args
1835 + * @param string $html
1836 + * @param array $field
1837 + * @param array $errors
1838 + * @param object $form
1839 + * @param array $args
2167 1840 *
2168 1841 * @return string
2169 1842 */
2170 1843 public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) {
@@ -2179,13 +1852,10 @@
2179 1852 return FrmDeprecated::get_default_field_opts( $type, $field, $limit );
2180 1853 }
2181 1854
2182 1855 /**
2183 - * @deprecated 2.02.07 This is still referenced in the Highrise add on as of v1.06.
1856 + * @deprecated 2.02.07
2184 1857 * @codeCoverageIgnore
2185 - *
2186 - * @param array $args
2187 - * @return string
2188 1858 */
2189 1859 public static function dropdown_categories( $args ) {
2190 1860 return FrmDeprecated::dropdown_categories( $args );
2191 1861 }