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


PHP FrmField::delete_form_transient方法代码示例

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


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

示例1: migrate_to_28

 /**
  * Update incorrect end_divider form IDs
  */
 private static function migrate_to_28()
 {
     global $wpdb;
     $query = $wpdb->prepare("SELECT fi.id, fi.form_id, form.parent_form_id FROM " . $wpdb->prefix . "frm_fields fi INNER JOIN " . $wpdb->prefix . "frm_forms form ON fi.form_id = form.id WHERE fi.type = %s AND parent_form_id > %d", 'end_divider', 0);
     $end_dividers = $wpdb->get_results($query);
     foreach ($end_dividers as $e) {
         // Update the form_id column for the end_divider field
         $wpdb->update($wpdb->prefix . 'frm_fields', array('form_id' => $e->parent_form_id), array('id' => $e->id));
         // Clear the cache
         wp_cache_delete($e->id, 'frm_field');
         FrmField::delete_form_transient($e->form_id);
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:16,代码来源:FrmProDb.php

示例2: 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

示例3: 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


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