| @@ -13,14 +13,9 @@ | ||
| 13 | 13 | |
| 14 | 14 | $values = self::get_default_field( $type ); |
| 15 | 15 | |
| 16 | 16 | global $wpdb; |
| 17 | - $field_count = FrmDb::get_var( | |
| 18 | - 'frm_fields', | |
| 19 | - array( 'form_id' => $form_id ), | |
| 20 | - 'field_order', | |
| 21 | - array( 'order_by' => 'field_order DESC' ) | |
| 22 | - ); | |
| 17 | + $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) ); | |
| 23 | 18 | |
| 24 | 19 | $values['field_key'] = FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_fields', 'field_key' ); |
| 25 | 20 | $values['form_id'] = $form_id; |
| 26 | 21 | $values['field_order'] = $field_count + 1; |
| @@ -26,10 +21,10 @@ | ||
| 26 | 21 | $values['field_order'] = $field_count + 1; |
| 27 | 22 | |
| 28 | 23 | $values['field_options']['custom_html'] = self::get_default_html( $type ); |
| 29 | 24 | |
| 30 | - if ( ! empty( $setting ) ) { | |
| 31 | - if ( in_array( $type, array( 'data', 'lookup' ), true ) ) { | |
| 25 | + if ( isset( $setting ) && ! empty( $setting ) ) { | |
| 26 | + if ( in_array( $type, array( 'data', 'lookup' ) ) ) { | |
| 32 | 27 | $values['field_options']['data_type'] = $setting; |
| 33 | 28 | } else { |
| 34 | 29 | $values['field_options'][ $setting ] = 1; |
| 35 | 30 | } |
| @@ -163,9 +158,9 @@ | ||
| 163 | 158 | if ( '' == $field_array['blank'] && '1' === $field_array['required'] ) { |
| 164 | 159 | $field_array['blank'] = $frm_settings->blank_msg; |
| 165 | 160 | } |
| 166 | 161 | |
| 167 | - if ( '' === $field_array['invalid'] ) { | |
| 162 | + if ( '' == $field_array['invalid'] ) { | |
| 168 | 163 | if ( 'captcha' === $field->type ) { |
| 169 | 164 | $field_array['invalid'] = $frm_settings->re_msg; |
| 170 | 165 | } else { |
| 171 | 166 | /* translators: %s: Field name */ |
| @@ -496,14 +491,9 @@ | ||
| 496 | 491 | return FrmFieldsController::check_label( $opt ); |
| 497 | 492 | } |
| 498 | 493 | |
| 499 | 494 | /** |
| 500 | - * Shows the inline modal. | |
| 501 | - * | |
| 502 | 495 | * @since 4.0 |
| 503 | - * @since 6.4.1 Added `inside_class` in the arguments. | |
| 504 | - * | |
| 505 | - * @param array $args The arguments. | |
| 506 | 496 | */ |
| 507 | 497 | public static function inline_modal( $args ) { |
| 508 | 498 | $defaults = array( |
| 509 | 499 | 'id' => '', |
| @@ -511,9 +501,8 @@ | ||
| 511 | 501 | 'show' => 0, |
| 512 | 502 | 'callback' => array(), |
| 513 | 503 | 'args' => array(), |
| 514 | 504 | 'title' => '', |
| 515 | - 'inside_class' => 'inside', | |
| 516 | 505 | ); |
| 517 | 506 | $args = array_merge( $defaults, $args ); |
| 518 | 507 | |
| 519 | 508 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/inline-modal.php' ); |
| @@ -770,18 +759,13 @@ | ||
| 770 | 759 | |
| 771 | 760 | /** |
| 772 | 761 | * @param string $replace_with |
| 773 | 762 | * @param array $atts |
| 774 | - * @return string | |
| 775 | 763 | */ |
| 776 | 764 | private static function trigger_shortcode_atts( $replace_with, $atts ) { |
| 777 | - $supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' ); | |
| 765 | + $supported_atts = array( 'sanitize', 'sanitize_url' ); | |
| 778 | 766 | $included_atts = array_intersect( $supported_atts, array_keys( $atts ) ); |
| 779 | 767 | foreach ( $included_atts as $included_att ) { |
| 780 | - if ( '0' === $atts[ $included_att ] ) { | |
| 781 | - // Skip any option that uses 0 so sanitize_url=0 does not encode. | |
| 782 | - continue; | |
| 783 | - } | |
| 784 | 768 | $function = 'atts_' . $included_att; |
| 785 | 769 | $replace_with = self::$function( $replace_with, $atts ); |
| 786 | 770 | } |
| 787 | 771 | return $replace_with; |
| @@ -787,21 +771,8 @@ | ||
| 787 | 771 | return $replace_with; |
| 788 | 772 | } |
| 789 | 773 | |
| 790 | 774 | /** |
| 791 | - * Converts all accent characters to ASCII characters. | |
| 792 | - * | |
| 793 | - * @since 6.3.1 | |
| 794 | - * | |
| 795 | - * @param string $replace_with The text to remove accents from. | |
| 796 | - * | |
| 797 | - * @return string | |
| 798 | - */ | |
| 799 | - public static function atts_remove_accents( $replace_with ) { | |
| 800 | - return remove_accents( $replace_with ); | |
| 801 | - } | |
| 802 | - | |
| 803 | - /** | |
| 804 | 775 | * @param string $replace_with |
| 805 | 776 | * @return string |
| 806 | 777 | */ |
| 807 | 778 | private static function atts_sanitize( $replace_with ) { |
| @@ -853,15 +824,15 @@ | ||
| 853 | 824 | if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
| 854 | 825 | $replace_with = $shortcode_values[ $atts['tag'] ]; |
| 855 | 826 | } elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
| 856 | 827 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
| 857 | - } elseif ( $clean_tag === 'user_agent' ) { | |
| 828 | + } elseif ( $clean_tag == 'user_agent' ) { | |
| 858 | 829 | $description = $atts['entry']->description; |
| 859 | 830 | $replace_with = FrmEntriesHelper::get_browser( $description['browser'] ); |
| 860 | - } elseif ( $clean_tag === 'created_at' || $clean_tag === 'updated_at' ) { | |
| 831 | + } elseif ( $clean_tag == 'created_at' || $clean_tag == 'updated_at' ) { | |
| 861 | 832 | $atts['tag'] = $clean_tag; |
| 862 | 833 | $replace_with = self::get_entry_timestamp( $atts ); |
| 863 | - } elseif ( $clean_tag === 'created_by' || $clean_tag === 'updated_by' ) { | |
| 834 | + } elseif ( $clean_tag == 'created_by' || $clean_tag == 'updated_by' ) { | |
| 864 | 835 | $replace_with = self::get_display_value( $atts['entry']->{$clean_tag}, (object) array( 'type' => 'user_id' ), $atts ); |
| 865 | 836 | } else { |
| 866 | 837 | $replace_with = self::get_field_shortcode_value( $atts ); |
| 867 | 838 | } |
| @@ -1871,11 +1842,9 @@ | ||
| 1871 | 1842 | } |
| 1872 | 1843 | |
| 1873 | 1844 | /** |
| 1874 | 1845 | * @since 4.04 |
| 1875 | - * | |
| 1876 | 1846 | * @param array $args |
| 1877 | - * @return void | |
| 1878 | 1847 | */ |
| 1879 | 1848 | public static function show_add_field_buttons( $args ) { |
| 1880 | 1849 | $field_key = $args['field_key']; |
| 1881 | 1850 | $field_type = $args['field_type']; |
| @@ -1951,25 +1920,8 @@ | ||
| 1951 | 1920 | * |
| 1952 | 1921 | * @param array $field Field data. |
| 1953 | 1922 | */ |
| 1954 | 1923 | public static function show_radio_display_format( $field ) { |
| 1955 | - $options = self::get_display_format_options( $field ); | |
| 1956 | - | |
| 1957 | - $args = self::get_display_format_args( $field, $options ); | |
| 1958 | - | |
| 1959 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/radio-display-format.php'; | |
| 1960 | - } | |
| 1961 | - | |
| 1962 | - /** | |
| 1963 | - * Creates an array that contains variables used for display format options setting. | |
| 1964 | - * | |
| 1965 | - * @since 6.3.2 | |
| 1966 | - * | |
| 1967 | - * @param array $field The field. | |
| 1968 | - * | |
| 1969 | - * @return array | |
| 1970 | - */ | |
| 1971 | - public static function get_display_format_options( $field ) { | |
| 1972 | 1924 | $options = array( |
| 1973 | 1925 | '0' => array( |
| 1974 | 1926 | 'text' => __( 'Simple', 'formidable' ), |
| 1975 | 1927 | 'svg' => 'frm_simple_radio', |
| @@ -1997,13 +1949,14 @@ | ||
| 1997 | 1949 | * |
| 1998 | 1950 | * @since 5.0.04 |
| 1999 | 1951 | * |
| 2000 | 1952 | * @param array $options Options. |
| 2001 | - * @param array $field | |
| 2002 | 1953 | */ |
| 2003 | - $options = apply_filters( 'frm_' . $field['type'] . '_display_format_options', $options, $field ); | |
| 1954 | + $options = apply_filters( 'frm_radio_display_format_options', $options ); | |
| 2004 | 1955 | |
| 2005 | - return $options; | |
| 1956 | + $args = self::get_display_format_args( $field, $options ); | |
| 1957 | + | |
| 1958 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/radio-display-format.php'; | |
| 2006 | 1959 | } |
| 2007 | 1960 | |
| 2008 | 1961 | /** |
| 2009 | 1962 | * Gets display format arguments to pass to the images_dropdown() method. |
| @@ -2013,9 +1966,9 @@ | ||
| 2013 | 1966 | * @param array $field Field data. |
| 2014 | 1967 | * @param array $options Options array. |
| 2015 | 1968 | * @return array |
| 2016 | 1969 | */ |
| 2017 | - public static function get_display_format_args( $field, $options ) { | |
| 1970 | + private static function get_display_format_args( $field, $options ) { | |
| 2018 | 1971 | $args = array( |
| 2019 | 1972 | 'selected' => '0', |
| 2020 | 1973 | 'options' => array(), |
| 2021 | 1974 | 'name' => 'field_options[image_options_' . $field['id'] . ']', |
| @@ -2033,9 +1986,9 @@ | ||
| 2033 | 1986 | * |
| 2034 | 1987 | * @param array $args Arguments. |
| 2035 | 1988 | * @param array $method_args The arguments from the method. Contains `field`, `options`. |
| 2036 | 1989 | */ |
| 2037 | - return apply_filters( 'frm_' . $field['type'] . '_display_format_args', $args, compact( 'field', 'options' ) ); | |
| 1990 | + return apply_filters( 'frm_radio_display_format_args', $args, compact( 'field', 'options' ) ); | |
| 2038 | 1991 | } |
| 2039 | 1992 | |
| 2040 | 1993 | /** |
| 2041 | 1994 | * @since 5.0.04 |
| @@ -2094,23 +2047,8 @@ | ||
| 2094 | 2047 | return $custom_attrs; |
| 2095 | 2048 | } |
| 2096 | 2049 | |
| 2097 | 2050 | /** |
| 2098 | - * Maybe adjust a field value based on type. | |
| 2099 | - * Some types require unserializing an array (@see self::field_type_requires_unserialize). | |
| 2100 | - * | |
| 2101 | - * @since 6.2 | |
| 2102 | - * | |
| 2103 | - * @param mixed $value | |
| 2104 | - * @param string $field_type | |
| 2105 | - * @return void | |
| 2106 | - */ | |
| 2107 | - public static function prepare_field_value( &$value, $field_type ) { | |
| 2108 | - $field_object = FrmFieldFactory::get_field_type( $field_type ); | |
| 2109 | - $value = $field_object->maybe_decode_value( $value ); | |
| 2110 | - } | |
| 2111 | - | |
| 2112 | - /** | |
| 2113 | 2051 | * @deprecated 4.0 |
| 2114 | 2052 | */ |
| 2115 | 2053 | public static function show_icon_link_js( $atts ) { |
| 2116 | 2054 | _deprecated_function( __METHOD__, '4.0' ); |
| @@ -2190,13 +2128,10 @@ | ||
| 2190 | 2128 | return FrmDeprecated::get_default_field_opts( $type, $field, $limit ); |
| 2191 | 2129 | } |
| 2192 | 2130 | |
| 2193 | 2131 | /** |
| 2194 | - * @deprecated 2.02.07 This is still referenced in the Highrise add on as of v1.06. | |
| 2132 | + * @deprecated 2.02.07 | |
| 2195 | 2133 | * @codeCoverageIgnore |
| 2196 | - * | |
| 2197 | - * @param array $args | |
| 2198 | - * @return string | |
| 2199 | 2134 | */ |
| 2200 | 2135 | public static function dropdown_categories( $args ) { |
| 2201 | 2136 | return FrmDeprecated::dropdown_categories( $args ); |
| 2202 | 2137 | } |