| @@ -8,74 +8,61 @@ | ||
| 8 | 8 | public static $use_cache = true; |
| 9 | 9 | public static $transient_size = 200; |
| 10 | 10 | |
| 11 | 11 | public static function field_selection() { |
| 12 | - $frm_settings = FrmAppHelper::get_settings(); | |
| 13 | - $active_captcha = $frm_settings->active_captcha; | |
| 14 | - if ( ! FrmFieldCaptcha::should_show_captcha() ) { | |
| 15 | - $captcha_name = 'Captcha'; | |
| 16 | - } elseif ( $active_captcha === 'recaptcha' ) { | |
| 17 | - $captcha_name = 'reCAPTCHA'; | |
| 18 | - } else { | |
| 19 | - $captcha_name = 'hCaptcha'; | |
| 20 | - } | |
| 21 | 12 | $fields = array( |
| 22 | - 'text' => array( | |
| 23 | - 'name' => __( 'Text', 'formidable' ), | |
| 24 | - 'icon' => 'frm_icon_font frm_text2_icon', | |
| 13 | + 'text' => array( | |
| 14 | + 'name' => __( 'Text', 'formidable' ), | |
| 15 | + 'icon' => 'frm_css_icon frm_text_icon', | |
| 25 | 16 | ), |
| 26 | - 'textarea' => array( | |
| 27 | - 'name' => __( 'Paragraph', 'formidable' ), | |
| 28 | - 'icon' => 'frm_icon_font frm_paragraph_icon', | |
| 17 | + 'textarea' => array( | |
| 18 | + 'name' => __( 'Paragraph', 'formidable' ), | |
| 19 | + 'icon' => 'frm_icon_font frm_paragraph_icon', | |
| 29 | 20 | ), |
| 30 | - 'checkbox' => array( | |
| 31 | - 'name' => __( 'Checkboxes', 'formidable' ), | |
| 32 | - 'icon' => 'frm_icon_font frm_check_square_icon', | |
| 21 | + 'checkbox' => array( | |
| 22 | + 'name' => __( 'Checkboxes', 'formidable' ), | |
| 23 | + 'icon' => 'frm_icon_font frm_check-square_icon', | |
| 33 | 24 | ), |
| 34 | - 'radio' => array( | |
| 35 | - 'name' => __( 'Radio Buttons', 'formidable' ), | |
| 36 | - 'icon' => 'frm_icon_font frm_radio_checked_icon', | |
| 25 | + 'radio' => array( | |
| 26 | + 'name' => __( 'Radio Button', 'formidable' ), | |
| 27 | + 'icon' => 'frm_icon_font frm_radio-checked_icon', | |
| 37 | 28 | ), |
| 38 | - 'select' => array( | |
| 39 | - 'name' => __( 'Dropdown', 'formidable' ), | |
| 40 | - 'icon' => 'frm_icon_font frm_caret_square_down_icon', | |
| 29 | + 'select' => array( | |
| 30 | + 'name' => __( 'Dropdown', 'formidable' ), | |
| 31 | + 'icon' => 'frm_icon_font frm_caret-square-down_icon', | |
| 41 | 32 | ), |
| 42 | - 'email' => array( | |
| 43 | - 'name' => __( 'Email', 'formidable' ), | |
| 44 | - 'icon' => 'frm_icon_font frm_email_icon', | |
| 33 | + 'email' => array( | |
| 34 | + 'name' => __( 'Email', 'formidable' ), | |
| 35 | + 'icon' => 'frm_icon_font frm_envelope_icon', | |
| 45 | 36 | ), |
| 46 | - 'url' => array( | |
| 47 | - 'name' => __( 'Website/URL', 'formidable' ), | |
| 48 | - 'icon' => 'frm_icon_font frm_link_icon', | |
| 37 | + 'url' => array( | |
| 38 | + 'name' => __( 'Website/URL', 'formidable' ), | |
| 39 | + 'icon' => 'dashicons dashicons-admin-links', | |
| 49 | 40 | ), |
| 50 | - 'number' => array( | |
| 51 | - 'name' => __( 'Number', 'formidable' ), | |
| 52 | - 'icon' => 'frm_icon_font frm_hashtag_icon', | |
| 41 | + 'number' => array( | |
| 42 | + 'name' => __( 'Number', 'formidable' ), | |
| 43 | + 'icon' => 'frm_css_icon frm_number_icon', | |
| 53 | 44 | ), |
| 54 | - 'name' => array( | |
| 55 | - 'name' => __( 'Name', 'formidable' ), | |
| 56 | - 'icon' => 'frm_icon_font frm_user_name_icon', | |
| 45 | + 'phone' => array( | |
| 46 | + 'name' => __( 'Phone', 'formidable' ), | |
| 47 | + 'icon' => 'frm_icon_font frm_phone_icon', | |
| 57 | 48 | ), |
| 58 | - 'phone' => array( | |
| 59 | - 'name' => __( 'Phone', 'formidable' ), | |
| 60 | - 'icon' => 'frm_icon_font frm_phone_icon', | |
| 49 | + 'html' => array( | |
| 50 | + 'name' => __( 'HTML', 'formidable' ), | |
| 51 | + 'icon' => 'frm_icon_font frm_embed2_icon', | |
| 61 | 52 | ), |
| 62 | - 'html' => array( | |
| 63 | - 'name' => __( 'HTML', 'formidable' ), | |
| 64 | - 'icon' => 'frm_icon_font frm_code_icon', | |
| 53 | + 'hidden' => array( | |
| 54 | + 'name' => __( 'Hidden Field', 'formidable' ), | |
| 55 | + 'icon' => 'frm_icon_font frm_eye-slash_icon', | |
| 65 | 56 | ), |
| 66 | - 'hidden' => array( | |
| 67 | - 'name' => __( 'Hidden', 'formidable' ), | |
| 68 | - 'icon' => 'frm_icon_font frm_eye_slash_icon', | |
| 57 | + 'user_id' => array( | |
| 58 | + 'name' => __( 'User ID', 'formidable' ), | |
| 59 | + 'icon' => 'frm_icon_font frm_user_icon', | |
| 69 | 60 | ), |
| 70 | - 'user_id' => array( | |
| 71 | - 'name' => __( 'User ID', 'formidable' ), | |
| 72 | - 'icon' => 'frm_icon_font frm_user_icon', | |
| 61 | + 'captcha' => array( | |
| 62 | + 'name' => __( 'reCAPTCHA', 'formidable' ), | |
| 63 | + 'icon' => 'frm_icon_font frm_shield-check_icon', | |
| 73 | 64 | ), |
| 74 | - 'captcha' => array( | |
| 75 | - 'name' => $captcha_name, | |
| 76 | - 'icon' => 'frm_icon_font frm_shield_check_icon', | |
| 77 | - ), | |
| 78 | 65 | ); |
| 79 | 66 | |
| 80 | 67 | return apply_filters( 'frm_available_fields', $fields ); |
| 81 | 68 | } |
| @@ -80,148 +67,98 @@ | ||
| 80 | 67 | return apply_filters( 'frm_available_fields', $fields ); |
| 81 | 68 | } |
| 82 | 69 | |
| 83 | 70 | public static function pro_field_selection() { |
| 84 | - $images_url = FrmAppHelper::plugin_url() . '/images/'; | |
| 85 | - $fields = array( | |
| 86 | - 'file' => array( | |
| 87 | - 'name' => __( 'File Upload', 'formidable' ), | |
| 88 | - 'icon' => 'frm_icon_font frm_upload_icon', | |
| 89 | - 'message' => 'Add file uploads to save time and cut down on back-and-forth. Upgrade to Pro to get Upload fields and more.', | |
| 71 | + $fields = array( | |
| 72 | + 'file' => array( | |
| 73 | + 'name' => __( 'File Upload', 'formidable' ), | |
| 74 | + 'icon' => 'frm_icon_font frm_upload2_icon', | |
| 90 | 75 | ), |
| 91 | - 'rte' => array( | |
| 92 | - 'name' => __( 'Rich Text', 'formidable' ), | |
| 93 | - 'icon' => 'frm_icon_font frm_align_right_icon', | |
| 76 | + 'rte' => array( | |
| 77 | + 'name' => __( 'Rich Text', 'formidable' ), | |
| 78 | + 'icon' => 'dashicons dashicons-editor-alignright', | |
| 94 | 79 | ), |
| 95 | - 'date' => array( | |
| 96 | - 'name' => __( 'Date', 'formidable' ), | |
| 97 | - 'icon' => 'frm_icon_font frm_calendar_icon', | |
| 80 | + 'date' => array( | |
| 81 | + 'name' => __( 'Date', 'formidable' ), | |
| 82 | + 'icon' => 'frm_icon_font frm_calendar_icon', | |
| 98 | 83 | ), |
| 99 | - 'time' => array( | |
| 100 | - 'name' => __( 'Time', 'formidable' ), | |
| 101 | - 'icon' => 'frm_icon_font frm_clock_icon', | |
| 84 | + 'time' => array( | |
| 85 | + 'name' => __( 'Time', 'formidable' ), | |
| 86 | + 'icon' => 'frm_icon_font frm_clock-o_icon', | |
| 102 | 87 | ), |
| 103 | - 'scale' => array( | |
| 104 | - 'name' => __( 'Scale', 'formidable' ), | |
| 105 | - 'icon' => 'frm_icon_font frm_linear_scale_icon', | |
| 106 | - 'message' => 'Add a set of radio buttons with whatever range you choose. <img src="' . esc_attr( $images_url ) . 'scale_field.png" alt="Scale Field" />', | |
| 88 | + 'scale' => array( | |
| 89 | + 'name' => __( 'Scale', 'formidable' ), | |
| 90 | + 'icon' => 'frm_icon_font frm_linear_scale_icon', | |
| 107 | 91 | ), |
| 108 | - 'star' => array( | |
| 109 | - 'name' => __( 'Star Rating', 'formidable' ), | |
| 110 | - 'icon' => 'frm_icon_font frm_star_icon', | |
| 92 | + 'star' => array( | |
| 93 | + 'name' => __( 'Star Rating', 'formidable' ), | |
| 94 | + 'icon' => 'frm_icon_font frm_star-full_icon', | |
| 111 | 95 | ), |
| 112 | - 'range' => array( | |
| 113 | - 'name' => __( 'Slider', 'formidable' ), | |
| 114 | - 'icon' => 'frm_icon_font frm_code_commit_icon', | |
| 96 | + 'range' => array( | |
| 97 | + 'name' => __( 'Slider', 'formidable' ), | |
| 98 | + 'icon' => 'frm_icon_font frm_sliders_icon', | |
| 115 | 99 | ), |
| 116 | - 'toggle' => array( | |
| 117 | - 'name' => __( 'Toggle', 'formidable' ), | |
| 118 | - 'icon' => 'frm_icon_font frm_toggle_on_icon', | |
| 100 | + 'toggle' => array( | |
| 101 | + 'name' => __( 'Toggle', 'formidable' ), | |
| 102 | + 'icon' => 'frm_icon_font frm_toggle-on_icon', | |
| 119 | 103 | ), |
| 120 | - 'data' => array( | |
| 121 | - 'name' => __( 'Dynamic', 'formidable' ), | |
| 122 | - 'icon' => 'frm_icon_font frm_sitemap_icon', | |
| 123 | - 'message' => 'Create relationships between multiple forms. You can link a member to a team, a rating to a product, a comment to a submission, and much more.', | |
| 104 | + 'data' => array( | |
| 105 | + 'name' => __( 'Dynamic', 'formidable' ), | |
| 106 | + 'icon' => 'frm_icon_font frm_sitemap_icon', | |
| 124 | 107 | ), |
| 125 | - 'lookup' => array( | |
| 126 | - 'name' => __( 'Lookup', 'formidable' ), | |
| 127 | - 'icon' => 'frm_icon_font frm_search_icon', | |
| 128 | - 'message' => 'Filter the options in the next field and automatically add values to other fields. Upgrade to Pro to get Lookup fields and more. <img src="' . esc_attr( $images_url ) . 'look-up_year-make-model.gif" alt="cascading lookup fields" />', | |
| 108 | + 'lookup' => array( | |
| 109 | + 'name' => __( 'Lookup', 'formidable' ), | |
| 110 | + 'icon' => 'frm_icon_font frm_search_icon', | |
| 129 | 111 | ), |
| 130 | 112 | 'divider|repeat' => array( |
| 131 | - 'name' => __( 'Repeater', 'formidable' ), | |
| 132 | - 'icon' => 'frm_icon_font frm_repeater_icon', | |
| 133 | - 'message' => 'Allow your visitors to add new sets of fields while filling out forms. Increase conversions while saving building time and server resources. <img src="' . esc_attr( $images_url ) . 'repeatable-section_frontend.gif" alt="Dynamically Add Form Fields with repeatable sections" />', | |
| 113 | + 'name' => __( 'Repeater', 'formidable' ), | |
| 114 | + 'icon' => 'frm_icon_font frm_repeat_icon', | |
| 134 | 115 | ), |
| 135 | - 'end_divider' => array( | |
| 136 | - 'name' => __( 'Section Buttons', 'formidable' ), | |
| 116 | + 'end_divider' => array( | |
| 117 | + 'name' => __( 'End Section', 'formidable' ), | |
| 137 | 118 | 'switch_from' => 'divider', |
| 138 | 119 | ), |
| 139 | - 'divider' => array( | |
| 140 | - 'name' => __( 'Section', 'formidable' ), | |
| 141 | - 'icon' => 'frm_icon_font frm_header_icon', | |
| 120 | + 'divider' => array( | |
| 121 | + 'name' => __( 'Section', 'formidable' ), | |
| 122 | + 'icon' => 'frm_css_icon frm_heading_icon', | |
| 142 | 123 | ), |
| 143 | - 'break' => array( | |
| 144 | - 'name' => __( 'Page Break', 'formidable' ), | |
| 145 | - 'icon' => 'frm_icon_font frm_page_break_icon', | |
| 146 | - 'message' => 'Get multi-paged forms with progress bars. Did you know you can upgrade to PRO to unlock multi-step forms with more awesome features?', | |
| 124 | + 'break' => array( | |
| 125 | + 'name' => __( 'Page Break', 'formidable' ), | |
| 126 | + 'icon' => 'frm_icon_font frm_page-break_icon', | |
| 147 | 127 | ), |
| 148 | - 'form' => array( | |
| 149 | - 'name' => __( 'Embed Form', 'formidable' ), | |
| 150 | - 'icon' => 'frm_icon_font frm_file_text_icon', | |
| 128 | + 'form' => array( | |
| 129 | + 'name' => __( 'Embed Form', 'formidable' ), | |
| 130 | + 'icon' => 'dashicons dashicons-editor-table', | |
| 151 | 131 | ), |
| 152 | - 'likert' => array( | |
| 153 | - 'name' => __( 'Likert Scale', 'formidable' ), | |
| 154 | - 'icon' => 'frm_icon_font frm_likert_scale frm_show_upgrade', | |
| 155 | - 'addon' => 'surveys', | |
| 132 | + 'password' => array( | |
| 133 | + 'name' => __( 'Password', 'formidable' ), | |
| 134 | + 'icon' => 'frm_icon_font frm_key_icon', | |
| 156 | 135 | ), |
| 157 | - 'nps' => array( | |
| 158 | - 'name' => __( 'NPS', 'formidable' ), | |
| 159 | - 'icon' => 'frm_icon_font frm_nps frm_show_upgrade', | |
| 160 | - 'addon' => 'surveys', | |
| 136 | + 'tag' => array( | |
| 137 | + 'name' => __( 'Tags', 'formidable' ), | |
| 138 | + 'icon' => 'frm_icon_font frm_price-tags_icon', | |
| 161 | 139 | ), |
| 162 | - 'password' => array( | |
| 163 | - 'name' => __( 'Password', 'formidable' ), | |
| 164 | - 'icon' => 'frm_icon_font frm_lock_open_icon', | |
| 165 | - ), | |
| 166 | - 'tag' => array( | |
| 167 | - 'name' => __( 'Tags', 'formidable' ), | |
| 168 | - 'icon' => 'frm_icon_font frm_price_tags_icon', | |
| 169 | - ), | |
| 170 | - 'credit_card' => array( | |
| 140 | + 'credit_card' => array( | |
| 171 | 141 | 'name' => __( 'Credit Card', 'formidable' ), |
| 172 | - 'icon' => 'frm_icon_font frm_credit_card_icon frm_show_upgrade', | |
| 142 | + 'icon' => 'frm_icon_font frm_credit-card-alt_icon frm_show_upgrade', | |
| 173 | 143 | 'addon' => 'stripe', |
| 174 | 144 | ), |
| 175 | - 'address' => array( | |
| 176 | - 'name' => __( 'Address', 'formidable' ), | |
| 177 | - 'icon' => 'frm_icon_font frm_location_icon', | |
| 145 | + 'address' => array( | |
| 146 | + 'name' => __( 'Address', 'formidable' ), | |
| 147 | + 'icon' => 'frm_icon_font frm_location_icon', | |
| 178 | 148 | ), |
| 179 | - 'summary' => array( | |
| 180 | - 'name' => __( 'Summary', 'formidable' ), | |
| 181 | - 'icon' => 'frm_icon_font frm_file_text_icon', | |
| 182 | - 'message' => 'Allow visitors to review their responses before a form is submitted. Upgrade to Pro to get Summary fields and more.', | |
| 183 | - ), | |
| 184 | 149 | 'signature' => array( |
| 185 | 150 | 'name' => __( 'Signature', 'formidable' ), |
| 186 | - 'icon' => 'frm_icon_font frm_signature_icon frm_show_upgrade', | |
| 151 | + 'icon' => 'frm_icon_font frm_pencil_icon frm_show_upgrade', | |
| 187 | 152 | 'addon' => 'signature', |
| 188 | 153 | ), |
| 189 | - 'ai' => array( | |
| 190 | - 'name' => __( 'AI', 'formidable' ), | |
| 191 | - 'icon' => 'frm_icon_font frm_eye_icon frm_show_upgrade', | |
| 192 | - 'addon' => 'ai', | |
| 193 | - 'message' => 'Streamline workflows and reclaim valuable time with the power of AI. You can effortlessly respond to your visitors in real-time with ChatGPT as your automated assistant. Upgrade to Pro and unlock AI-powered fields.', | |
| 154 | + 'quiz_score' => array( | |
| 155 | + 'name' => __( 'Quiz Score', 'formidable' ), | |
| 156 | + 'icon' => 'frm_icon_font frm_calculator_icon frm_show_upgrade', | |
| 157 | + 'addon' => 'quizzes', | |
| 194 | 158 | ), |
| 195 | - 'ssa-appointment' => array( | |
| 196 | - 'name' => __( 'Appointment', 'formidable' ), | |
| 197 | - 'icon' => 'frm_icon_font frm_calendar_icon frm_show_upgrade', | |
| 198 | - 'require' => 'Simply Schedule Appointments', | |
| 199 | - 'message' => 'Appointment fields are an integration with <a href="https://simplyscheduleappointments.com/meet/formidable/">Simply Schedule Appointments</a>. Get started now to schedule appointments directly from your forms. | |
| 200 | - <img src="' . esc_attr( $images_url ) . 'appointments.png" alt="Scheduling" />', | |
| 201 | - 'link' => 'https://simplyscheduleappointments.com/meet/formidable/', | |
| 202 | - ), | |
| 203 | - 'product' => array( | |
| 204 | - 'name' => __( 'Product', 'formidable' ), | |
| 205 | - 'icon' => 'frm_icon_font frm_product_icon', | |
| 206 | - 'section' => 'pricing', | |
| 207 | - ), | |
| 208 | - 'quantity' => array( | |
| 209 | - 'name' => __( 'Quantity', 'formidable' ), | |
| 210 | - 'icon' => 'frm_icon_font frm_quantity_icon', | |
| 211 | - 'section' => 'pricing', | |
| 212 | - ), | |
| 213 | - 'total' => array( | |
| 214 | - 'name' => __( 'Total', 'formidable' ), | |
| 215 | - 'icon' => 'frm_icon_font frm_total_icon', | |
| 216 | - 'section' => 'pricing', | |
| 217 | - ), | |
| 218 | 159 | ); |
| 219 | 160 | |
| 220 | - if ( ! FrmAppHelper::show_new_feature( 'ai' ) ) { | |
| 221 | - unset( $fields['ai'] ); | |
| 222 | - } | |
| 223 | - | |
| 224 | 161 | // Since the signature field may be in a different section, don't show it twice. |
| 225 | 162 | $lite_fields = self::field_selection(); |
| 226 | 163 | if ( isset( $lite_fields['signature'] ) ) { |
| 227 | 164 | unset( $fields['signature'] ); |
| @@ -229,56 +166,46 @@ | ||
| 229 | 166 | |
| 230 | 167 | return apply_filters( 'frm_pro_available_fields', $fields ); |
| 231 | 168 | } |
| 232 | 169 | |
| 233 | - /** | |
| 234 | - * @since 4.0 | |
| 235 | - */ | |
| 236 | - public static function all_field_selection() { | |
| 237 | - $pro_field_selection = self::pro_field_selection(); | |
| 238 | - return array_merge( $pro_field_selection, self::field_selection() ); | |
| 239 | - } | |
| 170 | + public static function create( $values, $return = true ) { | |
| 171 | + global $wpdb, $frm_duplicate_ids; | |
| 240 | 172 | |
| 241 | - public static function create( $values, $return = true ) { | |
| 242 | - global $wpdb, $frm_duplicate_ids; | |
| 243 | - | |
| 244 | - $new_values = array(); | |
| 245 | - $key = isset( $values['field_key'] ) ? $values['field_key'] : $values['name']; | |
| 173 | + $new_values = array(); | |
| 174 | + $key = isset( $values['field_key'] ) ? $values['field_key'] : $values['name']; | |
| 246 | 175 | $new_values['field_key'] = FrmAppHelper::get_unique_key( $key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
| 247 | 176 | |
| 248 | - $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); | |
| 249 | - | |
| 250 | 177 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 251 | 178 | $new_values[ $col ] = $values[ $col ]; |
| 252 | - } | |
| 179 | + } | |
| 253 | 180 | |
| 254 | - $new_values['options'] = self::maybe_filter_options( $values['options'] ); | |
| 255 | - $new_values['field_order'] = isset( $values['field_order'] ) ? (int) $values['field_order'] : null; | |
| 256 | - $new_values['required'] = isset( $values['required'] ) ? (int) $values['required'] : 0; | |
| 257 | - $new_values['form_id'] = isset( $values['form_id'] ) ? (int) $values['form_id'] : null; | |
| 258 | - $new_values['field_options'] = $values['field_options']; | |
| 259 | - $new_values['created_at'] = current_time( 'mysql', 1 ); | |
| 181 | + $new_values['options'] = $values['options']; | |
| 260 | 182 | |
| 183 | + $new_values['field_order'] = isset( $values['field_order'] ) ? (int) $values['field_order'] : null; | |
| 184 | + $new_values['required'] = isset( $values['required'] ) ? (int) $values['required'] : 0; | |
| 185 | + $new_values['form_id'] = isset( $values['form_id'] ) ? (int) $values['form_id'] : null; | |
| 186 | + $new_values['field_options'] = $values['field_options']; | |
| 187 | + $new_values['created_at'] = current_time( 'mysql', 1 ); | |
| 188 | + | |
| 261 | 189 | if ( isset( $values['id'] ) ) { |
| 262 | 190 | $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
| 263 | - $new_values = apply_filters( 'frm_duplicated_field', $new_values ); | |
| 264 | - } | |
| 191 | + $new_values = apply_filters( 'frm_duplicated_field', $new_values ); | |
| 192 | + } | |
| 265 | 193 | |
| 266 | 194 | self::preserve_format_option_backslashes( $new_values ); |
| 267 | 195 | |
| 268 | 196 | foreach ( $new_values as $k => $v ) { |
| 269 | - if ( is_array( $v ) ) { | |
| 270 | - if ( $k === 'default_value' ) { | |
| 271 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); | |
| 272 | - } else { | |
| 273 | - $new_values[ $k ] = serialize( $v ); | |
| 274 | - } | |
| 197 | + if ( is_array( $v ) ) { | |
| 198 | + $new_values[ $k ] = serialize( $v ); | |
| 275 | 199 | } |
| 276 | - unset( $k, $v ); | |
| 277 | - } | |
| 200 | + unset( $k, $v ); | |
| 201 | + } | |
| 278 | 202 | |
| 203 | + //if(isset($values['id']) and is_numeric($values['id'])) | |
| 204 | + // $new_values['id'] = $values['id']; | |
| 205 | + | |
| 279 | 206 | $query_results = $wpdb->insert( $wpdb->prefix . 'frm_fields', $new_values ); |
| 280 | - $new_id = 0; | |
| 207 | + $new_id = 0; | |
| 281 | 208 | if ( $query_results ) { |
| 282 | 209 | self::delete_form_transient( $new_values['form_id'] ); |
| 283 | 210 | $new_id = $wpdb->insert_id; |
| 284 | 211 | } |
| @@ -290,86 +217,34 @@ | ||
| 290 | 217 | if ( $query_results ) { |
| 291 | 218 | if ( isset( $values['id'] ) ) { |
| 292 | 219 | $frm_duplicate_ids[ $values['id'] ] = $new_id; |
| 293 | 220 | } |
| 294 | - | |
| 295 | 221 | return $new_id; |
| 296 | 222 | } else { |
| 297 | 223 | return false; |
| 298 | 224 | } |
| 299 | - } | |
| 225 | + } | |
| 300 | 226 | |
| 301 | - /** | |
| 302 | - * @since 5.0.08 | |
| 303 | - * | |
| 304 | - * @param array $options | |
| 305 | - * @return array | |
| 306 | - */ | |
| 307 | - private static function maybe_filter_options( $options ) { | |
| 308 | - return FrmAppHelper::maybe_filter_array( $options, array( 'custom_html' ) ); | |
| 309 | - } | |
| 227 | + public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { | |
| 228 | + global $frm_duplicate_ids; | |
| 310 | 229 | |
| 311 | - /** | |
| 312 | - * Process the field duplication. | |
| 313 | - * | |
| 314 | - * @since 5.0.05 | |
| 315 | - */ | |
| 316 | - public static function duplicate_single_field( $field_id, $form_id ) { | |
| 317 | - $copy_field = self::getOne( $field_id ); | |
| 318 | - if ( ! $copy_field ) { | |
| 319 | - return false; | |
| 320 | - } | |
| 321 | - | |
| 322 | - do_action( 'frm_duplicate_field', $copy_field, $form_id ); | |
| 323 | - do_action( 'frm_duplicate_field_' . $copy_field->type, $copy_field, $form_id ); | |
| 324 | - | |
| 325 | - $values = array( | |
| 326 | - 'id' => $copy_field->id, | |
| 327 | - ); | |
| 328 | - FrmFieldsHelper::fill_field( $values, $copy_field, $copy_field->form_id ); | |
| 329 | - $values = apply_filters( 'frm_prepare_single_field_for_duplication', $values ); | |
| 330 | - | |
| 331 | - $field_id = self::create( $values ); | |
| 332 | - | |
| 333 | - /** | |
| 334 | - * Fires after duplicating a field. | |
| 335 | - * | |
| 336 | - * @since 5.0.04 | |
| 337 | - * | |
| 338 | - * @param array $args { | |
| 339 | - * The arguments. | |
| 340 | - * | |
| 341 | - * @type int $field_id New field ID. | |
| 342 | - * @type array $values Values before inserting. | |
| 343 | - * @type object $copy_field Copy field data. | |
| 344 | - * @type int $form_id Form ID. | |
| 345 | - * } | |
| 346 | - */ | |
| 347 | - do_action( 'frm_after_duplicate_field', compact( 'field_id', 'values', 'copy_field', 'form_id' ) ); | |
| 348 | - | |
| 349 | - return compact( 'field_id', 'values' ); | |
| 350 | - } | |
| 351 | - | |
| 352 | - public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { | |
| 353 | - global $frm_duplicate_ids; | |
| 354 | - | |
| 355 | - $where = array( | |
| 230 | + $where = array( | |
| 356 | 231 | array( |
| 357 | - 'or' => 1, | |
| 358 | - 'fi.form_id' => $old_form_id, | |
| 232 | + 'or' => 1, | |
| 233 | + 'fi.form_id' => $old_form_id, | |
| 359 | 234 | 'fr.parent_form_id' => $old_form_id, |
| 360 | 235 | ), |
| 361 | 236 | ); |
| 362 | 237 | $fields = self::getAll( $where, 'field_order', '', $blog_id ); |
| 363 | 238 | |
| 364 | - foreach ( (array) $fields as $field ) { | |
| 239 | + foreach ( (array) $fields as $field ) { | |
| 365 | 240 | $new_key = $copy_keys ? $field->field_key : ''; |
| 366 | - if ( $copy_keys && substr( $field->field_key, - 1 ) == 2 ) { | |
| 241 | + if ( $copy_keys && substr( $field->field_key, -1 ) == 2 ) { | |
| 367 | 242 | $new_key = rtrim( $new_key, 2 ); |
| 368 | 243 | } |
| 369 | 244 | |
| 370 | - $values = array(); | |
| 371 | - FrmFieldsHelper::fill_field( $values, $field, $form_id, $new_key ); | |
| 245 | + $values = array(); | |
| 246 | + FrmFieldsHelper::fill_field( $values, $field, $form_id, $new_key ); | |
| 372 | 247 | |
| 373 | 248 | // If this is a repeating section, create new form |
| 374 | 249 | if ( self::is_repeating_field( $field ) ) { |
| 375 | 250 | // create the repeatable form |
| @@ -395,21 +270,20 @@ | ||
| 395 | 270 | } |
| 396 | 271 | |
| 397 | 272 | $values['description'] = FrmFieldsHelper::switch_field_ids( $values['description'] ); |
| 398 | 273 | |
| 399 | - $values = apply_filters( 'frm_duplicated_field', $values ); | |
| 400 | - $new_id = self::create( $values ); | |
| 401 | - $frm_duplicate_ids[ $field->id ] = $new_id; | |
| 274 | + $values = apply_filters( 'frm_duplicated_field', $values ); | |
| 275 | + $new_id = self::create( $values ); | |
| 276 | + $frm_duplicate_ids[ $field->id ] = $new_id; | |
| 402 | 277 | $frm_duplicate_ids[ $field->field_key ] = $new_id; |
| 403 | 278 | unset( $field ); |
| 404 | - } | |
| 405 | - } | |
| 279 | + } | |
| 280 | + } | |
| 406 | 281 | |
| 407 | 282 | public static function update( $id, $values ) { |
| 408 | - global $wpdb; | |
| 283 | + global $wpdb; | |
| 409 | 284 | |
| 410 | - $id = absint( $id ); | |
| 411 | - $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); | |
| 285 | + $id = absint( $id ); | |
| 412 | 286 | |
| 413 | 287 | if ( isset( $values['field_key'] ) ) { |
| 414 | 288 | $values['field_key'] = FrmAppHelper::get_unique_key( $values['field_key'], $wpdb->prefix . 'frm_fields', 'field_key', $id ); |
| 415 | 289 | } |
| @@ -414,10 +288,10 @@ | ||
| 414 | 288 | $values['field_key'] = FrmAppHelper::get_unique_key( $values['field_key'], $wpdb->prefix . 'frm_fields', 'field_key', $id ); |
| 415 | 289 | } |
| 416 | 290 | |
| 417 | 291 | if ( isset( $values['required'] ) ) { |
| 418 | - $values['required'] = (int) $values['required']; | |
| 419 | - } | |
| 292 | + $values['required'] = (int) $values['required']; | |
| 293 | + } | |
| 420 | 294 | |
| 421 | 295 | self::preserve_format_option_backslashes( $values ); |
| 422 | 296 | |
| 423 | 297 | if ( isset( $values['type'] ) ) { |
| @@ -422,9 +296,9 @@ | ||
| 422 | 296 | |
| 423 | 297 | if ( isset( $values['type'] ) ) { |
| 424 | 298 | $values = apply_filters( 'frm_clean_' . $values['type'] . '_field_options_before_update', $values ); |
| 425 | 299 | |
| 426 | - if ( $values['type'] === 'hidden' && isset( $values['field_options'] ) && isset( $values['field_options']['clear_on_focus'] ) ) { | |
| 300 | + if ( $values['type'] == 'hidden' && isset( $values['field_options'] ) && isset( $values['field_options']['clear_on_focus'] ) ) { | |
| 427 | 301 | // don't keep the old placeholder setting for hidden fields |
| 428 | 302 | $values['field_options']['clear_on_focus'] = 0; |
| 429 | 303 | } |
| 430 | 304 | } |
| @@ -429,51 +303,44 @@ | ||
| 429 | 303 | } |
| 430 | 304 | } |
| 431 | 305 | |
| 432 | 306 | // serialize array values |
| 433 | - foreach ( array( 'field_options', 'options' ) as $opt ) { | |
| 307 | + foreach ( array( 'default_value', 'field_options', 'options' ) as $opt ) { | |
| 434 | 308 | if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
| 435 | - if ( 'field_options' === $opt ) { | |
| 436 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); | |
| 437 | - } | |
| 438 | 309 | $values[ $opt ] = serialize( $values[ $opt ] ); |
| 439 | 310 | } |
| 440 | 311 | } |
| 441 | - if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { | |
| 442 | - $values['default_value'] = json_encode( $values['default_value'] ); | |
| 443 | - } | |
| 444 | 312 | |
| 445 | 313 | $query_results = $wpdb->update( $wpdb->prefix . 'frm_fields', $values, array( 'id' => $id ) ); |
| 446 | 314 | |
| 447 | - $form_id = 0; | |
| 315 | + $form_id = 0; | |
| 448 | 316 | if ( isset( $values['form_id'] ) ) { |
| 449 | - $form_id = absint( $values['form_id'] ); | |
| 317 | + $form_id = absint( $values['form_id'] ); | |
| 450 | 318 | } else { |
| 451 | 319 | $field = self::getOne( $id ); |
| 452 | - if ( $field ) { | |
| 453 | - $form_id = $field->form_id; | |
| 454 | - } | |
| 320 | + if ( $field ) { | |
| 321 | + $form_id = $field->form_id; | |
| 322 | + } | |
| 455 | 323 | unset( $field ); |
| 456 | - } | |
| 324 | + } | |
| 457 | 325 | unset( $values ); |
| 458 | 326 | |
| 459 | 327 | if ( $query_results ) { |
| 460 | - wp_cache_delete( $id, 'frm_field' ); | |
| 461 | - if ( $form_id ) { | |
| 462 | - self::delete_form_transient( $form_id ); | |
| 463 | - } | |
| 464 | - } | |
| 328 | + wp_cache_delete( $id, 'frm_field' ); | |
| 329 | + if ( $form_id ) { | |
| 330 | + self::delete_form_transient( $form_id ); | |
| 331 | + } | |
| 332 | + } | |
| 465 | 333 | |
| 466 | - return $query_results; | |
| 467 | - } | |
| 334 | + return $query_results; | |
| 335 | + } | |
| 468 | 336 | |
| 469 | 337 | /** |
| 470 | - * Keep backslashes in the phone format option | |
| 471 | - * | |
| 472 | - * @since 2.0.8 | |
| 473 | - * | |
| 474 | - * @param $values array - pass by reference | |
| 475 | - */ | |
| 338 | + * Keep backslashes in the phone format option | |
| 339 | + * | |
| 340 | + * @since 2.0.8 | |
| 341 | + * @param $values array - pass by reference | |
| 342 | + */ | |
| 476 | 343 | private static function preserve_format_option_backslashes( &$values ) { |
| 477 | 344 | if ( isset( $values['field_options']['format'] ) ) { |
| 478 | 345 | $values['field_options']['format'] = FrmAppHelper::preserve_backslashes( $values['field_options']['format'] ); |
| 479 | 346 | } |
| @@ -478,9 +345,9 @@ | ||
| 478 | 345 | $values['field_options']['format'] = FrmAppHelper::preserve_backslashes( $values['field_options']['format'] ); |
| 479 | 346 | } |
| 480 | 347 | } |
| 481 | 348 | |
| 482 | - public static function destroy( $id ) { | |
| 349 | + public static function destroy( $id ) { | |
| 483 | 350 | global $wpdb; |
| 484 | 351 | |
| 485 | 352 | do_action( 'frm_before_destroy_field', $id ); |
| 486 | 353 | |
| @@ -492,11 +359,10 @@ | ||
| 492 | 359 | |
| 493 | 360 | self::delete_form_transient( $field->form_id ); |
| 494 | 361 | |
| 495 | 362 | $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_item_metas WHERE field_id=%d', $id ) ); |
| 496 | - | |
| 497 | 363 | return $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_fields WHERE id=%d', $id ) ); |
| 498 | - } | |
| 364 | + } | |
| 499 | 365 | |
| 500 | 366 | public static function delete_form_transient( $form_id ) { |
| 501 | 367 | $form_id = absint( $form_id ); |
| 502 | 368 | delete_transient( 'frm_form_fields_' . $form_id . 'excludeinclude' ); |
| @@ -509,12 +375,12 @@ | ||
| 509 | 375 | |
| 510 | 376 | FrmDb::cache_delete_group( 'frm_field' ); |
| 511 | 377 | |
| 512 | 378 | $form = FrmForm::getOne( $form_id ); |
| 513 | - if ( $form && $form->parent_form_id && $form->parent_form_id != $form_id ) { | |
| 514 | - self::delete_form_transient( $form->parent_form_id ); | |
| 515 | - } | |
| 516 | - } | |
| 379 | + if ( $form && $form->parent_form_id && $form->parent_form_id != $form_id ) { | |
| 380 | + self::delete_form_transient( $form->parent_form_id ); | |
| 381 | + } | |
| 382 | + } | |
| 517 | 383 | |
| 518 | 384 | /** |
| 519 | 385 | * If $field is numeric, get the field object |
| 520 | 386 | */ |
| @@ -532,31 +398,31 @@ | ||
| 532 | 398 | if ( empty( $id ) ) { |
| 533 | 399 | return null; |
| 534 | 400 | } |
| 535 | 401 | |
| 536 | - global $wpdb; | |
| 402 | + global $wpdb; | |
| 537 | 403 | |
| 538 | 404 | $where = is_numeric( $id ) ? 'id=%d' : 'field_key=%s'; |
| 539 | - $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->prefix . 'frm_fields WHERE ' . $where, $id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared | |
| 405 | + $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->prefix . 'frm_fields WHERE ' . $where, $id ); // WPCS: unprepared SQL ok. | |
| 540 | 406 | |
| 541 | - $results = FrmDb::check_cache( $id, 'frm_field', $query, 'get_row', 0 ); | |
| 407 | + $results = FrmDb::check_cache( $id, 'frm_field', $query, 'get_row', 0 ); | |
| 542 | 408 | |
| 543 | 409 | if ( empty( $results ) ) { |
| 544 | 410 | self::filter_field( $filter, $results ); |
| 545 | - return $results; | |
| 546 | - } | |
| 411 | + return $results; | |
| 412 | + } | |
| 547 | 413 | |
| 548 | 414 | if ( is_numeric( $id ) ) { |
| 549 | 415 | FrmDb::set_cache( $results->field_key, $results, 'frm_field' ); |
| 550 | - } elseif ( $results ) { | |
| 416 | + } else if ( $results ) { | |
| 551 | 417 | FrmDb::set_cache( $results->id, $results, 'frm_field' ); |
| 552 | - } | |
| 418 | + } | |
| 553 | 419 | |
| 554 | 420 | self::prepare_options( $results ); |
| 555 | 421 | self::filter_field( $filter, $results ); |
| 556 | 422 | |
| 557 | - return wp_unslash( $results ); | |
| 558 | - } | |
| 423 | + return stripslashes_deep( $results ); | |
| 424 | + } | |
| 559 | 425 | |
| 560 | 426 | /** |
| 561 | 427 | * @since 3.06.01 |
| 562 | 428 | * @param bool $filter When true, run the frm_field filter. |
| @@ -576,28 +442,28 @@ | ||
| 576 | 442 | * |
| 577 | 443 | * @param int|string The field id or key |
| 578 | 444 | * @param mixed $col The name of the column in the fields database table |
| 579 | 445 | */ |
| 580 | - public static function get_type( $id, $col = 'type' ) { | |
| 581 | - $field = FrmDb::check_cache( $id, 'frm_field' ); | |
| 582 | - if ( $field ) { | |
| 583 | - $type = $field->{$col}; | |
| 584 | - } else { | |
| 446 | + public static function get_type( $id, $col = 'type' ) { | |
| 447 | + $field = FrmDb::check_cache( $id, 'frm_field' ); | |
| 448 | + if ( $field ) { | |
| 449 | + $type = $field->{$col}; | |
| 450 | + } else { | |
| 585 | 451 | $where = array( |
| 586 | 452 | 'or' => 1, |
| 587 | 453 | 'id' => $id, |
| 588 | 454 | 'field_key' => $id, |
| 589 | 455 | ); |
| 590 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); | |
| 591 | - } | |
| 456 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); | |
| 457 | + } | |
| 592 | 458 | |
| 593 | - return $type; | |
| 594 | - } | |
| 459 | + return $type; | |
| 460 | + } | |
| 595 | 461 | |
| 596 | 462 | public static function get_all_types_in_form( $form_id, $type, $limit = '', $inc_sub = 'exclude' ) { |
| 597 | - if ( ! $form_id ) { | |
| 598 | - return array(); | |
| 599 | - } | |
| 463 | + if ( ! $form_id ) { | |
| 464 | + return array(); | |
| 465 | + } | |
| 600 | 466 | |
| 601 | 467 | $results = self::get_fields_from_transients( |
| 602 | 468 | $form_id, |
| 603 | 469 | array( |
| @@ -605,99 +471,98 @@ | ||
| 605 | 471 | 'inc_repeat' => $inc_sub, |
| 606 | 472 | ) |
| 607 | 473 | ); |
| 608 | 474 | if ( ! empty( $results ) ) { |
| 609 | - $fields = array(); | |
| 610 | - $count = 0; | |
| 611 | - foreach ( $results as $result ) { | |
| 612 | - if ( $type != $result->type ) { | |
| 613 | - continue; | |
| 614 | - } | |
| 475 | + $fields = array(); | |
| 476 | + $count = 0; | |
| 477 | + foreach ( $results as $result ) { | |
| 478 | + if ( $type != $result->type ) { | |
| 479 | + continue; | |
| 480 | + } | |
| 615 | 481 | |
| 616 | 482 | $fields[ $result->id ] = $result; |
| 617 | - $count ++; | |
| 618 | - if ( $limit == 1 ) { | |
| 619 | - $fields = $result; | |
| 620 | - break; | |
| 621 | - } | |
| 483 | + $count++; | |
| 484 | + if ( $limit == 1 ) { | |
| 485 | + $fields = $result; | |
| 486 | + break; | |
| 487 | + } | |
| 622 | 488 | |
| 623 | 489 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 624 | - break; | |
| 625 | - } | |
| 490 | + break; | |
| 491 | + } | |
| 626 | 492 | |
| 627 | 493 | unset( $result ); |
| 628 | 494 | } |
| 495 | + return stripslashes_deep( $fields ); | |
| 496 | + } | |
| 629 | 497 | |
| 630 | - return wp_unslash( $fields ); | |
| 631 | - } | |
| 498 | + self::$use_cache = false; | |
| 632 | 499 | |
| 633 | - self::$use_cache = false; | |
| 634 | - | |
| 635 | 500 | $where = array( |
| 636 | 501 | 'fi.form_id' => (int) $form_id, |
| 637 | 502 | 'fi.type' => $type, |
| 638 | 503 | ); |
| 639 | 504 | self::maybe_include_repeating_fields( $inc_sub, $where ); |
| 640 | - $results = self::getAll( $where, 'field_order', $limit ); | |
| 641 | - self::$use_cache = true; | |
| 642 | - self::include_sub_fields( $results, $inc_sub, $type, $form_id ); | |
| 505 | + $results = self::getAll( $where, 'field_order', $limit ); | |
| 506 | + self::$use_cache = true; | |
| 507 | + self::include_sub_fields( $results, $inc_sub, $type ); | |
| 643 | 508 | |
| 644 | - return $results; | |
| 645 | - } | |
| 509 | + return $results; | |
| 510 | + } | |
| 646 | 511 | |
| 647 | 512 | public static function get_all_for_form( $form_id, $limit = '', $inc_embed = 'exclude', $inc_repeat = 'include' ) { |
| 648 | - if ( ! (int) $form_id ) { | |
| 649 | - return array(); | |
| 650 | - } | |
| 513 | + if ( ! (int) $form_id ) { | |
| 514 | + return array(); | |
| 515 | + } | |
| 651 | 516 | |
| 652 | 517 | $results = self::get_fields_from_transients( $form_id, compact( 'inc_embed', 'inc_repeat' ) ); |
| 653 | 518 | if ( ! empty( $results ) ) { |
| 654 | 519 | if ( empty( $limit ) ) { |
| 655 | 520 | return $results; |
| 656 | - } | |
| 521 | + } | |
| 657 | 522 | |
| 658 | - $fields = array(); | |
| 659 | - $count = 0; | |
| 660 | - foreach ( $results as $result ) { | |
| 661 | - $count ++; | |
| 523 | + $fields = array(); | |
| 524 | + $count = 0; | |
| 525 | + foreach ( $results as $result ) { | |
| 526 | + $count++; | |
| 662 | 527 | $fields[ $result->id ] = $result; |
| 663 | 528 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 664 | - break; | |
| 665 | - } | |
| 666 | - } | |
| 529 | + break; | |
| 530 | + } | |
| 531 | + } | |
| 667 | 532 | |
| 668 | 533 | return $fields; |
| 669 | - } | |
| 534 | + } | |
| 670 | 535 | |
| 671 | - self::$use_cache = false; | |
| 536 | + self::$use_cache = false; | |
| 672 | 537 | |
| 673 | 538 | $where = array( 'fi.form_id' => absint( $form_id ) ); |
| 674 | 539 | self::maybe_include_repeating_fields( $inc_repeat, $where ); |
| 675 | 540 | $results = self::getAll( $where, 'field_order', $limit ); |
| 676 | 541 | |
| 677 | - self::$use_cache = true; | |
| 542 | + self::$use_cache = true; | |
| 678 | 543 | |
| 679 | - self::include_sub_fields( $results, $inc_embed, 'all', $form_id ); | |
| 544 | + self::include_sub_fields( $results, $inc_embed, 'all' ); | |
| 680 | 545 | |
| 681 | 546 | if ( empty( $limit ) ) { |
| 682 | 547 | self::set_field_transient( $results, $form_id, 0, compact( 'inc_embed', 'inc_repeat' ) ); |
| 683 | - } | |
| 548 | + } | |
| 684 | 549 | |
| 685 | 550 | return $results; |
| 686 | - } | |
| 551 | + } | |
| 687 | 552 | |
| 688 | 553 | /** |
| 689 | - * If repeating fields should be included, adjust $where accordingly | |
| 690 | - * | |
| 691 | - * @param string $inc_repeat | |
| 692 | - * @param array $where - pass by reference | |
| 693 | - */ | |
| 554 | + * If repeating fields should be included, adjust $where accordingly | |
| 555 | + * | |
| 556 | + * @param string $inc_repeat | |
| 557 | + * @param array $where - pass by reference | |
| 558 | + */ | |
| 694 | 559 | private static function maybe_include_repeating_fields( $inc_repeat, &$where ) { |
| 695 | 560 | if ( $inc_repeat == 'include' ) { |
| 696 | 561 | $form_id = $where['fi.form_id']; |
| 697 | 562 | $where[] = array( |
| 698 | - 'or' => 1, | |
| 699 | - 'fi.form_id' => $form_id, | |
| 563 | + 'or' => 1, | |
| 564 | + 'fi.form_id' => $form_id, | |
| 700 | 565 | 'fr.parent_form_id' => $form_id, |
| 701 | 566 | ); |
| 702 | 567 | unset( $where['fi.form_id'] ); |
| 703 | 568 | } |
| @@ -702,67 +567,61 @@ | ||
| 702 | 567 | unset( $where['fi.form_id'] ); |
| 703 | 568 | } |
| 704 | 569 | } |
| 705 | 570 | |
| 706 | - public static function include_sub_fields( &$results, $inc_embed, $type = 'all', $form_id = '' ) { | |
| 707 | - $no_sub_forms = empty( $results ) && $type === 'all'; | |
| 708 | - if ( 'include' != $inc_embed || $no_sub_forms ) { | |
| 709 | - return; | |
| 710 | - } | |
| 571 | + public static function include_sub_fields( &$results, $inc_embed, $type = 'all' ) { | |
| 572 | + if ( 'include' != $inc_embed || empty( $results ) ) { | |
| 573 | + return; | |
| 574 | + } | |
| 711 | 575 | |
| 712 | - $form_fields = $results; | |
| 713 | - $should_get_subforms = ( $type !== 'all' && $type !== 'form' && ! empty( $form_id ) ); | |
| 714 | - if ( $should_get_subforms ) { | |
| 715 | - $form_fields = self::get_all_types_in_form( $form_id, 'form' ); | |
| 716 | - } | |
| 717 | - | |
| 576 | + $form_fields = $results; | |
| 718 | 577 | $index_offset = 1; |
| 719 | - foreach ( $form_fields as $k => $field ) { | |
| 578 | + foreach ( $form_fields as $k => $field ) { | |
| 720 | 579 | if ( 'form' != $field->type || ! isset( $field->field_options['form_select'] ) ) { |
| 721 | - continue; | |
| 722 | - } | |
| 580 | + continue; | |
| 581 | + } | |
| 723 | 582 | |
| 724 | - if ( $type == 'all' ) { | |
| 725 | - $sub_fields = self::get_all_for_form( $field->field_options['form_select'] ); | |
| 726 | - } else { | |
| 727 | - $sub_fields = self::get_all_types_in_form( $field->field_options['form_select'], $type ); | |
| 728 | - } | |
| 583 | + if ( $type == 'all' ) { | |
| 584 | + $sub_fields = self::get_all_for_form( $field->field_options['form_select'] ); | |
| 585 | + } else { | |
| 586 | + $sub_fields = self::get_all_types_in_form( $field->form_id, $type ); | |
| 587 | + } | |
| 729 | 588 | |
| 730 | 589 | if ( ! empty( $sub_fields ) ) { |
| 731 | - $index = $k + $index_offset; | |
| 590 | + $index = $k + $index_offset; | |
| 732 | 591 | $index_offset += count( $sub_fields ); |
| 733 | 592 | array_splice( $results, $index, 0, $sub_fields ); |
| 734 | 593 | } |
| 735 | 594 | unset( $field, $sub_fields ); |
| 736 | - } | |
| 737 | - } | |
| 595 | + } | |
| 596 | + } | |
| 738 | 597 | |
| 739 | 598 | public static function getAll( $where = array(), $order_by = '', $limit = '', $blog_id = false ) { |
| 740 | - $cache_key = FrmAppHelper::maybe_json_encode( $where ) . $order_by . 'l' . $limit . 'b' . $blog_id; | |
| 741 | - if ( self::$use_cache ) { | |
| 742 | - // make sure old cache doesn't get saved as a transient | |
| 599 | + $cache_key = maybe_serialize( $where ) . $order_by . 'l' . $limit . 'b' . $blog_id; | |
| 600 | + if ( self::$use_cache ) { | |
| 601 | + // make sure old cache doesn't get saved as a transient | |
| 743 | 602 | $results = wp_cache_get( $cache_key, 'frm_field' ); |
| 744 | - if ( false !== $results ) { | |
| 745 | - return wp_unslash( $results ); | |
| 746 | - } | |
| 747 | - } | |
| 603 | + if ( false !== $results ) { | |
| 604 | + return stripslashes_deep( $results ); | |
| 605 | + } | |
| 606 | + } | |
| 748 | 607 | |
| 749 | - global $wpdb; | |
| 608 | + global $wpdb; | |
| 750 | 609 | |
| 751 | - if ( $blog_id && is_multisite() ) { | |
| 752 | - global $wpmuBaseTablePrefix; | |
| 753 | - if ( $wpmuBaseTablePrefix ) { | |
| 610 | + if ( $blog_id && is_multisite() ) { | |
| 611 | + global $wpmuBaseTablePrefix; | |
| 612 | + if ( $wpmuBaseTablePrefix ) { | |
| 754 | 613 | $prefix = $wpmuBaseTablePrefix . $blog_id . '_'; |
| 755 | - } else { | |
| 756 | - $prefix = $wpdb->get_blog_prefix( $blog_id ); | |
| 757 | - } | |
| 614 | + } else { | |
| 615 | + $prefix = $wpdb->get_blog_prefix( $blog_id ); | |
| 616 | + } | |
| 758 | 617 | |
| 759 | - $table_name = $prefix . 'frm_fields'; | |
| 618 | + $table_name = $prefix . 'frm_fields'; | |
| 760 | 619 | $form_table_name = $prefix . 'frm_forms'; |
| 761 | 620 | } else { |
| 762 | - $table_name = $wpdb->prefix . 'frm_fields'; | |
| 621 | + $table_name = $wpdb->prefix . 'frm_fields'; | |
| 763 | 622 | $form_table_name = $wpdb->prefix . 'frm_forms'; |
| 764 | - } | |
| 623 | + } | |
| 765 | 624 | |
| 766 | 625 | if ( ! empty( $order_by ) && strpos( $order_by, 'ORDER BY' ) === false ) { |
| 767 | 626 | $order_by = ' ORDER BY ' . $order_by; |
| 768 | 627 | } |
| @@ -768,13 +627,13 @@ | ||
| 768 | 627 | } |
| 769 | 628 | |
| 770 | 629 | $limit = FrmDb::esc_limit( $limit ); |
| 771 | 630 | |
| 772 | - $query = "SELECT fi.*, fr.name as form_name FROM {$table_name} fi LEFT OUTER JOIN {$form_table_name} fr ON fi.form_id=fr.id"; | |
| 773 | - $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; | |
| 631 | + $query = "SELECT fi.*, fr.name as form_name FROM {$table_name} fi LEFT OUTER JOIN {$form_table_name} fr ON fi.form_id=fr.id"; | |
| 632 | + $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; | |
| 774 | 633 | |
| 775 | 634 | if ( is_array( $where ) ) { |
| 776 | - $args = array( | |
| 635 | + $args = array( | |
| 777 | 636 | 'order_by' => $order_by, |
| 778 | 637 | 'limit' => $limit, |
| 779 | 638 | ); |
| 780 | 639 | $results = FrmDb::get_var( $table_name . ' fi LEFT OUTER JOIN ' . $form_table_name . ' fr ON fi.form_id=fr.id', $where, 'fi.*, fr.name as form_name', $args, '', $query_type ); |
| @@ -782,17 +641,17 @@ | ||
| 782 | 641 | // if the query is not an array, then it has already been prepared |
| 783 | 642 | $query .= FrmDb::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; |
| 784 | 643 | |
| 785 | 644 | $function_name = ( $query_type == 'row' ) ? 'get_row' : 'get_results'; |
| 786 | - $results = $wpdb->$function_name( $query ); | |
| 787 | - } | |
| 788 | - unset( $where ); | |
| 645 | + $results = $wpdb->$function_name( $query ); | |
| 646 | + } | |
| 647 | + unset( $where ); | |
| 789 | 648 | |
| 790 | 649 | self::format_field_results( $results ); |
| 791 | 650 | |
| 792 | 651 | FrmDb::set_cache( $cache_key, $results, 'frm_field' ); |
| 793 | 652 | |
| 794 | - return wp_unslash( $results ); | |
| 653 | + return stripslashes_deep( $results ); | |
| 795 | 654 | } |
| 796 | 655 | |
| 797 | 656 | /** |
| 798 | 657 | * @since 2.0.8 |
| @@ -802,16 +661,15 @@ | ||
| 802 | 661 | foreach ( $results as $r_key => $result ) { |
| 803 | 662 | FrmDb::set_cache( $result->id, $result, 'frm_field' ); |
| 804 | 663 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 805 | 664 | |
| 806 | - self::prepare_options( $result ); | |
| 807 | - $results[ $r_key ]->field_options = $result->field_options; | |
| 808 | - $results[ $r_key ]->options = $result->options; | |
| 809 | - $results[ $r_key ]->default_value = $result->default_value; | |
| 665 | + $results[ $r_key ]->field_options = maybe_unserialize( $result->field_options ); | |
| 666 | + $results[ $r_key ]->options = maybe_unserialize( $result->options ); | |
| 667 | + $results[ $r_key ]->default_value = maybe_unserialize( $result->default_value ); | |
| 810 | 668 | |
| 811 | 669 | unset( $r_key, $result ); |
| 812 | 670 | } |
| 813 | - } elseif ( $results ) { | |
| 671 | + } else if ( $results ) { | |
| 814 | 672 | FrmDb::set_cache( $results->id, $results, 'frm_field' ); |
| 815 | 673 | FrmDb::set_cache( $results->field_key, $results, 'frm_field' ); |
| 816 | 674 | |
| 817 | 675 | self::prepare_options( $results ); |
| @@ -823,17 +681,12 @@ | ||
| 823 | 681 | * |
| 824 | 682 | * @since 2.0 |
| 825 | 683 | */ |
| 826 | 684 | private static function prepare_options( &$results ) { |
| 827 | - FrmAppHelper::unserialize_or_decode( $results->field_options ); | |
| 828 | - FrmAppHelper::unserialize_or_decode( $results->options ); | |
| 685 | + $results->field_options = maybe_unserialize( $results->field_options ); | |
| 829 | 686 | |
| 830 | - // Allow a single box to be checked for the default value. | |
| 831 | - $before = $results->default_value; | |
| 832 | - FrmAppHelper::unserialize_or_decode( $results->default_value ); | |
| 833 | - if ( $before === $results->default_value && ! is_array( $before ) && strpos( $before, '["' ) === 0 ) { | |
| 834 | - $results->default_value = FrmAppHelper::maybe_json_decode( $results->default_value ); | |
| 835 | - } | |
| 687 | + $results->options = maybe_unserialize( $results->options ); | |
| 688 | + $results->default_value = maybe_unserialize( $results->default_value ); | |
| 836 | 689 | } |
| 837 | 690 | |
| 838 | 691 | /** |
| 839 | 692 | * If a form has too many fields, thay won't all save into a single transient. |
| @@ -843,9 +696,8 @@ | ||
| 843 | 696 | */ |
| 844 | 697 | private static function get_fields_from_transients( $form_id, $args ) { |
| 845 | 698 | $fields = array(); |
| 846 | 699 | self::get_next_transient( $fields, 'frm_form_fields_' . $form_id . $args['inc_embed'] . $args['inc_repeat'] ); |
| 847 | - | |
| 848 | 700 | return $fields; |
| 849 | 701 | } |
| 850 | 702 | |
| 851 | 703 | /** |
| @@ -853,9 +705,9 @@ | ||
| 853 | 705 | * |
| 854 | 706 | * @since 2.0.1 |
| 855 | 707 | */ |
| 856 | 708 | private static function get_next_transient( &$fields, $base_name, $next = 0 ) { |
| 857 | - $name = $next ? $base_name . $next : $base_name; | |
| 709 | + $name = $next ? $base_name . $next : $base_name; | |
| 858 | 710 | $next_fields = get_transient( $name ); |
| 859 | 711 | |
| 860 | 712 | if ( $next_fields ) { |
| 861 | 713 | $fields = array_merge( $fields, $next_fields ); |
| @@ -861,9 +713,9 @@ | ||
| 861 | 713 | $fields = array_merge( $fields, $next_fields ); |
| 862 | 714 | |
| 863 | 715 | if ( count( $next_fields ) >= self::$transient_size ) { |
| 864 | 716 | // if this transient is full, check for another |
| 865 | - $next ++; | |
| 717 | + $next++; | |
| 866 | 718 | self::get_next_transient( $fields, $base_name, $next ); |
| 867 | 719 | } |
| 868 | 720 | } |
| 869 | 721 | } |
| @@ -873,14 +725,14 @@ | ||
| 873 | 725 | * |
| 874 | 726 | * @since 2.0.1 |
| 875 | 727 | */ |
| 876 | 728 | private static function set_field_transient( &$fields, $form_id, $next = 0, $args = array() ) { |
| 877 | - $base_name = 'frm_form_fields_' . $form_id . $args['inc_embed'] . $args['inc_repeat']; | |
| 729 | + $base_name = 'frm_form_fields_' . $form_id . $args['inc_embed'] . $args['inc_repeat']; | |
| 878 | 730 | $field_chunks = array_chunk( $fields, self::$transient_size ); |
| 879 | 731 | |
| 880 | 732 | foreach ( $field_chunks as $field ) { |
| 881 | 733 | $name = $next ? $base_name . $next : $base_name; |
| 882 | - $set = set_transient( $name, $field, 60 * 60 * 6 ); | |
| 734 | + $set = set_transient( $name, $field, 60 * 60 * 6 ); | |
| 883 | 735 | if ( ! $set ) { |
| 884 | 736 | // the transient didn't save |
| 885 | 737 | if ( $name != $base_name ) { |
| 886 | 738 | // if the first saved an others fail, this will show an incmoplete form |
| @@ -885,13 +737,12 @@ | ||
| 885 | 737 | if ( $name != $base_name ) { |
| 886 | 738 | // if the first saved an others fail, this will show an incmoplete form |
| 887 | 739 | self::delete_form_transient( $form_id ); |
| 888 | 740 | } |
| 889 | - | |
| 890 | 741 | return; |
| 891 | 742 | } |
| 892 | 743 | |
| 893 | - $next ++; | |
| 744 | + $next++; | |
| 894 | 745 | } |
| 895 | 746 | } |
| 896 | 747 | |
| 897 | 748 | public static function is_no_save_field( $type ) { |
| @@ -898,9 +749,9 @@ | ||
| 898 | 749 | return in_array( $type, self::no_save_fields() ); |
| 899 | 750 | } |
| 900 | 751 | |
| 901 | 752 | public static function no_save_fields() { |
| 902 | - return array( 'divider', 'end_divider', 'captcha', 'break', 'html', 'form', 'summary' ); | |
| 753 | + return array( 'divider', 'end_divider', 'captcha', 'break', 'html', 'form' ); | |
| 903 | 754 | } |
| 904 | 755 | |
| 905 | 756 | /** |
| 906 | 757 | * Check if this field can hold an array of values |
| @@ -907,9 +758,8 @@ | ||
| 907 | 758 | * |
| 908 | 759 | * @since 2.0.9 |
| 909 | 760 | * |
| 910 | 761 | * @param array|object $field |
| 911 | - * | |
| 912 | 762 | * @return boolean |
| 913 | 763 | */ |
| 914 | 764 | public static function is_field_with_multiple_values( $field ) { |
| 915 | 765 | if ( ! $field ) { |
| @@ -939,9 +789,9 @@ | ||
| 939 | 789 | * @since 3.0 |
| 940 | 790 | * @return string |
| 941 | 791 | */ |
| 942 | 792 | public static function get_original_field_type( $field ) { |
| 943 | - $field_type = self::get_field_type( $field ); | |
| 793 | + $field_type = self::get_field_type( $field ); | |
| 944 | 794 | $original_type = self::get_option( $field, 'original_type' ); |
| 945 | 795 | |
| 946 | 796 | if ( ! empty( $original_type ) && $original_type != $field_type ) { |
| 947 | 797 | $field_type = $original_type; // check the original type for arrays |
| @@ -956,11 +806,12 @@ | ||
| 956 | 806 | * @since 2.0.9 |
| 957 | 807 | * @return boolean |
| 958 | 808 | */ |
| 959 | 809 | public static function is_multiple_select( $field ) { |
| 960 | - $field_type = self::get_field_type( $field ); | |
| 961 | - $is_multiple = self::is_option_true( $field, 'multiple' ) && self::is_field_type( $field, 'select' ) && $field_type !== 'hidden'; | |
| 810 | + $field_type = self::get_field_type( $field ); | |
| 811 | + $data_type = self::get_option( $field, 'data_type' ); | |
| 962 | 812 | |
| 813 | + $is_multiple = self::is_option_true( $field, 'multiple' ) && ( ( $field_type == 'select' || ( $field_type == 'data' && $data_type == 'select' ) ) ); | |
| 963 | 814 | return apply_filters( 'frm_is_multiple_select', $is_multiple, $field ); |
| 964 | 815 | } |
| 965 | 816 | |
| 966 | 817 | /** |
| @@ -970,9 +821,8 @@ | ||
| 970 | 821 | * @since 2.0.9 |
| 971 | 822 | */ |
| 972 | 823 | public static function is_read_only( $field ) { |
| 973 | 824 | global $frm_vars; |
| 974 | - | |
| 975 | 825 | return ( self::is_option_true( $field, 'read_only' ) && ( ! isset( $frm_vars['readonly'] ) || $frm_vars['readonly'] != 'disabled' ) ); |
| 976 | 826 | } |
| 977 | 827 | |
| 978 | 828 | /** |
| @@ -980,9 +830,8 @@ | ||
| 980 | 830 | */ |
| 981 | 831 | public static function is_required( $field ) { |
| 982 | 832 | $required = ( $field['required'] != '0' ); |
| 983 | 833 | $required = apply_filters( 'frm_is_field_required', $required, $field ); |
| 984 | - | |
| 985 | 834 | return $required; |
| 986 | 835 | } |
| 987 | 836 | |
| 988 | 837 | /** |
| @@ -1035,23 +884,13 @@ | ||
| 1035 | 884 | $option = self::get_option_in_array( $field, $option ); |
| 1036 | 885 | } else { |
| 1037 | 886 | $option = self::get_option_in_object( $field, $option ); |
| 1038 | 887 | } |
| 1039 | - | |
| 1040 | 888 | return $option; |
| 1041 | 889 | } |
| 1042 | 890 | |
| 1043 | 891 | public static function get_option_in_array( $field, $option ) { |
| 1044 | - | |
| 1045 | - if ( isset( $field[ $option ] ) ) { | |
| 1046 | - $this_option = $field[ $option ]; | |
| 1047 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { | |
| 1048 | - $this_option = $field['field_options'][ $option ]; | |
| 1049 | - } else { | |
| 1050 | - $this_option = ''; | |
| 1051 | - } | |
| 1052 | - | |
| 1053 | - return $this_option; | |
| 892 | + return isset( $field[ $option ] ) ? $field[ $option ] : ''; | |
| 1054 | 893 | } |
| 1055 | 894 | |
| 1056 | 895 | public static function get_option_in_object( $field, $option ) { |
| 1057 | 896 | return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
| @@ -1057,10 +896,10 @@ | ||
| 1057 | 896 | return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
| 1058 | 897 | } |
| 1059 | 898 | |
| 1060 | 899 | /** |
| 1061 | - * @since 2.0.09 | |
| 1062 | - */ | |
| 900 | + * @since 2.0.09 | |
| 901 | + */ | |
| 1063 | 902 | public static function is_repeating_field( $field ) { |
| 1064 | 903 | if ( is_array( $field ) ) { |
| 1065 | 904 | $is_repeating_field = ( 'divider' == $field['type'] ); |
| 1066 | 905 | } else { |
| @@ -1065,27 +904,23 @@ | ||
| 1065 | 904 | $is_repeating_field = ( 'divider' == $field['type'] ); |
| 1066 | 905 | } else { |
| 1067 | 906 | $is_repeating_field = ( 'divider' == $field->type ); |
| 1068 | 907 | } |
| 1069 | - | |
| 1070 | 908 | return ( $is_repeating_field && self::is_option_true( $field, 'repeat' ) ); |
| 1071 | 909 | } |
| 1072 | 910 | |
| 1073 | 911 | /** |
| 1074 | 912 | * @param string $key |
| 1075 | - * | |
| 1076 | 913 | * @return int field id |
| 1077 | 914 | */ |
| 1078 | 915 | public static function get_id_by_key( $key ) { |
| 1079 | 916 | $id = FrmDb::get_var( 'frm_fields', array( 'field_key' => sanitize_title( $key ) ) ); |
| 1080 | - | |
| 1081 | 917 | return (int) $id; |
| 1082 | 918 | } |
| 1083 | 919 | |
| 1084 | 920 | /** |
| 1085 | 921 | * @param string $id |
| 1086 | - * | |
| 1087 | - * @return null|string | |
| 922 | + * @return string | |
| 1088 | 923 | */ |
| 1089 | 924 | public static function get_key_by_id( $id ) { |
| 1090 | 925 | return FrmDb::get_var( 'frm_fields', array( 'id' => $id ), 'field_key' ); |
| 1091 | 926 | } |
| @@ -1091,9 +926,8 @@ | ||
| 1091 | 926 | } |
| 1092 | 927 | |
| 1093 | 928 | public static function is_image( $field ) { |
| 1094 | 929 | $type = self::get_field_type( $field ); |
| 1095 | - | |
| 1096 | 930 | return ( $type == 'url' && self::get_option( $field, 'show_image' ) ); |
| 1097 | 931 | } |
| 1098 | 932 | |
| 1099 | 933 | /** |
| @@ -1101,9 +935,8 @@ | ||
| 1101 | 935 | * |
| 1102 | 936 | * @since 3.0 |
| 1103 | 937 | * |
| 1104 | 938 | * @param array|object $field |
| 1105 | - * | |
| 1106 | 939 | * @return boolean true if field type is radio or Dynamic radio |
| 1107 | 940 | */ |
| 1108 | 941 | public static function is_radio( $field ) { |
| 1109 | 942 | return self::is_field_type( $field, 'radio' ); |
| @@ -1114,9 +947,8 @@ | ||
| 1114 | 947 | * |
| 1115 | 948 | * @since 3.0 |
| 1116 | 949 | * |
| 1117 | 950 | * @param array|object $field |
| 1118 | - * | |
| 1119 | 951 | * @return boolean true if field type is checkbox or Dynamic checkbox |
| 1120 | 952 | */ |
| 1121 | 953 | public static function is_checkbox( $field ) { |
| 1122 | 954 | return self::is_field_type( $field, 'checkbox' ); |
| @@ -1128,41 +960,17 @@ | ||
| 1128 | 960 | * @since 3.0 |
| 1129 | 961 | * |
| 1130 | 962 | * @param array|object $field |
| 1131 | 963 | * @param string $is_type Options include radio, checkbox, text |
| 1132 | - * | |
| 1133 | 964 | * @return boolean true if field type is checkbox or Dynamic checkbox |
| 1134 | 965 | */ |
| 1135 | 966 | public static function is_field_type( $field, $is_type ) { |
| 1136 | 967 | $field_type = self::get_original_field_type( $field ); |
| 1137 | - $data_type = self::get_option( $field, 'data_type' ); | |
| 968 | + $data_type = self::get_option( $field, 'data_type' ); | |
| 1138 | 969 | |
| 1139 | - $is_field_type = ( | |
| 970 | + return ( | |
| 1140 | 971 | $is_type === $field_type || |
| 1141 | 972 | ( 'data' === $field_type && $is_type === $data_type ) || |
| 1142 | - ( 'lookup' === $field_type && $is_type === $data_type ) || | |
| 1143 | - ( 'product' === $field_type && $is_type === $data_type ) | |
| 973 | + ( 'lookup' === $field_type && $is_type === $data_type ) | |
| 1144 | 974 | ); |
| 1145 | - | |
| 1146 | - /** | |
| 1147 | - * When a field type is checked, allow individual fields | |
| 1148 | - * to set the type. | |
| 1149 | - * | |
| 1150 | - * @since 4.04 | |
| 1151 | - */ | |
| 1152 | - return apply_filters( 'frm_is_field_type', $is_field_type, compact( 'field', 'is_type' ) ); | |
| 1153 | - } | |
| 1154 | - | |
| 1155 | - /** | |
| 1156 | - * Checks if the given field array is a combo field. | |
| 1157 | - * | |
| 1158 | - * @since 4.10.02 | |
| 1159 | - * | |
| 1160 | - * @param array $field Field array. | |
| 1161 | - * @return bool | |
| 1162 | - */ | |
| 1163 | - public static function is_combo_field( $field ) { | |
| 1164 | - $field_type_obj = FrmFieldFactory::get_field_factory( $field ); | |
| 1165 | - | |
| 1166 | - return ! empty( $field_type_obj->is_combo_field ); | |
| 1167 | 975 | } |
| 1168 | 976 | } |