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 -357 6.35.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,43 +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( '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 - * @param string $replace_with
781 - * @return string
782 - */
783 - private static function atts_sanitize( $replace_with ) {
784 - return sanitize_title_with_dashes( $replace_with );
785 - }
786 -
787 - /**
788 - * @param string $replace_with
789 - * @return string
790 - */
791 - private static function atts_sanitize_url( $replace_with ) {
792 - return urlencode( $replace_with );
793 - }
794 -
795 - /**
796 736 * Prevent shortcodes in fields from being processed
797 737 *
798 738 * @since 3.01.02
799 739 *
@@ -875,11 +815,11 @@
875 815 if ( empty( $field ) ) {
876 816 return null;
877 817 }
878 818
879 - if ( isset( $atts['show'] ) && $atts['show'] === 'field_label' ) {
819 + if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) {
880 820 $replace_with = $field->name;
881 - } elseif ( isset( $atts['show'] ) && $atts['show'] === 'description' ) {
821 + } elseif ( isset( $atts['show'] ) && $atts['show'] == 'description' ) {
882 822 $replace_with = $field->description;
883 823 } else {
884 824 $replace_with = FrmEntryMeta::get_meta_value( $atts['entry'], $field->id );
885 825 $string_value = $replace_with;
@@ -1041,9 +981,9 @@
1041 981 } elseif ( isset( $field_selection[ $type ] ) ) {
1042 982 $field_types[ $type ] = $field_selection[ $type ];
1043 983 }
1044 984
1045 - $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' ) );
1046 986
1047 987 return $field_types;
1048 988 }
1049 989
@@ -1119,26 +1059,24 @@
1119 1059 }
1120 1060
1121 1061 // Check posted vals before checking saved values
1122 1062 // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
1123 - 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'] ] ) ) {
1124 1064 if ( FrmField::is_field_with_multiple_values( $field ) ) {
1125 - // phpcs:ignore WordPress.Security.NonceVerification.Missing
1126 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 ] ) ) : '';
1127 1066 } else {
1128 - $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'] ] ) );
1129 1068 }
1130 1069
1131 1070 return $other_val;
1132 1071
1133 - } 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'] ] ) ) {
1134 1073 // For normal fields
1135 1074
1136 1075 if ( FrmField::is_field_with_multiple_values( $field ) ) {
1137 - // phpcs:ignore WordPress.Security.NonceVerification.Missing
1138 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 ] ) ) : '';
1139 1077 } else {
1140 - $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'] ] ) );
1141 1079 }
1142 1080
1143 1081 return $other_val;
1144 1082 }
@@ -1143,9 +1081,9 @@
1143 1081 return $other_val;
1144 1082 }
1145 1083
1146 1084 // For checkboxes
1147 - if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) {
1085 + if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) {
1148 1086 // Check if there is an "other" val in saved value and make sure the
1149 1087 // "other" val is not equal to the Other checkbox option
1150 1088 if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
1151 1089 $other_val = $field['value'][ $opt_key ];
@@ -1339,24 +1277,16 @@
1339 1277 $replace[] = '[if ' . $old . ' ';
1340 1278 $replace_with[] = '[if ' . $new . ' ';
1341 1279 $replace[] = '[/if ' . $old . ']';
1342 1280 $replace_with[] = '[/if ' . $new . ']';
1343 - $replace[] = '[\/if ' . $old . ']';
1344 - $replace_with[] = '[\/if ' . $new . ']';
1345 1281 $replace[] = '[foreach ' . $old . ']';
1346 1282 $replace_with[] = '[foreach ' . $new . ']';
1347 1283 $replace[] = '[/foreach ' . $old . ']';
1348 1284 $replace_with[] = '[/foreach ' . $new . ']';
1349 - $replace[] = '[\/foreach ' . $old . ']';
1350 - $replace_with[] = '[\/foreach ' . $new . ']';
1351 1285 $replace[] = '[' . $old . ']';
1352 1286 $replace_with[] = '[' . $new . ']';
1353 1287 $replace[] = '[' . $old . ' ';
1354 1288 $replace_with[] = '[' . $new . ' ';
1355 - $replace[] = 'field_id="' . $old . '"';
1356 - $replace_with[] = 'field_id="' . $new . '"';
1357 - $replace[] = 'field_id=\"' . $old . '\"';
1358 - $replace_with[] = 'field_id=\"' . $new . '\"';
1359 1289 unset( $old, $new );
1360 1290 }
1361 1291 if ( is_array( $val ) ) {
1362 1292 foreach ( $val as $k => $v ) {
@@ -1376,9 +1306,9 @@
1376 1306 * @since 4.0
1377 1307 */
1378 1308 public static function bulk_options_overlay() {
1379 1309 $prepop = array();
1380 - self::get_bulk_prefilled_opts( $prepop, true );
1310 + self::get_bulk_prefilled_opts( $prepop );
1381 1311
1382 1312 include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/bulk-options-overlay.php' );
1383 1313 }
1384 1314
@@ -1698,47 +1628,22 @@
1698 1628 sort( $countries, SORT_LOCALE_STRING );
1699 1629 return apply_filters( 'frm_countries', $countries );
1700 1630 }
1701 1631
1702 - /**
1703 - * Gets bulk prefilled options.
1704 - *
1705 - * @since 5.0.04 Add `$include_class` param.
1706 - *
1707 - * @param array $prepop Bulk options.
1708 - * @param array|false $include_class Include the class in the bulk options.
1709 - */
1710 - public static function get_bulk_prefilled_opts( array &$prepop, $include_class = false ) {
1711 - // Countries.
1712 - $countries = self::get_countries();
1713 - if ( $include_class ) {
1714 - $countries['class'] = 'frm-countries-opts';
1715 - }
1632 + public static function get_bulk_prefilled_opts( array &$prepop ) {
1633 + $prepop[ __( 'Countries', 'formidable' ) ] = self::get_countries();
1716 1634
1717 - $prepop[ __( 'Countries', 'formidable' ) ] = $countries;
1718 -
1719 - // State abv.
1720 1635 $states = self::get_us_states();
1721 1636 $state_abv = array_keys( $states );
1722 1637 sort( $state_abv );
1723 - if ( $include_class ) {
1724 - $state_abv['class'] = 'frm-state-abv-opts';
1725 - }
1726 -
1727 1638 $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1728 1639
1729 - // States.
1730 1640 $states = array_values( $states );
1731 1641 sort( $states );
1732 - if ( $include_class ) {
1733 - $states['class'] = 'frm-states-opts';
1734 - }
1735 -
1736 1642 $prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1737 1643 unset( $state_abv, $states );
1738 1644
1739 - // Age.
1740 - $ages = array(
1645 + $prepop[ __( 'Age', 'formidable' ) ] = array(
1741 1646 __( 'Under 18', 'formidable' ),
1742 1647 __( '18-24', 'formidable' ),
1743 1648 __( '25-34', 'formidable' ),
1744 1649 __( '35-44', 'formidable' ),
@@ -1746,74 +1651,36 @@
1746 1651 __( '55-64', 'formidable' ),
1747 1652 __( '65 or Above', 'formidable' ),
1748 1653 __( 'Prefer Not to Answer', 'formidable' ),
1749 1654 );
1750 - if ( $include_class ) {
1751 - $ages['class'] = 'frm-age-opts';
1752 - }
1753 1655
1754 - $prepop[ __( 'Age', 'formidable' ) ] = $ages;
1755 -
1756 - // Satisfaction.
1757 - $satisfaction = array(
1656 + $prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1657 + __( 'Very Satisfied', 'formidable' ),
1658 + __( 'Satisfied', 'formidable' ),
1659 + __( 'Neutral', 'formidable' ),
1660 + __( 'Unsatisfied', 'formidable' ),
1758 1661 __( 'Very Unsatisfied', 'formidable' ),
1759 - __( 'Unsatisfied', 'formidable' ),
1760 - __( 'Neutral', 'formidable' ),
1761 - __( 'Satisfied', 'formidable' ),
1762 - __( 'Very Satisfied', 'formidable' ),
1763 1662 __( 'N/A', 'formidable' ),
1764 1663 );
1765 - if ( $include_class ) {
1766 - $satisfaction['class'] = 'frm-satisfaction-opts';
1767 - }
1768 1664
1769 - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction;
1770 -
1771 - // Importance.
1772 - $importance = array(
1665 + $prepop[ __( 'Importance', 'formidable' ) ] = array(
1666 + __( 'Very Important', 'formidable' ),
1667 + __( 'Important', 'formidable' ),
1668 + __( 'Neutral', 'formidable' ),
1669 + __( 'Somewhat Important', 'formidable' ),
1773 1670 __( 'Not at all Important', 'formidable' ),
1774 - __( 'Somewhat Important', 'formidable' ),
1775 - __( 'Neutral', 'formidable' ),
1776 - __( 'Important', 'formidable' ),
1777 - __( 'Very Important', 'formidable' ),
1778 1671 __( 'N/A', 'formidable' ),
1779 1672 );
1780 - if ( $include_class ) {
1781 - $importance['class'] = 'frm-importance-opts';
1782 - }
1783 1673
1784 - $prepop[ __( 'Importance', 'formidable' ) ] = $importance;
1785 -
1786 - // Agreement.
1787 - $agreement = array(
1788 - __( 'Strongly Disagree', 'formidable' ),
1789 - __( 'Disagree', 'formidable' ),
1790 - __( 'Neutral', 'formidable' ),
1674 + $prepop[ __( 'Agreement', 'formidable' ) ] = array(
1675 + __( 'Strongly Agree', 'formidable' ),
1791 1676 __( 'Agree', 'formidable' ),
1792 - __( 'Strongly Agree', 'formidable' ),
1793 - __( 'N/A', 'formidable' ),
1794 - );
1795 - if ( $include_class ) {
1796 - $agreement['class'] = 'frm-agreement-opts';
1797 - }
1798 -
1799 - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement;
1800 -
1801 - // Likely.
1802 - $likely = array(
1803 - __( 'Extremely Unlikely', 'formidable' ),
1804 - __( 'Unlikely', 'formidable' ),
1805 1677 __( 'Neutral', 'formidable' ),
1806 - __( 'Likely', 'formidable' ),
1807 - __( 'Extremely Likely', 'formidable' ),
1678 + __( 'Disagree', 'formidable' ),
1679 + __( 'Strongly Disagree', 'formidable' ),
1808 1680 __( 'N/A', 'formidable' ),
1809 1681 );
1810 - if ( $include_class ) {
1811 - $likely['class'] = 'frm-likely-opts';
1812 - }
1813 1682
1814 - $prepop[ __( 'Likely', 'formidable' ) ] = $likely;
1815 -
1816 1683 $prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1817 1684 }
1818 1685
1819 1686 /**
@@ -1847,11 +1714,9 @@
1847 1714 }
1848 1715
1849 1716 /**
1850 1717 * @since 4.04
1851 - *
1852 1718 * @param array $args
1853 - * @return void
1854 1719 */
1855 1720 public static function show_add_field_buttons( $args ) {
1856 1721 $field_key = $args['field_key'];
1857 1722 $field_type = $args['field_type'];
@@ -1893,29 +1758,15 @@
1893 1758 $upgrade_message = FrmAppHelper::kses( $field_type['message'], array( 'a', 'img' ) );
1894 1759 }
1895 1760 }
1896 1761
1897 - $li_params = array(
1898 - 'class' => 'frmbutton frm6 ' . $args['no_allow_class'] . $single_no_allow . ' frm_t' . str_replace( '|', '-', $field_key ),
1899 - 'id' => $field_key,
1900 - 'data-upgrade' => $upgrade_label,
1901 - 'data-link' => $link,
1902 - 'data-medium' => 'builder',
1903 - 'data-oneclick' => $install_data,
1904 - 'data-content' => $field_key,
1905 - 'data-requires' => $requires,
1906 - );
1907 -
1908 - if ( $upgrade_message ) {
1909 - $li_params['data-message'] = $upgrade_message;
1910 - }
1911 1762 ?>
1912 - <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 ); ?>">
1913 1764 <?php
1914 1765 if ( $run_filter ) {
1915 1766 $field_label = apply_filters( 'frmpro_field_links', $field_label, $args['id'], $field_key );
1916 1767 }
1917 - 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.
1918 1769 ?>
1919 1770 </li>
1920 1771 <?php
1921 1772 }
@@ -1920,157 +1771,8 @@
1920 1771 <?php
1921 1772 }
1922 1773
1923 1774 /**
1924 - * Shows Display format option.
1925 - *
1926 - * @since 5.0.04
1927 - *
1928 - * @param array $field Field data.
1929 - */
1930 - public static function show_radio_display_format( $field ) {
1931 - $options = array(
1932 - '0' => array(
1933 - 'text' => __( 'Simple', 'formidable' ),
1934 - 'svg' => 'frm_simple_radio',
1935 - ),
1936 - '1' => array(
1937 - 'text' => __( 'Images', 'formidable' ),
1938 - 'svg' => 'frm_image_as_option',
1939 - 'addon' => 'pro',
1940 - 'upgrade' => __( 'Image Options', 'formidable' ),
1941 - '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" />',
1942 - 'content' => 'image-options',
1943 - ),
1944 - 'buttons' => array(
1945 - 'text' => __( 'Buttons', 'formidable' ),
1946 - 'svg' => 'frm_button_as_option',
1947 - 'addon' => 'surveys',
1948 - 'upgrade' => __( 'Button Options', 'formidable' ),
1949 - 'message' => __( 'Show buttons for radio buttons or check boxes. This is ideal for polls, surveys, segmenting questionnaires and more.', 'formidable' ),
1950 - 'content' => 'button-options',
1951 - ),
1952 - );
1953 -
1954 - /**
1955 - * Allows modifying the options of Display format setting of Radio field.
1956 - *
1957 - * @since 5.0.04
1958 - *
1959 - * @param array $options Options.
1960 - */
1961 - $options = apply_filters( 'frm_radio_display_format_options', $options );
1962 -
1963 - $args = self::get_display_format_args( $field, $options );
1964 -
1965 - include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/radio-display-format.php';
1966 - }
1967 -
1968 - /**
1969 - * Gets display format arguments to pass to the images_dropdown() method.
1970 - *
1971 - * @since 5.0.04
1972 - *
1973 - * @param array $field Field data.
1974 - * @param array $options Options array.
1975 - * @return array
1976 - */
1977 - private static function get_display_format_args( $field, $options ) {
1978 - $args = array(
1979 - 'selected' => '0',
1980 - 'options' => array(),
1981 - 'name' => 'field_options[image_options_' . $field['id'] . ']',
1982 - 'input_attrs' => array(
1983 - 'class' => 'frm_toggle_image_options',
1984 - ),
1985 - );
1986 -
1987 - self::fill_image_setting_options( $options, $args );
1988 -
1989 - /**
1990 - * Allows modifying the arguments of Display format setting of Radio field.
1991 - *
1992 - * @since 5.0.04
1993 - *
1994 - * @param array $args Arguments.
1995 - * @param array $method_args The arguments from the method. Contains `field`, `options`.
1996 - */
1997 - return apply_filters( 'frm_radio_display_format_args', $args, compact( 'field', 'options' ) );
1998 - }
1999 -
2000 - /**
2001 - * @since 5.0.04
2002 - */
2003 - private static function fill_image_setting_options( $options, &$args ) {
2004 - foreach ( $options as $key => $option ) {
2005 - $args['options'][ $key ] = $option;
2006 -
2007 - if ( ! empty( $option['addon'] ) ) {
2008 - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option );
2009 - }
2010 -
2011 - unset( $args['options'][ $key ]['addon'] );
2012 - $fill = array( 'upgrade', 'message', 'content' );
2013 - foreach ( $fill as $f ) {
2014 - unset( $args['options'][ $key ][ $f ], $f );
2015 - }
2016 - }
2017 - }
2018 -
2019 - /**
2020 - * @since 5.0.04
2021 - *
2022 - * @return array
2023 - */
2024 - private static function fill_image_setting_addon_link( $option ) {
2025 - $custom_attrs = array(
2026 - 'class' => 'frm_noallow frm_show_upgrade',
2027 - 'data-medium' => 'builder',
2028 - );
2029 -
2030 - // translators: Add-on name.
2031 - $custom_attrs['data-upgrade'] = sprintf( __( 'Formidable %s', 'formidable' ), ucwords( $option['addon'] ) );
2032 -
2033 - $fill = array( 'upgrade', 'message', 'content' );
2034 - foreach ( $fill as $f ) {
2035 - if ( isset( $option[ $f ] ) ) {
2036 - $custom_attrs[ 'data-' . $f ] = $option[ $f ];
2037 - }
2038 - }
2039 -
2040 - if ( 'pro' === $option['addon'] ) {
2041 - return $custom_attrs;
2042 - }
2043 -
2044 - $upgrading = FrmAddonsController::install_link( $option['addon'] );
2045 - if ( isset( $upgrading['url'] ) ) {
2046 - $install_data = wp_json_encode( $upgrading );
2047 - } else {
2048 - $install_data = '';
2049 - }
2050 -
2051 - $custom_attrs['data-oneclick'] = $install_data;
2052 - $custom_attrs['data-requires'] = FrmFormsHelper::get_plan_required( $upgrading );
2053 -
2054 - return $custom_attrs;
2055 - }
2056 -
2057 - /**
2058 - * Maybe adjust a field value based on type.
2059 - * Some types require unserializing an array (@see self::field_type_requires_unserialize).
2060 - *
2061 - * @since 6.2
2062 - *
2063 - * @param mixed $value
2064 - * @param string $field_type
2065 - * @return void
2066 - */
2067 - public static function prepare_field_value( &$value, $field_type ) {
2068 - $field_object = FrmFieldFactory::get_field_type( $field_type );
2069 - $value = $field_object->maybe_decode_value( $value );
2070 - }
2071 -
2072 - /**
2073 1775 * @deprecated 4.0
2074 1776 */
2075 1777 public static function show_icon_link_js( $atts ) {
2076 1778 _deprecated_function( __METHOD__, '4.0' );
@@ -2129,13 +1831,13 @@
2129 1831 /**
2130 1832 * @deprecated 3.0
2131 1833 * @codeCoverageIgnore
2132 1834 *
2133 - * @param string $html
2134 - * @param array $field
2135 - * @param array $errors
2136 - * @param object|false $form
2137 - * @param array $args
1835 + * @param string $html
1836 + * @param array $field
1837 + * @param array $errors
1838 + * @param object $form
1839 + * @param array $args
2138 1840 *
2139 1841 * @return string
2140 1842 */
2141 1843 public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) {
@@ -2150,13 +1852,10 @@
2150 1852 return FrmDeprecated::get_default_field_opts( $type, $field, $limit );
2151 1853 }
2152 1854
2153 1855 /**
2154 - * @deprecated 2.02.07 This is still referenced in the Highrise add on as of v1.06.
1856 + * @deprecated 2.02.07
2155 1857 * @codeCoverageIgnore
2156 - *
2157 - * @param array $args
2158 - * @return string
2159 1858 */
2160 1859 public static function dropdown_categories( $args ) {
2161 1860 return FrmDeprecated::dropdown_categories( $args );
2162 1861 }