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


PHP FrmAppHelper::get_unique_key方法代码示例

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


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

示例1: update

 function update($id, $values)
 {
     global $wpdb, $frmprodb, $frm_field;
     $new_values = array();
     $values['display_key'] = isset($values['display_key']) ? $values['display_key'] : $values['name'];
     $new_values['display_key'] = FrmAppHelper::get_unique_key($values['display_key'], $frmprodb->displays, 'display_key', $id);
     $new_values['param'] = isset($values['param']) ? sanitize_title_with_dashes($values['param']) : '';
     $fields = array('name', 'description', 'content', 'dyncontent', 'insert_loc', 'type', 'show_count', 'form_id', 'entry_id', 'post_id');
     foreach ($fields as $field) {
         $new_values[$field] = $values[$field];
     }
     $new_values['entry_id'] = isset($values['entry_id']) ? (int) $values['entry_id'] : 0;
     if (isset($values['options'])) {
         $new_values['options'] = array();
         foreach ($values['options'] as $key => $value) {
             $new_values['options'][$key] = $value;
         }
         $new_values['options'] = maybe_serialize($new_values['options']);
     }
     $query_results = $wpdb->update($frmprodb->displays, $new_values, array('id' => $id));
     if ($query_results) {
         wp_cache_delete($id, 'frm_display');
         do_action('frm_update_display', $id, $values);
     }
     return $query_results;
 }
开发者ID:moscarar,项目名称:cityhow,代码行数:26,代码来源:FrmProDisplay.php

示例2: validate

 public static function validate($values, $exclude = false)
 {
     global $wpdb;
     FrmEntry::sanitize_entry_post($values);
     $errors = array();
     if (!isset($values['form_id']) || !isset($values['item_meta'])) {
         $errors['form'] = __('There was a problem with your submission. Please try again.', 'formidable');
         return $errors;
     }
     if (FrmAppHelper::is_admin() && is_user_logged_in() && (!isset($values['frm_submit_entry_' . $values['form_id']]) || !wp_verify_nonce($values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce'))) {
         $errors['form'] = __('You do not have permission to do that', 'formidable');
     }
     if (!isset($values['item_key']) || $values['item_key'] == '') {
         $_POST['item_key'] = $values['item_key'] = FrmAppHelper::get_unique_key('', $wpdb->prefix . 'frm_items', 'item_key');
     }
     $where = apply_filters('frm_posted_field_ids', array('fi.form_id' => $values['form_id']));
     // Don't get subfields
     $where['fr.parent_form_id'] = array(null, 0);
     // Don't get excluded fields (like file upload fields in the ajax validation)
     if (!empty($exclude)) {
         $where['fi.type not'] = $exclude;
     }
     $posted_fields = FrmField::getAll($where, 'field_order');
     // Pass exclude value to validate_field function so it can be used for repeating sections
     $args = array('exclude' => $exclude);
     foreach ($posted_fields as $posted_field) {
         self::validate_field($posted_field, $errors, $values, $args);
         unset($posted_field);
     }
     // check for spam
     self::spam_check($exclude, $values, $errors);
     $errors = apply_filters('frm_validate_entry', $errors, $values, compact('exclude'));
     return $errors;
 }
开发者ID:hugocica,项目名称:locomotiva-2016,代码行数:34,代码来源:FrmEntryValidate.php

示例3: update

 function update($id, $values)
 {
     global $wpdb;
     if (isset($values['field_key'])) {
         $values['field_key'] = FrmAppHelper::get_unique_key($values['field_key'], $wpdb->prefix . 'frm_fields', 'field_key', $id);
     }
     if (isset($values['required'])) {
         $values['required'] = (int) $values['required'];
     }
     if (isset($values['default_value']) and is_array($values['default_value'])) {
         $values['default_value'] = serialize($values['default_value']);
     }
     if (isset($values['field_options']) and is_array($values['field_options'])) {
         $values['field_options'] = serialize($values['field_options']);
     }
     if (isset($values['options']) and is_array($values['options'])) {
         $values['options'] = serialize($values['options']);
     }
     $query_results = $wpdb->update($wpdb->prefix . 'frm_fields', $values, array('id' => $id));
     if (isset($values['form_id'])) {
         $form_id = $values['form_id'];
     } else {
         $field = $this->getOne($id);
         if ($field) {
             $form_id = $field->form_id;
         }
         unset($field);
     }
     unset($values);
     if ($query_results) {
         wp_cache_delete($id, 'frm_field');
         delete_transient('frm_all_form_fields_' . $form_id);
     }
     return $query_results;
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:35,代码来源:FrmField.php

示例4: get_default_field_opts

 function get_default_field_opts($type, $field, $limit = false)
 {
     $field_options = array('size' => '', 'max' => '', 'label' => '', 'blank' => '', 'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0, 'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '', 'custom_html' => '');
     if ($limit) {
         return $field_options;
     }
     global $frmdb, $frm_app_helper, $frm_settings;
     $form_id = is_numeric($field) ? $field : $field->form_id;
     $key = is_numeric($field) ? FrmAppHelper::get_unique_key('', $frmdb->fields, 'field_key') : $field->field_key;
     $field_count = $frm_app_helper->getRecordCount("form_id='{$form_id}'", $frmdb->fields);
     return array('name' => __('Untitled', 'formidable'), 'description' => '', 'field_key' => $key, 'type' => $type, 'options' => '', 'default_value' => '', 'field_order' => $field_count + 1, 'required' => false, 'blank' => __('This field cannot be blank', 'formidable'), 'invalid' => __('This field is invalid', 'formidable'), 'form_id' => $form_id, 'field_options' => $field_options);
 }
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:12,代码来源:FrmFieldsHelper.php

示例5: update

 function update($id, $values)
 {
     global $wpdb, $frmdb;
     if (isset($values['field_key'])) {
         $values['field_key'] = FrmAppHelper::get_unique_key($values['field_key'], $frmdb->fields, 'field_key', $id);
     }
     if (isset($values['field_options']) and is_array($values['field_options'])) {
         $values['field_options'] = serialize($values['field_options']);
     }
     $query_results = $wpdb->update($frmdb->fields, $values, array('id' => $id));
     unset($values);
     if ($query_results) {
         wp_cache_delete($id, 'frm_field');
     }
     return $query_results;
 }
开发者ID:moscarar,项目名称:cityhow,代码行数:16,代码来源:FrmField.php

示例6: fill_field

 public static function fill_field(&$values, $field, $form_id, $new_key = '')
 {
     global $wpdb;
     $values['field_key'] = FrmAppHelper::get_unique_key($new_key, $wpdb->prefix . 'frm_fields', 'field_key');
     $values['form_id'] = $form_id;
     $values['options'] = maybe_serialize($field->options);
     $values['default_value'] = maybe_serialize($field->default_value);
     foreach (array('name', 'description', 'type', 'field_order', 'field_options', 'required') as $col) {
         $values[$col] = $field->{$col};
     }
 }
开发者ID:EyesX,项目名称:formidable-forms,代码行数:11,代码来源:FrmFieldsHelper.php

示例7: setup_new_vars

 /**
  * Used when a form is created
  */
 public static function setup_new_vars($values = array())
 {
     global $wpdb;
     if (!empty($values)) {
         $post_values = $values;
     } else {
         $values = array();
         $post_values = isset($_POST) ? $_POST : array();
     }
     foreach (array('name' => '', 'description' => '') as $var => $default) {
         if (!isset($values[$var])) {
             $values[$var] = FrmAppHelper::get_param($var, $default);
         }
     }
     $values['description'] = FrmAppHelper::use_wpautop($values['description']);
     foreach (array('form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0) as $var => $default) {
         if (!isset($values[$var])) {
             $values[$var] = FrmAppHelper::get_param($var, $default);
         }
     }
     if (!isset($values['form_key'])) {
         $values['form_key'] = $post_values && isset($post_values['form_key']) ? $post_values['form_key'] : FrmAppHelper::get_unique_key('', $wpdb->prefix . 'frm_forms', 'form_key');
     }
     $values = self::fill_default_opts($values, false, $post_values);
     if ($post_values && isset($post_values['options']['custom_style'])) {
         $values['custom_style'] = $post_values['options']['custom_style'];
     } else {
         $frm_settings = FrmAppHelper::get_settings();
         $values['custom_style'] = $frm_settings->load_style != 'none';
     }
     return apply_filters('frm_setup_new_form_vars', $values);
 }
开发者ID:knightzac19,项目名称:formidable-forms,代码行数:35,代码来源:FrmFormsHelper.php

示例8: foreach

if ($form){
    $form_id = $form->id;
    $frm_form->update($form_id, $values );
    $form_fields = $frm_field->getAll(array('fi.form_id' => $form_id));
    if (!empty($form_fields)){
        foreach ($form_fields as $field)
            $frm_field->destroy($field->id);
    }
}else
    $form_id = $frm_form->create( $values );

<?php 
foreach ($fields as $field) {
    $field->field_options = maybe_unserialize($field->field_options);
    $new_key = FrmAppHelper::get_unique_key($field->field_key, $frmdb->fields, 'field_key');
    ?>
    
$field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('<?php 
    echo $field->type;
    ?>
', $form_id));
$field_values['field_key'] = '<?php 
    echo $new_key;
    ?>
';
<?php 
    foreach (array('name', 'description', 'type', 'default_value', 'options', 'required', 'field_order') as $col) {
        ?>
$field_values['<?php 
        echo $col;
开发者ID:moscarar,项目名称:cityhow,代码行数:30,代码来源:export_template.php

示例9: __construct

 function __construct($factory = null)
 {
     parent::__construct($factory);
     global $wpdb;
     $this->default_generation_definitions = array('item_key' => FrmAppHelper::get_unique_key('', $wpdb->prefix . 'frm_items', 'item_key'), 'name' => new WP_UnitTest_Generator_Sequence('Entry name %s'));
 }
开发者ID:knightzac19,项目名称:formidable-forms,代码行数:6,代码来源:frm_factory.php

示例10: package_entry_to_update

 /**
  * Package the entry data for updating
  *
  * @since 2.0.16
  * @param int $id
  * @param array $values
  * @return array $new_values
  */
 private static function package_entry_to_update($id, $values)
 {
     global $wpdb;
     $new_values = array('name' => self::get_new_entry_name($values), 'form_id' => self::get_form_id($values), 'is_draft' => self::get_is_draft_value($values), 'updated_at' => current_time('mysql', 1), 'updated_by' => isset($values['updated_by']) ? $values['updated_by'] : get_current_user_id());
     if (isset($values['post_id'])) {
         $new_values['post_id'] = (int) $values['post_id'];
     }
     if (isset($values['item_key'])) {
         $new_values['item_key'] = FrmAppHelper::get_unique_key($values['item_key'], $wpdb->prefix . 'frm_items', 'item_key', $id);
     }
     if (isset($values['parent_item_id'])) {
         $new_values['parent_item_id'] = (int) $values['parent_item_id'];
     }
     if (isset($values['frm_user_id']) && is_numeric($values['frm_user_id'])) {
         $new_values['user_id'] = $values['frm_user_id'];
     }
     $new_values = apply_filters('frm_update_entry', $new_values, $id);
     return $new_values;
 }
开发者ID:hugocica,项目名称:locomotiva-2016,代码行数:27,代码来源:FrmEntry.php

示例11: create_post_entry

 function create_post_entry($id = false, $post_id = false)
 {
     if (!$id) {
         $id = $_POST['id'];
     }
     if (!$post_id) {
         $post_id = $_POST['post_id'];
     }
     if (!is_numeric($id) or !is_numeric($post_id)) {
         return;
     }
     $post = get_post($post_id);
     global $frmdb, $wpdb, $frm_field;
     $values = array('description' => __('Copied from Post', 'formidable'), 'form_id' => $id, 'created_at' => $post->post_date_gmt, 'name' => $post->post_title, 'item_key' => FrmAppHelper::get_unique_key($post->post_name, $frmdb->entries, 'item_key'), 'user_id' => $post->post_author, 'post_id' => $post->ID);
     $results = $wpdb->insert($frmdb->entries, $values);
     unset($values);
     if ($results) {
         $entry_id = $wpdb->insert_id;
         $user_id_field = $frm_field->getAll(array('fi.type' => 'user_id', 'fi.form_id' => $id), '', 1);
         if ($user_id_field) {
             $new_values = array('meta_value' => $post->post_author, 'item_id' => $entry_id, 'field_id' => $user_id_field->id, 'created_at' => current_time('mysql', 1));
             $wpdb->insert($frmdb->entry_metas, $new_values);
         }
     }
     die;
 }
开发者ID:moscarar,项目名称:cityhow,代码行数:26,代码来源:FrmProEntriesController.php

示例12: create_post_entry

 public static function create_post_entry($id = false, $post_id = false)
 {
     if (!$id) {
         $id = $_POST['id'];
     }
     if (!$post_id) {
         $post_id = $_POST['post_id'];
     }
     if (!is_numeric($id) or !is_numeric($post_id)) {
         return;
     }
     $post = get_post($post_id);
     global $wpdb;
     $values = array('description' => __('Copied from Post', 'formidable'), 'form_id' => $id, 'created_at' => $post->post_date_gmt, 'name' => $post->post_title, 'item_key' => FrmAppHelper::get_unique_key($post->post_name, $wpdb->prefix . 'frm_items', 'item_key'), 'user_id' => $post->post_author, 'post_id' => $post->ID);
     $results = $wpdb->insert($wpdb->prefix . 'frm_items', $values);
     unset($values);
     if (!$results) {
         die;
     }
     $entry_id = $wpdb->insert_id;
     $frm_field = new FrmField();
     $user_id_field = $frm_field->getAll(array('fi.type' => 'user_id', 'fi.form_id' => $id), '', 1);
     unset($frm_field);
     if ($user_id_field) {
         $new_values = array('meta_value' => $post->post_author, 'item_id' => $entry_id, 'field_id' => $user_id_field->id, 'created_at' => current_time('mysql', 1));
         $wpdb->insert($wpdb->prefix . 'frm_item_metas', $new_values);
     }
     global $frmpro_display;
     $display = $frmpro_display->get_auto_custom_display(array('form_id' => $id, 'entry_id' => $entry_id));
     if ($display) {
         update_post_meta($post->ID, 'frm_display_id', $display->ID);
     }
     die;
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:34,代码来源:FrmProEntriesController.php

示例13: duplicate

 function duplicate()
 {
     global $frmdb, $frm_field, $frm_app_helper, $frm_ajax_url;
     $copy_field = $frm_field->getOne($_POST['field_id']);
     if (!$copy_field) {
         return;
     }
     $values = array();
     $values['field_key'] = FrmAppHelper::get_unique_key('', $frmdb->fields, 'field_key');
     $values['field_options'] = maybe_unserialize($copy_field->field_options);
     $values['form_id'] = $copy_field->form_id;
     foreach (array('name', 'description', 'type', 'default_value', 'options', 'required') as $col) {
         $values[$col] = $copy_field->{$col};
     }
     $field_count = $frm_app_helper->getRecordCount("form_id='{$copy_field->form_id}'", $frmdb->fields);
     $values['field_order'] = $field_count + 1;
     $field_id = $frm_field->create($values);
     if ($field_id) {
         $field = FrmFieldsHelper::setup_edit_vars($frm_field->getOne($field_id));
         $field_name = "item_meta[{$field_id}]";
         $id = $field['form_id'];
         require FRM_VIEWS_PATH . '/frm-forms/add_field.php';
         require FRM_VIEWS_PATH . '/frm-forms/new-field-js.php';
     }
     die;
 }
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:26,代码来源:FrmFieldsController.php

示例14: setup_new_vars

 public static function setup_new_vars($values = array())
 {
     global $wpdb, $frmdb, $frm_settings;
     if (!empty($values)) {
         $post_values = $values;
     } else {
         $values = array();
         $post_values = isset($_POST) ? $_POST : array();
     }
     foreach (array('name' => '', 'description' => '') as $var => $default) {
         if (!isset($values[$var])) {
             $values[$var] = FrmAppHelper::get_param($var, $default);
         }
     }
     if (apply_filters('frm_use_wpautop', true)) {
         $values['description'] = wpautop(str_replace('<br>', '<br />', $values['description']));
     }
     foreach (array('form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0) as $var => $default) {
         if (!isset($values[$var])) {
             $values[$var] = FrmAppHelper::get_param($var, $default);
         }
     }
     if (!isset($values['form_key'])) {
         $values['form_key'] = ($post_values and isset($post_values['form_key'])) ? $post_values['form_key'] : FrmAppHelper::get_unique_key('', $wpdb->prefix . 'frm_forms', 'form_key');
     }
     $values = self::fill_default_opts($values, false, $post_values);
     $values['custom_style'] = ($post_values and isset($post_values['options']['custom_style'])) ? $post_values['options']['custom_style'] : $frm_settings->load_style != 'none';
     $values['before_html'] = FrmFormsHelper::get_default_html('before');
     $values['after_html'] = FrmFormsHelper::get_default_html('after');
     $values['submit_html'] = FrmFormsHelper::get_default_html('submit');
     return apply_filters('frm_setup_new_form_vars', $values);
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:32,代码来源:FrmFormsHelper.php

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


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