function setup_edit_vars($values, $field, $entry_id = false) { $values['use_key'] = false; $field->field_options = maybe_unserialize($field->field_options); foreach ($this->get_default_field_opts($values, $field) as $opt => $default) { $values[$opt] = stripslashes_deep(($_POST and isset($_POST['field_options'][$opt . '_' . $field->id])) ? $_POST['field_options'][$opt . '_' . $field->id] : (isset($field->field_options[$opt]) ? $field->field_options[$opt] : $default)); } $values['hide_field'] = (array) $values['hide_field']; $values['hide_field_cond'] = (array) $values['hide_field_cond']; $values['hide_opt'] = (array) $values['hide_opt']; if ($values['type'] == 'data' && in_array($values['data_type'], array('select', 'radio', 'checkbox')) && is_numeric($values['form_select'])) { global $frm_entry_meta; $check = $this->check_data_values($values); if ($check) { $values['options'] = $this->get_linked_options($values, $field, $entry_id); } else { if (is_numeric($values['value'])) { $values['options'] = array($values['value'] => $frm_entry_meta->get_entry_meta_by_field($values['value'], $values['form_select'])); } } unset($check); } else { if ($values['type'] == 'date') { global $frmpro_settings; if (preg_match('/^\\d{4}-\\d{2}-\\d{2}$/', $values['value'])) { $values['value'] = FrmProAppHelper::convert_date($values['value'], 'Y-m-d', $frmpro_settings->date_format); } else { if (preg_match('/^\\d{4}-\\d{2}-\\d{2}/', $values['value'])) { $values['value'] = FrmProAppHelper::convert_date($values['value'], 'Y-m-d H:i:s', $frmpro_settings->date_format); } } } else { if ($values['type'] == 'file') { //if (isset($_POST)) ??? if ($values['post_field'] != 'post_custom') { global $frm_entry_meta; $values['value'] = $frm_entry_meta->get_entry_meta_by_field($entry_id, $values['id']); } } else { if ($values['type'] == 'hidden' and is_admin() and current_user_can('administrator') and $_GET['page'] != 'formidable') { $values['type'] = 'text'; $values['custom_html'] = FrmFieldsHelper::get_default_html('text'); } else { if ($values['type'] == 'user_id' and is_admin() and current_user_can('administrator') and $_GET['page'] != 'formidable') { $values['type'] = 'select'; $values['options'] = $this->get_user_options(); $values['use_key'] = true; $values['custom_html'] = FrmFieldsHelper::get_default_html('select'); } else { if ($values['type'] == 'tag') { if (empty($values['value'])) { global $wpdb, $frmdb; $post_id = $wpdb->get_var("SELECT post_id FROM {$frmdb->entries} WHERE id={$entry_id}"); if ($post_id and $tags = get_the_terms($post_id, $values['taxonomy'])) { $names = array(); foreach ($tags as $tag) { $names[] = $tag->name; } $values['value'] = implode(', ', $names); } } } } } } } } if ($values['post_field'] == 'post_category') { $values['use_key'] = true; $values['options'] = $this->get_category_options($values); } else { if ($values['post_field'] == 'post_status') { $values['use_key'] = true; $values['options'] = $this->get_status_options($field); } } FrmProFieldsHelper::setup_conditional_fields($values); return $values; }