当前位置: 首页>>代码示例>>PHP>>正文


PHP FrmFieldsHelper::get_default_html方法代码示例

本文整理汇总了PHP中FrmFieldsHelper::get_default_html方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmFieldsHelper::get_default_html方法的具体用法?PHP FrmFieldsHelper::get_default_html怎么用?PHP FrmFieldsHelper::get_default_html使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FrmFieldsHelper的用法示例。


在下文中一共展示了FrmFieldsHelper::get_default_html方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setup_edit_vars

 function setup_edit_vars($record)
 {
     global $frm_entry_meta, $frm_form;
     $values = array();
     $record->field_options = maybe_unserialize($record->field_options);
     $values['id'] = $record->id;
     $values['form_id'] = $record->form_id;
     foreach (array('name' => $record->name, 'description' => $record->description) as $var => $default) {
         $values[$var] = htmlspecialchars(stripslashes(FrmAppHelper::get_param($var, $default)));
     }
     $values['form_name'] = $record->form_id ? $frm_form->getName($record->form_id) : '';
     foreach (array('field_key' => $record->field_key, 'type' => $record->type, 'default_value' => $record->default_value, 'field_order' => $record->field_order, 'required' => $record->required) as $var => $default) {
         $values[$var] = FrmAppHelper::get_param($var, $default);
     }
     $values['options'] = stripslashes_deep(maybe_unserialize($record->options));
     $values['field_options'] = $record->field_options;
     $defaults = FrmFieldsHelper::get_default_field_opts($values['type'], $record, true);
     if ($values['type'] == 'captcha') {
         global $frm_settings;
         $defaults['invalid'] = $frm_settings->re_msg;
     }
     foreach ($defaults as $opt => $default) {
         $values[$opt] = isset($record->field_options[$opt]) ? $record->field_options[$opt] : $default;
     }
     $values['custom_html'] = isset($record->field_options['custom_html']) ? stripslashes($record->field_options['custom_html']) : FrmFieldsHelper::get_default_html($record->type);
     return apply_filters('frm_setup_edit_field_vars', $values, $values['field_options']);
 }
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:27,代码来源:FrmFieldsHelper.php

示例2: setup_new_vars

 public static function setup_new_vars($fields, $form = '', $reset = false, $args = array())
 {
     global $frm_vars;
     $values = array();
     foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default) {
         $values[$var] = FrmAppHelper::get_post_param($var, $default);
     }
     $values['fields'] = array();
     if (empty($fields)) {
         return apply_filters('frm_setup_new_entry', $values);
     }
     foreach ((array) $fields as $field) {
         $new_value = self::get_field_value_for_new_entry($field, $reset);
         $field_array = array('id' => $field->id, 'value' => $new_value, 'default_value' => $field->default_value, 'name' => $field->name, 'description' => $field->description, 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), 'options' => $field->options, 'required' => $field->required, 'field_key' => $field->field_key, 'field_order' => $field->field_order, 'form_id' => $field->form_id, 'parent_form_id' => isset($args['parent_form_id']) ? $args['parent_form_id'] : $field->form_id);
         $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
         $opt_defaults['required_indicator'] = '';
         $opt_defaults['original_type'] = $field->type;
         foreach ($opt_defaults as $opt => $default_opt) {
             $field_array[$opt] = isset($field->field_options[$opt]) && $field->field_options[$opt] != '' ? $field->field_options[$opt] : $default_opt;
             unset($opt, $default_opt);
         }
         unset($opt_defaults);
         if ($field_array['custom_html'] == '') {
             $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
         }
         $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
         $field_array = array_merge($field->field_options, $field_array);
         $values['fields'][] = $field_array;
         if (!$form || !isset($form->id)) {
             $form = FrmForm::getOne($field->form_id);
         }
     }
     $form->options = maybe_unserialize($form->options);
     if (is_array($form->options)) {
         foreach ($form->options as $opt => $value) {
             $values[$opt] = FrmAppHelper::get_post_param($opt, $value);
             unset($opt, $value);
         }
     }
     $form_defaults = FrmFormsHelper::get_default_opts();
     $frm_settings = FrmAppHelper::get_settings();
     $form_defaults['custom_style'] = $frm_settings->load_style != 'none';
     $values = array_merge($form_defaults, $values);
     return apply_filters('frm_setup_new_entry', $values);
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:45,代码来源:FrmEntriesHelper.php

示例3: setup_new_vars

 public static function setup_new_vars($type = '', $form_id = '')
 {
     global $frm_settings;
     $defaults = FrmFieldsHelper::get_default_field_opts($type, $form_id);
     $defaults['field_options']['custom_html'] = FrmFieldsHelper::get_default_html($type);
     $values = array();
     foreach ($defaults as $var => $default) {
         if ($var == 'field_options') {
             $values['field_options'] = array();
             foreach ($default as $opt_var => $opt_default) {
                 $values['field_options'][$opt_var] = $opt_default;
                 unset($opt_var);
                 unset($opt_default);
             }
         } else {
             $values[$var] = $default;
         }
         unset($var);
         unset($default);
     }
     if ($type == 'radio' || $type == 'checkbox') {
         $values['options'] = serialize(array(__('Option 1', 'formidable'), __('Option 2', 'formidable')));
     } else {
         if ($type == 'select') {
             $values['options'] = serialize(array('', __('Option 1', 'formidable')));
         } else {
             if ($type == 'textarea') {
                 $values['field_options']['max'] = '5';
             } else {
                 if ($type == 'captcha') {
                     $values['invalid'] = $frm_settings->re_msg;
                 }
             }
         }
     }
     $fields = self::field_selection();
     $fields = array_merge($fields, self::pro_field_selection());
     if (isset($fields[$type])) {
         $values['name'] = $fields[$type];
     }
     unset($fields);
     return $values;
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:43,代码来源:FrmFieldsHelper.php

示例4: setup_edit_vars

 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;
 }
开发者ID:moscarar,项目名称:cityhow,代码行数:79,代码来源:FrmProFieldsHelper.php

示例5: setup_new_vars

 function setup_new_vars($fields, $form = '', $reset = false)
 {
     global $frm_form, $frm_settings, $frm_sidebar_width;
     $values = array();
     foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default) {
         $values[$var] = stripslashes(FrmAppHelper::get_post_param($var, $default));
     }
     $values['fields'] = array();
     if ($fields) {
         foreach ($fields as $field) {
             $field->field_options = maybe_unserialize($field->field_options);
             $default = $field->default_value;
             if ($reset) {
                 $new_value = $default;
             } else {
                 $new_value = ($_POST and isset($_POST['item_meta'][$field->id]) and $_POST['item_meta'][$field->id] != '') ? $_POST['item_meta'][$field->id] : $default;
             }
             $is_default = $new_value == $default ? true : false;
             $new_value = stripslashes_deep(maybe_unserialize($new_value));
             if (!is_array($new_value)) {
                 $new_value = apply_filters('frm_get_default_value', $new_value, $field);
             }
             $new_value = str_replace('"', '"', $new_value);
             if ($is_default) {
                 $field->default_value = $new_value;
             } else {
                 $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field);
             }
             $field_array = array('id' => $field->id, 'value' => $new_value, 'default_value' => maybe_unserialize($field->default_value), 'name' => stripslashes($field->name), 'description' => stripslashes($field->description), 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), 'options' => stripslashes_deep(maybe_unserialize($field->options)), 'required' => $field->required, 'field_key' => $field->field_key, 'field_order' => $field->field_order, 'form_id' => $field->form_id);
             /*if(in_array($field_array['type'], array('checkbox', 'radio', 'select')) and !empty($field_array['options'])){
                   foreach((array)$field_array['options'] as $opt_key => $opt){
                       if(!is_array($opt))
                           $field_array['options'][$opt_key] = array('label' => $opt);
                       unset($opt);
                       unset($opt_key);
                   }
               } */
             $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
             $opt_defaults['required_indicator'] = '';
             foreach ($opt_defaults as $opt => $default_opt) {
                 $field_array[$opt] = isset($field->field_options[$opt]) && $field->field_options[$opt] != '' ? $field->field_options[$opt] : $default_opt;
                 unset($opt);
                 unset($default_opt);
             }
             unset($opt_defaults);
             if ($field_array['size'] == '') {
                 $field_array['size'] = $frm_sidebar_width;
             }
             if ($field_array['custom_html'] == '') {
                 $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
             }
             $values['fields'][] = apply_filters('frm_setup_new_fields_vars', stripslashes_deep($field_array), $field);
             if (!$form or !isset($form->id)) {
                 $form = $frm_form->getOne($field->form_id);
             }
         }
         $form->options = maybe_unserialize($form->options);
         if (is_array($form->options)) {
             foreach ($form->options as $opt => $value) {
                 $values[$opt] = FrmAppHelper::get_post_param($opt, $value);
             }
         }
         if (!isset($values['custom_style'])) {
             $values['custom_style'] = $frm_settings->load_style != 'none';
         }
         if (!isset($values['email_to'])) {
             $values['email_to'] = '';
         }
         if (!isset($values['submit_value'])) {
             $values['submit_value'] = $frm_settings->submit_value;
         }
         if (!isset($values['success_msg'])) {
             $values['success_msg'] = $frm_settings->success_msg;
         }
         if (!isset($values['akismet'])) {
             $values['akismet'] = '';
         }
         if (!isset($values['before_html'])) {
             $values['before_html'] = FrmFormsHelper::get_default_html('before');
         }
         if (!isset($values['after_html'])) {
             $values['after_html'] = FrmFormsHelper::get_default_html('after');
         }
     }
     return $values;
 }
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:86,代码来源:FrmEntriesHelper.php

示例6: setup_edit_vars

 public static function setup_edit_vars($values, $field, $entry_id = false)
 {
     $values['use_key'] = false;
     self::fill_field_options($field, $values);
     $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'])) {
         $check = self::check_data_values($values);
         if ($check) {
             $values['options'] = self::get_linked_options($values, $field, $entry_id);
         } else {
             if (is_numeric($values['value'])) {
                 $values['options'] = array($values['value'] => FrmEntryMeta::get_entry_meta_by_field($values['value'], $values['form_select']));
             }
         }
         unset($check);
     } else {
         if ($values['type'] == 'date') {
             $to_format = preg_match('/^\\d{4}-\\d{2}-\\d{2}$/', $values['value']) ? 'Y-m-d' : 'Y-m-d H:i:s';
             $values['value'] = FrmProAppHelper::maybe_convert_from_db_date($values['value'], $to_format);
         } else {
             if ($values['type'] == 'file') {
                 if ($values['post_field'] != 'post_custom') {
                     $values['value'] = FrmEntryMeta::get_entry_meta_by_field($entry_id, $values['id']);
                 }
             } else {
                 if ($values['type'] == 'hidden' && FrmAppHelper::is_admin() && current_user_can('administrator') && !FrmAppHelper::is_admin_page('formidable')) {
                     if (self::field_on_current_page($field)) {
                         $values['type'] = 'text';
                         $values['custom_html'] = FrmFieldsHelper::get_default_html('text');
                     }
                 } else {
                     if ($values['type'] == 'time') {
                         $values['options'] = self::get_time_options($values);
                     } else {
                         if ($values['type'] == 'user_id' && FrmAppHelper::is_admin() && current_user_can('frm_edit_entries') && !FrmAppHelper::is_admin_page('formidable')) {
                             if (self::field_on_current_page($field)) {
                                 $values['type'] = 'select';
                                 $values['options'] = self::get_user_options();
                                 $values['use_key'] = true;
                                 $values['custom_html'] = FrmFieldsHelper::get_default_html('select');
                             }
                         } else {
                             if ($values['type'] == 'tag') {
                                 if (empty($values['value'])) {
                                     self::tags_to_list($values, $entry_id);
                                 }
                             } else {
                                 if (!empty($values['options']) && (!FrmAppHelper::is_admin() || !FrmAppHelper::is_admin_page('formidable'))) {
                                     foreach ($values['options'] as $val_key => $val_opt) {
                                         if (is_array($val_opt)) {
                                             foreach ($val_opt as $opt_key => $opt) {
                                                 $values['options'][$val_key][$opt_key] = self::get_default_value($opt, $field, false);
                                                 unset($opt_key, $opt);
                                             }
                                         } else {
                                             $values['options'][$val_key] = self::get_default_value($val_opt, $field, false);
                                         }
                                         unset($val_key, $val_opt);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($values['post_field'] == 'post_category') {
         $values['use_key'] = true;
         $values['options'] = self::get_category_options($values);
         if ($values['type'] == 'data' && $values['data_type'] == 'select' && (!$values['multiple'] || $values['autocom'])) {
             $values['options'] = array('' => '') + (array) $values['options'];
         }
     } else {
         if ($values['post_field'] == 'post_status') {
             $values['use_key'] = true;
             $values['options'] = self::get_status_options($field, $values['options']);
         }
     }
     // Format the value in hidden repeating sections
     self::setup_hidden_sub_form($values, $field);
     self::setup_conditional_fields($values);
     return $values;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:86,代码来源:FrmProFieldsHelper.php

示例7: update_fields

 /**
  * @return array
  */
 public static function update_fields($id, $values)
 {
     if (!isset($values['options']) && !isset($values['item_meta']) && !isset($values['field_options'])) {
         return $values;
     }
     $all_fields = FrmField::get_all_for_form($id);
     if (empty($all_fields)) {
         return $values;
     }
     if (!isset($values['item_meta'])) {
         $values['item_meta'] = array();
     }
     $field_array = array();
     $existing_keys = array_keys($values['item_meta']);
     foreach ($all_fields as $fid) {
         if (!in_array($fid->id, $existing_keys) && (isset($values['frm_fields_submitted']) && in_array($fid->id, $values['frm_fields_submitted'])) || isset($values['options'])) {
             $values['item_meta'][$fid->id] = '';
         }
         $field_array[$fid->id] = $fid;
     }
     unset($all_fields);
     foreach ($values['item_meta'] as $field_id => $default_value) {
         if (isset($field_array[$field_id])) {
             $field = $field_array[$field_id];
         } else {
             $field = FrmField::getOne($field_id);
         }
         if (!$field) {
             continue;
         }
         if (isset($values['options']) || isset($values['field_options']['custom_html_' . $field_id])) {
             //updating the settings page
             if (isset($values['field_options']['custom_html_' . $field_id])) {
                 $field->field_options['custom_html'] = isset($values['field_options']['custom_html_' . $field_id]) ? $values['field_options']['custom_html_' . $field_id] : (isset($field->field_options['custom_html']) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html($field->type));
                 $field->field_options = apply_filters('frm_update_form_field_options', $field->field_options, $field, $values);
                 FrmField::update($field_id, array('field_options' => $field->field_options));
             } else {
                 if ($field->type == 'hidden' || $field->type == 'user_id') {
                     $prev_opts = $field->field_options;
                     $field->field_options = apply_filters('frm_update_form_field_options', $field->field_options, $field, $values);
                     if ($prev_opts != $field->field_options) {
                         FrmField::update($field_id, array('field_options' => $field->field_options));
                     }
                     unset($prev_opts);
                 }
             }
         }
         if ((isset($values['options']) || isset($values['field_options']['custom_html_' . $field_id])) && !defined('WP_IMPORTING')) {
             continue;
         }
         //updating the form
         foreach (array('size', 'max', 'label', 'invalid', 'blank', 'classes', 'captcha_size') as $opt) {
             $field->field_options[$opt] = isset($values['field_options'][$opt . '_' . $field_id]) ? trim($values['field_options'][$opt . '_' . $field_id]) : '';
         }
         $field->field_options['required_indicator'] = isset($values['field_options']['required_indicator_' . $field_id]) ? trim($values['field_options']['required_indicator_' . $field_id]) : '*';
         $field->field_options['separate_value'] = isset($values['field_options']['separate_value_' . $field_id]) ? trim($values['field_options']['separate_value_' . $field_id]) : 0;
         $field->field_options = apply_filters('frm_update_field_options', $field->field_options, $field, $values);
         $default_value = maybe_serialize($values['item_meta'][$field_id]);
         $field_key = isset($values['field_options']['field_key_' . $field_id]) ? $values['field_options']['field_key_' . $field_id] : $field->field_key;
         $required = isset($values['field_options']['required_' . $field_id]) ? $values['field_options']['required_' . $field_id] : false;
         $field_type = isset($values['field_options']['type_' . $field_id]) ? $values['field_options']['type_' . $field_id] : $field->type;
         $field_description = isset($values['field_options']['description_' . $field_id]) ? $values['field_options']['description_' . $field_id] : $field->description;
         FrmField::update($field_id, array('field_key' => $field_key, 'type' => $field_type, 'default_value' => $default_value, 'field_options' => $field->field_options, 'description' => $field_description, 'required' => $required));
         FrmField::delete_form_transient($field->form_id);
     }
     return $values;
 }
开发者ID:mazykin46,项目名称:portfolio,代码行数:70,代码来源:FrmForm.php

示例8: setup_new_vars

 public static function setup_new_vars($fields, $form = '', $reset = false)
 {
     global $frm_vars;
     $values = array();
     foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default) {
         $values[$var] = FrmAppHelper::get_post_param($var, $default);
     }
     $values['fields'] = array();
     if (empty($fields)) {
         return apply_filters('frm_setup_new_entry', $values);
     }
     foreach ((array) $fields as $field) {
         $default = $field->default_value;
         $posted_val = false;
         $new_value = $default;
         if (!$reset && $_POST && isset($_POST['item_meta'][$field->id]) && $_POST['item_meta'][$field->id] != '') {
             $new_value = stripslashes_deep($_POST['item_meta'][$field->id]);
             $posted_val = true;
         } else {
             if (FrmField::is_option_true($field, 'clear_on_focus')) {
                 $new_value = '';
             }
         }
         $is_default = $new_value == $default ? true : false;
         //If checkbox, multi-select dropdown, or checkbox data from entries field, set return array to true
         $return_array = FrmField::is_field_with_multiple_values($field);
         $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true, $return_array);
         if (!is_array($new_value)) {
             if ($is_default) {
                 $new_value = $field->default_value;
             } else {
                 if (!$posted_val) {
                     $new_value = apply_filters('frm_filter_default_value', $new_value, $field);
                 }
             }
             $new_value = str_replace('"', '"', $new_value);
         }
         unset($is_default, $posted_val);
         $field_array = array('id' => $field->id, 'value' => $new_value, 'default_value' => $field->default_value, 'name' => $field->name, 'description' => $field->description, 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), 'options' => $field->options, 'required' => $field->required, 'field_key' => $field->field_key, 'field_order' => $field->field_order, 'form_id' => $field->form_id);
         $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
         $opt_defaults['required_indicator'] = '';
         $opt_defaults['original_type'] = $field->type;
         foreach ($opt_defaults as $opt => $default_opt) {
             $field_array[$opt] = isset($field->field_options[$opt]) && $field->field_options[$opt] != '' ? $field->field_options[$opt] : $default_opt;
             unset($opt, $default_opt);
         }
         unset($opt_defaults);
         if ($field_array['custom_html'] == '') {
             $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
         }
         $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
         $field_array = array_merge($field->field_options, $field_array);
         $values['fields'][] = $field_array;
         if (!$form || !isset($form->id)) {
             $form = FrmForm::getOne($field->form_id);
         }
     }
     $form->options = maybe_unserialize($form->options);
     if (is_array($form->options)) {
         foreach ($form->options as $opt => $value) {
             $values[$opt] = FrmAppHelper::get_post_param($opt, $value);
             unset($opt, $value);
         }
     }
     $form_defaults = FrmFormsHelper::get_default_opts();
     $frm_settings = FrmAppHelper::get_settings();
     $form_defaults['custom_style'] = $frm_settings->load_style != 'none';
     $values = array_merge($form_defaults, $values);
     return apply_filters('frm_setup_new_entry', $values);
 }
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:70,代码来源:FrmEntriesHelper.php

示例9: setup_new_vars

 public static function setup_new_vars($fields, $form = '', $reset = false)
 {
     global $frm_settings, $frm_vars;
     $values = array();
     foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default) {
         $values[$var] = FrmAppHelper::get_post_param($var, $default);
     }
     $values['fields'] = array();
     if (empty($fields)) {
         return apply_filters('frm_setup_new_entry', $values);
     }
     foreach ((array) $fields as $field) {
         $field->field_options = maybe_unserialize($field->field_options);
         $default = $field->default_value;
         $posted_val = false;
         if ($reset) {
             $new_value = $default;
         } else {
             if ($_POST && isset($_POST['item_meta'][$field->id]) && $_POST['item_meta'][$field->id] != '') {
                 $new_value = stripslashes_deep($_POST['item_meta'][$field->id]);
                 $posted_val = true;
             } else {
                 if (isset($field->field_options['clear_on_focus']) && $field->field_options['clear_on_focus']) {
                     $new_value = '';
                 } else {
                     $new_value = $default;
                 }
             }
         }
         $is_default = $new_value == $default ? true : false;
         //If checkbox, multi-select dropdown, or checkbox data from entries field, set return array to true
         if ($field && ($field->type == 'data' && $field->field_options['data_type'] == 'checkbox' || $field->type == 'checkbox' || $field->type == 'select' && isset($field->field_options['multiple']) && $field->field_options['multiple'] == 1)) {
             $return_array = true;
         } else {
             $return_array = false;
         }
         $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true, $return_array);
         if (!is_array($new_value)) {
             if ($is_default) {
                 $new_value = $field->default_value;
             } else {
                 if (!$posted_val) {
                     $new_value = apply_filters('frm_filter_default_value', $new_value, $field);
                 }
             }
             $new_value = str_replace('"', '"', $new_value);
         }
         unset($is_default);
         unset($posted_val);
         $field_array = array('id' => $field->id, 'value' => $new_value, 'default_value' => $field->default_value, 'name' => $field->name, 'description' => $field->description, 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), 'options' => $field->options, 'required' => $field->required, 'field_key' => $field->field_key, 'field_order' => $field->field_order, 'form_id' => $field->form_id);
         $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
         $opt_defaults['required_indicator'] = '';
         foreach ($opt_defaults as $opt => $default_opt) {
             $field_array[$opt] = isset($field->field_options[$opt]) && $field->field_options[$opt] != '' ? $field->field_options[$opt] : $default_opt;
             unset($opt);
             unset($default_opt);
         }
         unset($opt_defaults);
         if ($field_array['size'] == '') {
             $field_array['size'] = isset($frm_vars['sidebar_width']) ? $frm_vars['sidebar_width'] : '';
         }
         if ($field_array['custom_html'] == '') {
             $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
         }
         $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
         foreach ((array) $field->field_options as $k => $v) {
             if (!isset($field_array[$k])) {
                 $field_array[$k] = $v;
             }
             unset($k);
             unset($v);
         }
         $values['fields'][] = $field_array;
         if (!$form or !isset($form->id)) {
             $frm_form = new FrmForm();
             $form = $frm_form->getOne($field->form_id);
         }
     }
     $form->options = maybe_unserialize($form->options);
     if (is_array($form->options)) {
         foreach ($form->options as $opt => $value) {
             $values[$opt] = FrmAppHelper::get_post_param($opt, $value);
         }
     }
     if (!isset($values['custom_style'])) {
         $values['custom_style'] = $frm_settings->load_style != 'none';
     }
     if (!isset($values['email_to'])) {
         $values['email_to'] = '';
     }
     if (!isset($values['submit_value'])) {
         $values['submit_value'] = $frm_settings->submit_value;
     }
     if (!isset($values['success_msg'])) {
         $values['success_msg'] = $frm_settings->success_msg;
     }
     if (!isset($values['akismet'])) {
         $values['akismet'] = '';
     }
     if (!isset($values['before_html'])) {
//.........这里部分代码省略.........
开发者ID:amit0773,项目名称:manaslake,代码行数:101,代码来源:FrmEntriesHelper.php

示例10: update_fields

 /**
  * @return array
  */
 public static function update_fields($id, $values)
 {
     if (!isset($values['options']) && !isset($values['item_meta']) && !isset($values['field_options'])) {
         return $values;
     }
     $all_fields = FrmField::get_all_for_form($id);
     if (empty($all_fields)) {
         return $values;
     }
     if (!isset($values['item_meta'])) {
         $values['item_meta'] = array();
     }
     $field_array = array();
     $existing_keys = array_keys($values['item_meta']);
     foreach ($all_fields as $fid) {
         if (!in_array($fid->id, $existing_keys) && (isset($values['frm_fields_submitted']) && in_array($fid->id, $values['frm_fields_submitted'])) || isset($values['options'])) {
             $values['item_meta'][$fid->id] = '';
         }
         $field_array[$fid->id] = $fid;
     }
     unset($all_fields);
     foreach ($values['item_meta'] as $field_id => $default_value) {
         if (isset($field_array[$field_id])) {
             $field = $field_array[$field_id];
         } else {
             $field = FrmField::getOne($field_id);
         }
         if (!$field) {
             continue;
         }
         $is_settings_page = isset($values['options']) || isset($values['field_options']['custom_html_' . $field_id]);
         if ($is_settings_page) {
             //updating the settings page
             if (isset($values['field_options']['custom_html_' . $field_id])) {
                 $field->field_options['custom_html'] = isset($values['field_options']['custom_html_' . $field_id]) ? $values['field_options']['custom_html_' . $field_id] : (isset($field->field_options['custom_html']) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html($field->type));
                 $field->field_options = apply_filters('frm_update_form_field_options', $field->field_options, $field, $values);
                 FrmField::update($field_id, array('field_options' => $field->field_options));
             } else {
                 if ($field->type == 'hidden' || $field->type == 'user_id') {
                     $prev_opts = $field->field_options;
                     $field->field_options = apply_filters('frm_update_form_field_options', $field->field_options, $field, $values);
                     if ($prev_opts != $field->field_options) {
                         FrmField::update($field_id, array('field_options' => $field->field_options));
                     }
                     unset($prev_opts);
                 }
             }
         }
         if ($is_settings_page && !defined('WP_IMPORTING')) {
             continue;
         }
         //updating the form
         $update_options = FrmFieldsHelper::get_default_field_opts($field->type, $field, true);
         unset($update_options['custom_html']);
         // don't check for POST html
         $update_options = apply_filters('frm_field_options_to_update', $update_options);
         foreach ($update_options as $opt => $default) {
             $field->field_options[$opt] = isset($values['field_options'][$opt . '_' . $field_id]) ? trim(sanitize_text_field($values['field_options'][$opt . '_' . $field_id])) : $default;
         }
         $field->field_options = apply_filters('frm_update_field_options', $field->field_options, $field, $values);
         $default_value = maybe_serialize($values['item_meta'][$field_id]);
         $field_key = isset($values['field_options']['field_key_' . $field_id]) ? $values['field_options']['field_key_' . $field_id] : $field->field_key;
         $required = isset($values['field_options']['required_' . $field_id]) ? $values['field_options']['required_' . $field_id] : false;
         $field_type = isset($values['field_options']['type_' . $field_id]) ? $values['field_options']['type_' . $field_id] : $field->type;
         $field_description = isset($values['field_options']['description_' . $field_id]) ? $values['field_options']['description_' . $field_id] : $field->description;
         FrmField::update($field_id, array('field_key' => $field_key, 'type' => $field_type, 'default_value' => $default_value, 'field_options' => $field->field_options, 'description' => $field_description, 'required' => $required));
         FrmField::delete_form_transient($field->form_id);
     }
     self::clear_form_cache();
     return $values;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:74,代码来源:FrmForm.php

示例11: update

 function update($id, $values, $create_link = false)
 {
     global $wpdb, $frmdb, $frm_field, $frm_settings;
     if ($create_link or isset($values['options']) or isset($values['item_meta']) or isset($values['field_options'])) {
         $values['status'] = 'published';
     }
     if (isset($values['form_key'])) {
         $values['form_key'] = FrmAppHelper::get_unique_key($values['form_key'], $frmdb->forms, 'form_key', $id);
     }
     $form_fields = array('form_key', 'name', 'description', 'status', 'prli_link_id');
     $new_values = array();
     if (isset($values['options'])) {
         $options = array();
         $defaults = FrmFormsHelper::get_default_opts();
         foreach ($defaults as $var => $default) {
             $options[$var] = isset($values['options'][$var]) ? $values['options'][$var] : $default;
         }
         $options['custom_style'] = isset($values['options']['custom_style']) ? $values['options']['custom_style'] : 0;
         $options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
         $options['after_html'] = isset($values['options']['after_html']) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html('after');
         $options = apply_filters('frm_form_options_before_update', $options, $values);
         $new_values['options'] = serialize($options);
     }
     foreach ($values as $value_key => $value) {
         if (in_array($value_key, $form_fields)) {
             $new_values[$value_key] = $value;
         }
     }
     if (!empty($new_values)) {
         $query_results = $wpdb->update($frmdb->forms, $new_values, array('id' => $id));
         if ($query_results) {
             wp_cache_delete($id, 'frm_form');
         }
     } else {
         $query_results = true;
     }
     $all_fields = $frm_field->getAll(array('fi.form_id' => $id));
     if ($all_fields and (isset($values['options']) or isset($values['item_meta']) or isset($values['field_options']))) {
         if (!isset($values['item_meta'])) {
             $values['item_meta'] = array();
         }
         $existing_keys = array_keys($values['item_meta']);
         foreach ($all_fields as $fid) {
             if (!in_array($fid->id, $existing_keys)) {
                 $values['item_meta'][$fid->id] = '';
             }
         }
         foreach ($values['item_meta'] as $field_id => $default_value) {
             $field = $frm_field->getOne($field_id);
             if (!$field) {
                 continue;
             }
             $field_options = maybe_unserialize($field->field_options);
             if (isset($values['options']) or isset($values['field_options']['custom_html_' . $field_id])) {
                 //updating the settings page
                 if (isset($values['field_options']['custom_html_' . $field_id])) {
                     $field_options['custom_html'] = isset($values['field_options']['custom_html_' . $field_id]) ? $values['field_options']['custom_html_' . $field_id] : (isset($field_options['custom_html']) ? $field_options['custom_html'] : FrmFieldsHelper::get_default_html($field->type));
                     $field_options = apply_filters('frm_update_form_field_options', $field_options, $field, $values);
                     $frm_field->update($field_id, array('field_options' => $field_options));
                 } else {
                     if ($field->type == 'hidden') {
                         $prev_opts = $field_options;
                         $field_options = apply_filters('frm_update_form_field_options', $field_options, $field, $values);
                         if ($prev_opts != $field_options) {
                             $frm_field->update($field_id, array('field_options' => $field_options));
                         }
                         unset($prev_opts);
                     }
                 }
             } else {
                 //updating the form
                 foreach (array('size', 'max', 'label', 'invalid', 'required_indicator', 'blank', 'classes') as $opt) {
                     $field_options[$opt] = isset($values['field_options'][$opt . '_' . $field_id]) ? trim($values['field_options'][$opt . '_' . $field_id]) : '';
                 }
                 $field_options['separate_value'] = isset($values['field_options']['separate_value_' . $field_id]) ? trim($values['field_options']['separate_value_' . $field_id]) : 0;
                 $field_options = apply_filters('frm_update_field_options', $field_options, $field, $values);
                 $default_value = maybe_serialize($values['item_meta'][$field_id]);
                 $field_key = isset($values['field_options']['field_key_' . $field_id]) ? $values['field_options']['field_key_' . $field_id] : $field->field_key;
                 $field_type = isset($values['field_options']['type_' . $field_id]) ? $values['field_options']['type_' . $field_id] : $field->type;
                 $field_description = isset($values['field_options']['description_' . $field_id]) ? $values['field_options']['description_' . $field_id] : $field->description;
                 $frm_field->update($field_id, array('field_key' => $field_key, 'type' => $field_type, 'default_value' => $default_value, 'field_options' => $field_options, 'description' => $field_description));
             }
         }
     }
     if (isset($values['form_key']) && class_exists('PrliLink')) {
         $form = $this->getOne($id);
         global $prli_link;
         $prlink = $prli_link->getOne($form->prli_link_id);
         if ($prlink) {
             $prli = array();
             $prli['url'] = FrmFormsHelper::get_direct_link($values['form_key']);
             $prli['slug'] = $prlink->slug;
             $prli['name'] = $prlink->name;
             $prli['param_forwarding'] = $prlink->param_forwarding;
             $prli['param_struct'] = $prlink->param_struct;
             $prli['redirect_type'] = $prlink->redirect_type;
             $prli['description'] = $prlink->description;
             $prli['track_me'] = $prlink->track_me;
             $prli['nofollow'] = $prlink->nofollow;
             $prli['group_id'] = $prlink->group_id;
//.........这里部分代码省略.........
开发者ID:moscarar,项目名称:cityhow,代码行数:101,代码来源:FrmForm.php

示例12: foreach

    ?>
';
<?php 
    foreach (array('name', 'description', 'type', 'default_value', 'options', 'required', 'field_order') as $col) {
        ?>
$field_values['<?php 
        echo $col;
        ?>
'] = '<?php 
        echo $col != 'options' ? addslashes($field->{$col}) : $field->{$col};
        ?>
';
<?php 
    }
    foreach ($field->field_options as $opt_key => $field_opt) {
        if ($opt_key == 'custom_html' and $field_opt == FrmFieldsHelper::get_default_html($field->type)) {
            continue;
        }
        ?>
$field_values['field_options']['<?php 
        echo $opt_key;
        ?>
'] = '<?php 
        echo addslashes(maybe_serialize($field_opt));
        ?>
';
<?php 
    }
    ?>
$frm_field->create( $field_values );
开发者ID:moscarar,项目名称:cityhow,代码行数:30,代码来源:export_template.php

示例13: setup_edit_vars

 public static function setup_edit_vars($record, $table, $fields = '', $default = false, $post_values = array())
 {
     if (!$record) {
         return false;
     }
     global $frm_entry_meta, $frm_settings, $frm_vars;
     if (empty($post_values)) {
         $post_values = stripslashes_deep($_POST);
     }
     $values = array('id' => $record->id, 'fields' => array());
     foreach (array('name', 'description') as $var) {
         $default_val = isset($record->{$var}) ? $record->{$var} : '';
         $values[$var] = FrmAppHelper::get_param($var, $default_val);
         unset($var, $default_val);
     }
     if (apply_filters('frm_use_wpautop', true)) {
         $values['description'] = wpautop(str_replace('<br>', '<br />', $values['description']));
     }
     foreach ((array) $fields as $field) {
         if ($default) {
             $meta_value = $field->default_value;
         } else {
             if ($record->post_id and class_exists('FrmProEntryMetaHelper') and isset($field->field_options['post_field']) and $field->field_options['post_field']) {
                 if (!isset($field->field_options['custom_field'])) {
                     $field->field_options['custom_field'] = '';
                 }
                 $meta_value = FrmProEntryMetaHelper::get_post_value($record->post_id, $field->field_options['post_field'], $field->field_options['custom_field'], array('truncate' => false, 'type' => $field->type, 'form_id' => $field->form_id, 'field' => $field));
             } else {
                 if (isset($record->metas)) {
                     $meta_value = isset($record->metas[$field->id]) ? $record->metas[$field->id] : false;
                 } else {
                     $meta_value = $frm_entry_meta->get_entry_meta_by_field($record->id, $field->id);
                 }
             }
         }
         $field_type = isset($post_values['field_options']['type_' . $field->id]) ? $post_values['field_options']['type_' . $field->id] : $field->type;
         $new_value = isset($post_values['item_meta'][$field->id]) ? maybe_unserialize($post_values['item_meta'][$field->id]) : $meta_value;
         $field_array = array('id' => $field->id, 'value' => $new_value, 'default_value' => $field->default_value, 'name' => $field->name, 'description' => $field->description, 'type' => apply_filters('frm_field_type', $field_type, $field, $new_value), 'options' => $field->options, 'required' => $field->required, 'field_key' => $field->field_key, 'field_order' => $field->field_order, 'form_id' => $field->form_id);
         /*if(in_array($field_array['type'], array('checkbox', 'radio', 'select')) and !empty($field_array['options'])){
               foreach((array)$field_array['options'] as $opt_key => $opt){
                   if(!is_array($opt))
                       $field_array['options'][$opt_key] = array('label' => $opt);
                   unset($opt);
                   unset($opt_key);
               }
           }*/
         $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
         foreach ($opt_defaults as $opt => $default_opt) {
             $field_array[$opt] = $post_values && isset($post_values['field_options'][$opt . '_' . $field->id]) ? maybe_unserialize($post_values['field_options'][$opt . '_' . $field->id]) : (isset($field->field_options[$opt]) ? $field->field_options[$opt] : $default_opt);
             if ($opt == 'blank' and $field_array[$opt] == '') {
                 $field_array[$opt] = $frm_settings->blank_msg;
             } else {
                 if ($opt == 'invalid' and $field_array[$opt] == '') {
                     if ($field_type == 'captcha') {
                         $field_array[$opt] = $frm_settings->re_msg;
                     } else {
                         $field_array[$opt] = sprintf(__('%s is invalid', 'formidable'), $field_array['name']);
                     }
                 }
             }
         }
         unset($opt_defaults);
         if ($field_array['custom_html'] == '') {
             $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field_type);
         }
         if ($field_array['size'] == '') {
             $field_array['size'] = isset($frm_vars['sidebar_width']) ? $frm_vars['sidebar_width'] : '';
         }
         $field_array = apply_filters('frm_setup_edit_fields_vars', $field_array, $field, $values['id']);
         if (!isset($field_array['unique']) or !$field_array['unique']) {
             $field_array['unique_msg'] = '';
         }
         foreach ((array) $field->field_options as $k => $v) {
             if (!isset($field_array[$k])) {
                 $field_array[$k] = $v;
             }
             unset($k);
             unset($v);
         }
         $values['fields'][$field->id] = $field_array;
         unset($field);
     }
     $frm_form = new FrmForm();
     $form = $frm_form->getOne($table == 'entries' ? $record->form_id : $record->id);
     unset($frm_form);
     if ($form) {
         $values['form_name'] = isset($record->form_id) ? $form->name : '';
         if (is_array($form->options)) {
             foreach ($form->options as $opt => $value) {
                 if (in_array($opt, array('email_to', 'reply_to', 'reply_to_name'))) {
                     $values['notification'][0][$opt] = isset($post_values["notification[0][{$opt}]"]) ? maybe_unserialize($post_values["notification[0][{$opt}]"]) : $value;
                 }
                 $values[$opt] = isset($post_values[$opt]) ? maybe_unserialize($post_values[$opt]) : $value;
             }
         }
     }
     $form_defaults = FrmFormsHelper::get_default_opts();
     //set to posted value or default
     foreach ($form_defaults as $opt => $default) {
         if (!isset($values[$opt]) or $values[$opt] == '') {
//.........这里部分代码省略.........
开发者ID:amit0773,项目名称:manaslake,代码行数:101,代码来源:FrmAppHelper.php

示例14: setup_edit_vars

 function setup_edit_vars($record, $table, $fields = '', $default = false)
 {
     if (!$record) {
         return false;
     }
     global $frm_entry_meta, $frm_form, $frm_settings, $frm_sidebar_width;
     $values = array();
     $values['id'] = $record->id;
     foreach (array('name' => $record->name, 'description' => $record->description) as $var => $default_val) {
         $values[$var] = stripslashes(FrmAppHelper::get_param($var, $default_val));
     }
     if (apply_filters('frm_use_wpautop', true)) {
         $values['description'] = wpautop($values['description']);
     }
     $values['fields'] = array();
     if ($fields) {
         foreach ($fields as $field) {
             $field->field_options = stripslashes_deep(maybe_unserialize($field->field_options));
             if ($default) {
                 $meta_value = $field->default_value;
             } else {
                 if ($record->post_id and class_exists('FrmProEntryMetaHelper') and isset($field->field_options['post_field']) and $field->field_options['post_field']) {
                     $meta_value = FrmProEntryMetaHelper::get_post_value($record->post_id, $field->field_options['post_field'], $field->field_options['custom_field'], array('truncate' => false, 'type' => $field->type, 'form_id' => $field->form_id, 'field' => $field));
                 } else {
                     if (isset($record->metas)) {
                         $meta_value = isset($record->metas[$field->id]) ? $record->metas[$field->id] : false;
                     } else {
                         $meta_value = $frm_entry_meta->get_entry_meta_by_field($record->id, $field->id);
                     }
                 }
             }
             $field_type = isset($_POST['field_options']['type_' . $field->id]) ? $_POST['field_options']['type_' . $field->id] : $field->type;
             $new_value = isset($_POST['item_meta'][$field->id]) ? $_POST['item_meta'][$field->id] : $meta_value;
             $new_value = maybe_unserialize($new_value);
             if (is_array($new_value)) {
                 $new_value = stripslashes_deep($new_value);
             }
             $field_array = array('id' => $field->id, 'value' => $new_value, 'default_value' => stripslashes_deep(maybe_unserialize($field->default_value)), 'name' => stripslashes($field->name), 'description' => stripslashes($field->description), 'type' => apply_filters('frm_field_type', $field_type, $field, $new_value), 'options' => stripslashes_deep(maybe_unserialize($field->options)), 'required' => $field->required, 'field_key' => $field->field_key, 'field_order' => $field->field_order, 'form_id' => $field->form_id);
             /*if(in_array($field_array['type'], array('checkbox', 'radio', 'select')) and !empty($field_array['options'])){
                   foreach((array)$field_array['options'] as $opt_key => $opt){
                       if(!is_array($opt))
                           $field_array['options'][$opt_key] = array('label' => $opt);
                       unset($opt);
                       unset($opt_key);
                   }
               }*/
             $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
             foreach ($opt_defaults as $opt => $default_opt) {
                 $field_array[$opt] = ($_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_opt);
                 if ($opt == 'blank' and $field_array[$opt] == '') {
                     $field_array[$opt] = __('This field cannot be blank', 'formidable');
                 } else {
                     if ($opt == 'invalid' and $field_array[$opt] == '') {
                         if ($field_type == 'captcha') {
                             $field_array[$opt] = $frm_settings->re_msg;
                         } else {
                             $field_array[$opt] = $field_array['name'] . ' ' . __('is invalid', 'formidable');
                         }
                     }
                 }
             }
             unset($opt_defaults);
             if ($field_array['custom_html'] == '') {
                 $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field_type);
             }
             if ($field_array['size'] == '') {
                 $field_array['size'] = $frm_sidebar_width;
             }
             $values['fields'][] = apply_filters('frm_setup_edit_fields_vars', stripslashes_deep($field_array), $field, $values['id']);
             unset($field);
         }
     }
     if ($table == 'entries') {
         $form = $frm_form->getOne($record->form_id);
     } else {
         if ($table == 'forms') {
             $form = $frm_form->getOne($record->id);
         }
     }
     if ($form) {
         $form->options = maybe_unserialize($form->options);
         $values['form_name'] = isset($record->form_id) ? $form->name : '';
         if (is_array($form->options)) {
             foreach ($form->options as $opt => $value) {
                 $values[$opt] = FrmAppHelper::get_param($opt, $value);
             }
         }
     }
     $form_defaults = FrmFormsHelper::get_default_opts();
     $form_defaults['email_to'] = '';
     //options to allow blank answers
     foreach (array('email_to', 'reply_to', 'reply_to_name') as $opt) {
         if (!isset($values[$opt])) {
             $values[$opt] = ($_POST and isset($_POST['options'][$opt])) ? $_POST['options'][$opt] : $form_defaults[$opt];
             unset($form_defaults[$opt]);
             unset($opt);
         }
     }
     //don't allow blank answers
     foreach ($form_defaults as $opt => $default) {
//.........这里部分代码省略.........
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:101,代码来源:FrmAppHelper.php

示例15: fill_field_opts

 private static function fill_field_opts($field, array &$field_array, $args)
 {
     $post_values = $args['post_values'];
     $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
     foreach ($opt_defaults as $opt => $default_opt) {
         $field_array[$opt] = $post_values && isset($post_values['field_options'][$opt . '_' . $field->id]) ? maybe_unserialize($post_values['field_options'][$opt . '_' . $field->id]) : (isset($field->field_options[$opt]) ? $field->field_options[$opt] : $default_opt);
         if ($opt == 'blank' && $field_array[$opt] == '') {
             $field_array[$opt] = $args['frm_settings']->blank_msg;
         } else {
             if ($opt == 'invalid' && $field_array[$opt] == '') {
                 if ($args['field_type'] == 'captcha') {
                     $field_array[$opt] = $args['frm_settings']->re_msg;
                 } else {
                     $field_array[$opt] = sprintf(__('%s is invalid', 'formidable'), $field_array['name']);
                 }
             }
         }
     }
     if ($field_array['custom_html'] == '') {
         $field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
     }
 }
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:22,代码来源:FrmAppHelper.php


注:本文中的FrmFieldsHelper::get_default_html方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。